Skip to main content

Command Palette

Search for a command to run...

Stereo Vision For The RDK X5

Updated
3 min read
Stereo Vision For The RDK X5

GS130WI is an excellent uint that has both stereo vision capabilities and an accelerometer with gyroscope via its IMU. Fully compatible with the RDK X5 without needing additional tinkering or adapters.

There is also a variant of this, the GS130W stereo unit which comes without the IMU.

Hardware

Getting the connections right was the hardest part. The documentation is sparse and confusing.

The camera module has two MIPI connectors that go into the X5's two camera connectors. Make sure to get the connections right. Each MIPI connector is labeled both on the camera module and on the RDK X5 as CAM1 and CAM2.

In addition it also comes with a Molex PicoBlade connector with 3 pins and only one is required for the RDK X5. The middle one.

What is odd is the coloring of the cables provided. Typically black is for ground and from the diagram on the PCB, the bottom-most pin is ground and yet the middle wire is colored black.

The top and the bottom wires are not to be used with the RDK. The middle wire acts as the Shutter Trigger for the camera and synchronizes IMU which is required.

Here's what the PINS mean:

Pin 3

PWM

Pulse Width Modulation (not used)

Pin 2

EXT_SYNC

Shutter Trigger, IMU Time Sync, Active When Set to 'EXT' Connect to PIN 37 on the X5

Pin 1

GND

Ground (not used)

So why is GND not used? My best guess is the MIPI connectors already provide the Ground reference so this is not required.

The final connections should look like this:

Software

Now that it is all hooked up, let's see what the X5 sees.

Once you've made the three hardware connections, two mipi cables and dupont cable to the X5, the GPIO pin 37 needs to be repurposed to use with the Stereo Camera/IMU module.

  1. sudo srpi-config

  2. Select 3. Interface Options

  3. Select I6. IMU

  4. Select the Pin

  1. Finish and Save

  2. This will reboot the X5

Next, check if the IMU module is detected by the X5.

sunrise@ubuntu:~$ ls /sys/bus/iio/devices/  
iio:device0  iio:device1  iio:device2  iio:device3  trigger0

You should see iio:device1, iio:device2 and iio:device3.

Device Type Description
iio:device0 gyro IMU Gyroscope
iio:device1 accel IMU Accelerometer
iio:device3 fsync Frame sync timestamp trigger. Sync's IMU with Camera
cd /opt/tros/humble/share/hobot_stereonet/script/
bash run_cam.sh --image_width 1088 --image_height 1280 --rotation 0.0
source /opt/tros/humble/setup.bash
ros2 launch hobot_stereonet codec_web_visual.launch.py codec_sub_topic:=/image_combine_raw codec_in_format:=nv12

Now go to your web browser: http://:8000

You should see the stereo images.

Cleanup

When you Ctrl+C out of both the sessions, it won't cleanup the nginx server running on port 8000. You need to manually clean that up:

# CLEANUP (run from any terminal, as root):
# Step 1: SIGINT the ros2 launch (graceful — kills its real children)
pkill -INT -f "ros2 launch hobot_stereonet"
sleep 5
# Step 2: any orphan nginx
pkill -TERM nginx
# Step 3: SIGINT mipi_cam (graceful — releases ISP cleanly)
pkill -INT -f "lib/mipi_cam/mipi_cam"
sleep 3
# Step 4: LEAVE cam-service alone — never touch it between reboots