Skip to content

Commit

Permalink
add sai pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Serafadam committed Dec 22, 2023
1 parent 3c12edc commit 1b7e899
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions robot_py/robot_py/robot/perception/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,64 @@ def rtabmap_pipeline():
xout_right.setStreamName("right")
xout_right.input.setBlocking(False)
right.video.link(xout_right.input)
return pipeline

def sai_pipeline():

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)

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)


featureTracker = pipeline.create(dai.node.FeatureTracker)
featureTracker.setHardwareResources(2, 2)
featureTracker.setWaitForConfigInput(False)
xoutTrackedFeaturesRight = pipeline.create(dai.node.XLinkOut)
xoutTrackedFeaturesRight.setStreamName("trackedFeaturesRight")


stereo = pipeline.create(dai.node.StereoDepth)
left.video.link(stereo.left)
right.video.link(stereo.right)

xout_stereo = pipeline.create(dai.node.XLinkOut)
xout_stereo.setStreamName("stereo")
xout_stereo.input.setBlocking(False)
stereo.depth.link(xout_stereo.input)

xout_left = pipeline.create(dai.node.XLinkOut)
xout_left.setStreamName("left")
xout_left.input.setBlocking(False)
stereo.rectifiedLeft.link(xout_left.input)
xout_right = pipeline.create(dai.node.XLinkOut)
xout_right.setStreamName("right")
xout_right.input.setBlocking(False)
stereo.rectifiedRight.link(xout_right.input)
stereo.rectifiedRight.link(featureTracker.inputImage)
featureTracker.outputFeatures.link(xoutTrackedFeaturesRight.input)
return pipeline

0 comments on commit 1b7e899

Please sign in to comment.