Skip to content

Commit

Permalink
arcore_java: fixed high speed filtering jumping (#1281)
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed May 25, 2024
1 parent c5c190a commit 03afb94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/android/src/com/introlab/rtabmap/ARCoreSharedCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ public void run() {
mToast.setText(msg);
}
previousAnchorPose = null;
arCoreCorrection = Pose.IDENTITY;
}
}
});
Expand All @@ -721,7 +722,8 @@ public void run() {
final double speed = Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])/((double)(frame.getTimestamp()-previousAnchorTimeStamp)/10e8);
if(speed>=mARCoreLocalizationFilteringSpeed)
{
arCoreCorrection = arCoreCorrection.compose(previousAnchorPose).compose(pose.inverse());
// Only correct the translation to not lose rotation aligned with gravity
arCoreCorrection = arCoreCorrection.compose(previousAnchorPose.compose(pose.inverse()).extractTranslation());
t = arCoreCorrection.getTranslation();
Log.e(TAG, String.format("POTENTIAL TELEPORTATION!!!!!!!!!!!!!! previous anchor moved (speed=%f), new arcorrection: %f %f %f", speed, t[0], t[1], t[2]));

Expand All @@ -747,7 +749,6 @@ public void run() {
{
mToast.setText(msg);
}
previousAnchorPose = null;
}
}
});
Expand All @@ -758,7 +759,7 @@ public void run() {
previousAnchorTimeStamp = frame.getTimestamp();

double stamp = (double)frame.getTimestamp()/10e8;
if(!RTABMapActivity.DISABLE_LOG) Log.d(TAG, String.format("pose=%f %f %f q=%f %f %f %f stamp=%f", odomPose.tx(), odomPose.ty(), odomPose.tz(), odomPose.qx(), odomPose.qy(), odomPose.qz(), odomPose.qw(), stamp));
if(!RTABMapActivity.DISABLE_LOG) Log.d(TAG, String.format("pose=%f %f %f arcore %f %f %f cor= %f %f %f stamp=%f", odomPose.tx(), odomPose.ty(), odomPose.tz(), pose.tx(), pose.ty(), pose.tz(), arCoreCorrection.tx(), arCoreCorrection.ty(), arCoreCorrection.tz(), stamp));
RTABMapLib.postCameraPoseEvent(RTABMapActivity.nativeApplication, odomPose.tx(), odomPose.ty(), odomPose.tz(), odomPose.qx(), odomPose.qy(), odomPose.qz(), odomPose.qw(), stamp);
CameraIntrinsics intrinsics = camera.getImageIntrinsics();
try{
Expand Down

0 comments on commit 03afb94

Please sign in to comment.