diff --git a/app/android/jni/CameraMobile.cpp b/app/android/jni/CameraMobile.cpp index 22d9818a19..316dd4801b 100644 --- a/app/android/jni/CameraMobile.cpp +++ b/app/android/jni/CameraMobile.cpp @@ -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 @@ -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; diff --git a/app/android/src/com/introlab/rtabmap/RTABMapActivity.java b/app/android/src/com/introlab/rtabmap/RTABMapActivity.java index 216caaf443..8184bfdeca 100644 --- a/app/android/src/com/introlab/rtabmap/RTABMapActivity.java +++ b/app/android/src/com/introlab/rtabmap/RTABMapActivity.java @@ -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) @@ -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(); }