Perception Algorithm Development Example
Overview
Section titled “Overview”This example demonstrates how to obtain camera video data from the DR02 via ROS2 topics and the RTSP protocol.
Camera Video Stream Acquisition
Section titled “Camera Video Stream Acquisition”| Camera Type | RTSP Address |
|---|---|
| Wide-Angle Camera | rtsp://10.21.31.103:8554/video1 |
Developers can pull RTSP video streams from the front and rear wide-angle cameras using the above addresses.
RTSP Stream Pull Example
Section titled “RTSP Stream Pull Example”import cv2
# Acquire camera feed via RTSPcap = cv2.VideoCapture("rtsp://10.21.31.103:8554/video1")
if not cap.isOpened(): print("Unable to open video stream") exit()
while True: ret, frame = cap.read() if not ret: print("Unable to read frame") break
# Add perception algorithm processing here # process_frame(frame)
cv2.imshow("Camera Feed", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break
cap.release()cv2.destroyAllWindows()Sensor Driver Topics
Section titled “Sensor Driver Topics”The DR02 publishes sensor data via ROS2. Developers can subscribe to the following topics to obtain data:
| Topic Name | Description | Message Type |
|---|---|---|
| /IMU_DATA_BODY | Body IMU data | sensor_msgs/msg/Imu |
| /IMU_DATA_LEG | Leg IMU data | sensor_msgs/msg/Imu |