Basalt VIO
The example creates a pipeline to capture 640x400 stereo camera frames at 60 FPS and IMU data at 200 Hz, processes them with BasaltVIO for visual odometry, and streams the resulting transformations and images to a RerunNode for real-time visualization.VSLAM host nodes are currently in "early access preview". Please use the depthai-core develop branch to have access to the latest features and fixes.
Pipeline
Source code
Python
C++
Python
PythonGitHub
1import signal
2import time
3import depthai as dai
4from rerun_node import RerunNode
5# Create pipeline
6
7with dai.Pipeline() as p:
8 fps = 60
9 width = 640
10 height = 400
11 # Define sources and outputs
12 left = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B, sensorFps=fps)
13 right = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C, sensorFps=fps)
14 imu = p.create(dai.node.IMU)
15 odom = p.create(dai.node.BasaltVIO)
16
17 rerunViewer = RerunNode()
18 imu.enableIMUSensor([dai.IMUSensor.ACCELEROMETER_RAW, dai.IMUSensor.GYROSCOPE_RAW], 200)
19 imu.setBatchReportThreshold(1)
20 imu.setMaxBatchReports(10)
21
22 # Linking
23 left.requestOutput((width, height)).link(odom.left)
24 right.requestOutput((width, height)).link(odom.right)
25 imu.out.link(odom.imu)
26 odom.passthrough.link(rerunViewer.inputImg)
27 odom.transform.link(rerunViewer.inputTrans)
28 p.start()
29 while p.isRunning():
30 time.sleep(0.01)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.