Depth Mapping with ROS and Jetson Nano
Please refer to this page to follow the driver installation.
Don’t forget to test the camera to make sure your hardware connection is right.
Follow this tutorial to install ROS: Installation
3.Create ROS Workspace
Follow this tutorial to create a ROS workspace: Create a ROS Workspace
wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py sudo pip install v4l2 sudo apt install ros-melodic-camera-info-manager-py
5.Install arducam_stereo_camera package
Copy the arducam_stereo_camera folder to the src folder of the ROS workspace:
cp -r arducam_stereo_camera ~/catkin_ws/src cd ~/catkin_ws/ && catkin_make
6.Run Stereo Pipeline
6.1 Run Camera
You can modify the launch parameters before running the camera.
You can use the
v4l2-ctl --list-formats-ext command to view the existing resolution and pixelformat
Open two terminals, one running roscore and the other running camera.
roscore #run roscore
roslaunch arducam_stereo_camera arducam_stereo_camera.launch #run camera
6.2 Stereo Calibration
Refer to this document for stereo calibration: How to Calibrate a Stereo Camera
The checkerboard size used here is 11×8, and the square size is 2cm
rosrun camera_calibration cameracalibrator.py --approximate 0.1 --size 11x8 --square 0.02 right:=/arducam/right/image_raw left:=/arducam/left/image_raw right_camera:=/arducam/right left_camera:=/arducam/left
After the calibration is complete, click commit to send the parameters to the camera node.
6.3 Run Stereo Matching
Refer to this document for stereo matching: stereo_image_proc
Open two terminals, one runs stereo_image_proc and the other runs image_view
ROS_NAMESPACE=arducam rosrun stereo_image_proc stereo_image_proc rosrun image_view stereo_view stereo:=/arducam image:=image_rect
You can also run rqt_reconfigure to dynamically configure the parameters of stereo matching
rosrun rqt_reconfigure rqt_reconfigure
For more details, please refer to Choosing Good Stereo Parameters