Skip to content

Commit

Permalink
CameraMobile: Fixed origin not updated if updateOnRender() is used
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Oct 6, 2024
1 parent c6f783c commit a14f064
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
28 changes: 13 additions & 15 deletions app/android/jni/CameraMobile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,21 @@ void CameraMobile::poseReceived(const Transform & pose, double deviceStamp)
{
stampEpochOffset_ = UTimer::now() - deviceStamp;
}

if(originUpdate_)
{
firstFrame_ = true;
lastKnownGPS_ = GPS();
lastEnvSensors_.clear();
dataGoodTracking_ = true;
previousAnchorPose_.setNull();
previousAnchorLinearVelocity_.clear();
previousAnchorStamp_ = 0.0;
originOffset_ = pose.translation().inverse();
originUpdate_ = false;
}

double epochStamp = stampEpochOffset_ + deviceStamp;

if(!originOffset_.isNull())
{
// Filter re-localizations from poses received
Expand Down Expand Up @@ -297,20 +309,6 @@ void CameraMobile::update(const SensorData & data, const Transform & pose, const
LOGD("CameraMobile::update pose=%s stamp=%f", pose.prettyPrint().c_str(), data.stamp());

bool notify = !data_.isValid();

if(originUpdate_)
{
firstFrame_ = true;
lastKnownGPS_ = GPS();
lastEnvSensors_.clear();
dataGoodTracking_ = true;
previousAnchorPose_.setNull();
previousAnchorLinearVelocity_.clear();
previousAnchorStamp_ = 0.0;
originOffset_ = pose.translation().inverse();
originUpdate_ = false;
poseReceived(pose, data.stamp());
}

data_ = data;
dataPose_ = pose;
Expand Down
4 changes: 4 additions & 0 deletions app/android/src/com/introlab/rtabmap/RTABMapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1775,16 +1775,19 @@ public void onClick(DialogInterface dialog, int which) {
long currentTime = System.currentTimeMillis()/1000;
if(loopClosureId > 0)
{
if (mToast != null && mToast.getView().isShown()) mToast.cancel();
mToast.setText(String.format("Loop closure detected! (%d/%d inliers)", inliers, matches));
mToast.show();
}
else if(landmarkDetected != 0)
{
if (mToast != null && mToast.getView().isShown()) mToast.cancel();
mToast.setText(String.format("Marker %d detected!", landmarkDetected));
mToast.show();
}
else if(rejected > 0)
{
if (mToast != null && mToast.getView().isShown()) mToast.cancel();
if(inliers >= Integer.parseInt(mMinInliers))
{
if(optimizationMaxError > 0.0f)
Expand All @@ -1806,6 +1809,7 @@ else if(fastMovement)
{
if(currentTime - mLastFastMovementNotificationStamp > 3)
{
if (mToast != null && mToast.getView().isShown()) mToast.cancel();
mToast.setText("Move slower... blurry images are not added to map (\"Settings->Mapping...->Maximum Motion Speed\" is enabled).");
mToast.show();
}
Expand Down

0 comments on commit a14f064

Please sign in to comment.