0.20.12: iOS/android sync

This commit is contained in:
matlabbe
2021-06-21 10:07:30 -04:00
parent 9fccb8703a
commit f475f2d21c
5 changed files with 18 additions and 9 deletions
+5
View File
@@ -221,6 +221,11 @@ class RTABMap {
postCameraPoseEventNative(native_rtabmap, pose[3,0], pose[3,1], pose[3,2], quat.x, quat.y, quat.z, quat.w)
}
func notifyLost() {
// a null transform will make rtabmap creating a new session
postCameraPoseEventNative(native_rtabmap, 0,0,0,0,0,0,0)
}
func postOdometryEvent(frame: ARFrame, orientation: UIInterfaceOrientation, viewport: CGSize) {
let pose = frame.camera.transform // ViewMatrix
let rotation = GLKMatrix3(
+7 -3
View File
@@ -953,7 +953,7 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
case .normal:
accept = true
case .notAvailable:
status = ""
status = "Tracking not available"
case .limited(.excessiveMotion):
accept = true
status = "Please Slow Your Movement"
@@ -965,12 +965,12 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
case .limited(.relocalizing):
status = "Relocalizing"
default:
status = ""
status = "Unknown tracking state"
}
mLastLightEstimate = frame.lightEstimate?.ambientIntensity
if mLastLightEstimate != nil && mLastLightEstimate! < 100 && accept {
if !status.isEmpty && mLastLightEstimate != nil && mLastLightEstimate! < 100 && accept {
status = "Camera Is Occluded Or Lighting Is Too Dark"
}
@@ -981,6 +981,10 @@ class ViewController: GLKViewController, ARSessionDelegate, RTABMapObserver, UIP
rtabmap?.postOdometryEvent(frame: frame, orientation: rotation, viewport: self.view.frame.size)
}
}
else
{
rtabmap?.notifyLost();
}
if !status.isEmpty {
DispatchQueue.main.async {