mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-13 23:10:20 +08:00
0.20.12: iOS/android sync
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user