Hey,
We are slowly moving to hosting our docker images on our own github packages - this is latest one.
depthai_examples scripts are not tested and we dont expect them to work with rae. If you want to run a simple detection network - they already work in apps we have published through RH.
This node should be able to run detections, tho I will have to fix it up to bring it up to date.
Alternatively we are developing python bindings that will make development much easier. Here is one script that should run detections on front stereo, just copy paste this code and run it on image I mentioned above:
import depthai as dai
import time
import depthai_ros_py_bindings as dai_ros
class Manager:
def __init__(self):
pipeline = dai.Pipeline()
imu = pipeline.create(dai.node.IMU)
imu.enableIMUSensor(dai.IMUSensor.ACCELEROMETER_RAW, 400)
imu.enableIMUSensor(dai.IMUSensor.GYROSCOPE_RAW, 400)
imu.enableIMUSensor(dai.IMUSensor.ROTATION_VECTOR, 400)
imu.setBatchReportThreshold(1)
imu.setMaxBatchReports(10)
xout_imu = pipeline.create(dai.node.XLinkOut)
xout_imu.setStreamName("imu")
imu.out.link(xout_imu.input)
left = pipeline.create(dai.node.ColorCamera)
left.setBoardSocket(dai.CameraBoardSocket.CAM_B)
left.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
left.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
left.setFps(30)
left.setVideoSize(640, 400)
left.setPreviewSize(416, 416)
left.setInterleaved(False)
encoder_left = pipeline.create(dai.node.VideoEncoder)
encoder_left.setDefaultProfilePreset(30, dai.VideoEncoderProperties.Profile.MJPEG)
encoder_left.setQuality(50)
left.video.link(encoder_left.input)
xout_left = pipeline.create(dai.node.XLinkOut)
xout_left.setStreamName("left")
xout_left.input.setBlocking(False)
right = pipeline.create(dai.node.ColorCamera)
right.setBoardSocket(dai.CameraBoardSocket.CAM_C)
right.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
left.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
right.setFps(30)
right.setVideoSize(640, 400)
right.setInterleaved(False)
encoder_right = pipeline.create(dai.node.VideoEncoder)
encoder_right.setDefaultProfilePreset(30, dai.VideoEncoderProperties.Profile.MJPEG)
encoder_right.setQuality(50)
right.video.link(encoder_right.input)
xout_right = pipeline.create(dai.node.XLinkOut)
xout_right.setStreamName("right")
xout_right.input.setBlocking(False)
stereo = pipeline.create(dai.node.StereoDepth)
detectionNetwork = pipeline.create(dai.node.YoloSpatialDetectionNetwork)
detectionNetwork.setConfidenceThreshold(0.6)
detectionNetwork.setNumClasses(80)
detectionNetwork.setCoordinateSize(4)
detectionNetwork.setIouThreshold(0.5)
detectionNetwork.setBlobPath("/ws/src/rae-ros/yolov6n_416x416_openvino2022.1_vpux.blob")
detectionNetwork.setNumInferenceThreads(8)
detectionNetwork.input.setBlocking(False)
detectionNetwork.input.setQueueSize(1)
left.preview.link(detectionNetwork.input)
stereo.depth.link(detectionNetwork.inputDepth)
xout_det = pipeline.create(dai.node.XLinkOut)
xout_det.setStreamName("detections")
detectionNetwork.out.link(xout_det.input)
left.video.link(stereo.left)
encoder_left.bitstream.link(xout_left.input)
right.video.link(stereo.right)
encoder_right.bitstream.link(xout_right.input)
xout_stereo = pipeline.create(dai.node.XLinkOut)
xout_stereo.setStreamName("stereo")
xout_stereo.input.setBlocking(False)
stereo.depth.link(xout_stereo.input)
self.device = dai.Device(pipeline)
self.context_manager = dai_ros.ROSContextManager()
self.context_manager.init([""], "single_threaded")
opts=dai_ros.ROSNodeOptions()
self.node = dai_ros.ROSNode("dai", opts)
calHandler = self.device.readCalibration()
self.streamer_imu = dai_ros.ImuStreamer(self.node, "imu", "imu_frame", dai_ros.ImuSyncMethod.COPY, 0.0, 0.0, 0.0, 0.0, True, False, False)
self.streamer_left = dai_ros.ImgStreamer(self.node, calHandler, dai.CameraBoardSocket.CAM_C, "left", "left_frame", False, False)
self.streamer_left.convertFromBitStream(dai.RawImgFrame.Type.BGR888i)
self.streamer_right = dai_ros.ImgStreamer(self.node, calHandler, dai.CameraBoardSocket.CAM_B, "right", "right_frame", False, False)
self.streamer_right.convertFromBitStream(dai.RawImgFrame.Type.BGR888i)
self.streamer_stereo = dai_ros.ImgStreamer(self.node, calHandler, dai.CameraBoardSocket.CAM_B, "stereo", "stereo_frame", False, False)
self.streamer_detections = dai_ros.SpatialDetectionStreamer(self.node, "detections", "detections_frame", 416, 416, False, False)
self.device.getOutputQueue("detections", 8, False).addCallback(self.det_handle)
self.device.getOutputQueue("imu", 8, False).addCallback(self.imu_handle)
self.device.getOutputQueue("stereo", 8, False).addCallback(self.stream_handle)
self.device.getOutputQueue("left", 8, False).addCallback(self.stream_handle)
self.device.getOutputQueue("right", 8, False).addCallback(self.stream_handle)
self.context_manager.add_node(self.node)
self.context_manager.spin()
self.node.log("Ready")
def det_handle(self, name:str, msg: dai.SpatialImgDetections):
self.streamer_detections.publish(name, msg)
def imu_handle(self, name:str, msg: dai.IMUData):
self.streamer_imu.publish(name, msg)
def stream_handle(self, name: str, msg: dai.ImgFrame):
if name == "stereo":
self.streamer_stereo.publish(name, msg)
elif name == "left":
self.streamer_left.publish(name, msg)
elif name == "right":
self.streamer_right.publish(name, msg)
if __name__ == "__main__":
manager = Manager()
while dai_ros.ros_ok():
time.sleep(0.001)```