sdk-examples icon indicating copy to clipboard operation
sdk-examples copied to clipboard

Is it possible to load a saved map for replay?

Open genkv opened this issue 1 year ago • 1 comments

Hi, I run into this scenario when I have SLAM-ed and saved a map. Then, a couple other recordings are completed in the same environment of the map using recording only mode. In order to make every session's coordinate consistent, I want to load the same map for each replay of the recording.

Similar to the code here: https://github.com/SpectacularAI/sdk-examples/blob/8ef5ae723a4442a2946bf1ee117ae6a4612d2367/python/oak/mixed_reality.py#L178

I used this config for replay:

config = {
            "useSlam": True,
            "mapLoadPath": map_save_path,
            "fixedMap": True
        }

replay = spectacularAI.Replay(str(video_dir), configuration=config)
replay.setOutputCallback(onOutput)
replay.runReplay()

But the callback function onOutput was never called. If I choose not to use this config, the replay will generate poses for each recording. So I was just wondering if this is possible?

genkv avatar Aug 20 '24 21:08 genkv

Hey!

With Replay API, the best approach is to use relocalization parameter set, and I just updated the examples to use it also. Basically, with Replay API, just add

configInternal["mapLoadPath"] = args.mapLoadPath 
configInternal["extendParameterSets"] = ["relocalization"]

Note that the SLAM map relocalization mode is still somewhat experimental and might not be able to reliably relocalize in all environments. For your use case, I would consider using April Tags instead: https://github.com/SpectacularAI/sdk-examples/blob/main/python/oak/april_tag.py

kaatrasa avatar Sep 10 '24 07:09 kaatrasa