Skip to content

Commit b3b2622

Browse files
authored
Support SLAM map serialization (#9)
Requires SDK version 0.17+
1 parent 6fac302 commit b3b2622

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

python/oak/mixed_reality.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@
1313

1414
FPS = 24 # set to 30 for smoother frame rate
1515

16+
def parse_args():
17+
import argparse
18+
p = argparse.ArgumentParser(__doc__)
19+
p.add_argument("--mapLoadPath", help="SLAM map path", default=None)
20+
return p.parse_args()
21+
1622
def make_pipelines():
1723
pipeline = depthai.Pipeline()
18-
vio_pipeline = spectacularAI.depthai.Pipeline(pipeline)
24+
config = spectacularAI.depthai.Configuration()
25+
args = parse_args()
26+
if args.mapLoadPath is not None:
27+
config.mapLoadPath = args.mapLoadPath
28+
config.useSlam = True
29+
vio_pipeline = spectacularAI.depthai.Pipeline(pipeline, config)
1930

2031
# NOTE: this simple method of reading RGB data from the device does not
2132
# scale to well to higher resolutions. Use YUV data with larger resolutions

python/oak/vio_record.py

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
p.add_argument("--gray", help="Record (rectified) gray video data", action="store_true")
4444
p.add_argument("--no_convert", help="Skip converting h265 video file", action="store_true")
4545
p.add_argument('--no_preview', help='Do not show a live preview', action="store_true")
46+
p.add_argument('--slam', help='Record SLAM map', action="store_true")
4647
p.add_argument("--resolution", help="Gray input resolution (gray)",
4748
default=config.inputResolution,
4849
choices=['400p', '800p'])
@@ -52,6 +53,9 @@
5253

5354
config.recordingFolder = args.output
5455
config.inputResolution = args.resolution
56+
if args.slam:
57+
config.useSlam = True
58+
config.mapSavePath = os.path.join(args.output, 'slam_map._')
5559

5660
# Enable recoding by setting recordingFolder option
5761
vio_pipeline = spectacularAI.depthai.Pipeline(pipeline, config)

0 commit comments

Comments
 (0)