ROSBAG Recording¶
This example showcases the use of SDK to save color, mono, depth and IMU data to a ROSBAG file. This can be useful for recording data for later use, or for testing purposes.
Note
Visualization in current example is done with blocking behavor. This means that the program will halt at oak.start()
until the window is closed.
This is done to keep the example simple. For more advanced usage, see Blocking behavior section.
Setup¶
Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai repository first and then run the script
git clone https://github.com/luxonis/depthai.git
cd depthai/
python3 install_requirements.py
For additional information, please follow our installation guide.
Pipeline¶
Source Code¶
Also available on GitHub.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from depthai_sdk import OakCamera, RecordType with OakCamera() as oak: color = oak.create_camera('color', encode='jpeg', fps=30) left = oak.create_camera('left', resolution='800p', encode='jpeg', fps=30) right = oak.create_camera('right', resolution='800p', encode='jpeg', fps=30) stereo = oak.create_stereo(left=left, right=right) stereo.config_stereo(align=color) imu = oak.create_imu() imu.config_imu(report_rate=400, batch_report_threshold=5) # DB3 / ROSBAG. ROSBAG doesn't require having ROS installed, while DB3 does. record_components = [left.out.encoded, color.out.encoded, right.out.encoded, stereo.out.depth, imu] oak.record(record_components, 'record', record_type=RecordType.ROSBAG) # Visualize only color stream oak.visualize(color.out.encoded) oak.start(blocking=True) |