In this tutorial we will show you how to connect and use Intel RealSense camera with your Leo Rover.
In this tutorial we will show you how to connect and use Intel RealSense camera with your Leo Rover.
Intel RealSense cameras give a wide field of view, and depth sensors, which are usefull for rover operations.
In this tutorial we will present the process of connecting a RealSense camera to your Leo Rover and integrating it with the system on Intel RealSense D435i example.
RealSense cameras provide two mounting mechanisms:
You can use those mechanisms, or print a special plate, and attach camera to it, and then mount the plate to the Rover.
For connecting the camera to your Rover you can use USB-C cable, as RealSense has USB‑C* 3.1 Gen 1* connector. You need to remove special plate on the back side of the camera, which covers the USB port, and you are ready to connect the camera through the usb port on the Rover.
As ROS realsense2_camera package is available as a debian package, we will install it using apt. To do so, connect to the rover via ssh, and type
We want also the description package, which includes 3D models of the device (those are required for some nodes). To install them type in the terminal:
As we want to have the camera model visible with the rover model, we need to change robot.urdf.xacro file in /etc/ros/urdf directory. On this site you can see what RealSense urdf camera models are available in the realsense2_description package. Each of the urdf files there has xacro macro with a lot of properties. You have to include such macro in the robot.urdf.xacro file on the Rover, and change name property to avoid tf frame conflicts. To do so, you need to include such lines
You can specify name property to anything you want. We just need to change it, so we don't have conflicts on camera_link tf frame. Origin property is for specifying the position of the camera regarding the link specified in parent property. So if the parent property is set to "base_link", the position in origin property is regarding the origin of the Rover.
In the end, your robot.urdf.xacro file should look like this
To get the image from camera, you need to launch the camera nodes. You can simply do it by typing in terminal those commands
You need to specify the camera argument because of the tf frame conflicts. You have to put the same value as in the urdf file.
It's much more comfortable to run this node automatically, as you may sometimes forget to. To launch it with the system we need to change robot.launch file in /etc/ros/ directory. You have to include those lines in the file, somewhere between the <launch> tag
Now, the realsense camera node will be launched with every system startup. You can also force this start right now with
The topics from camera node should be now visible. You can check them with rostopic tool - topics from your node will have prefix specified by you in the camera ros argument.
If you have ROS installed on your computer, you can get the camera image with rqt, and see the robot model with camera attached using rviz.
Before starting any of the programs, make sure you completed the Connecting other computer to ROS network section of ROS Development tutorial:
Now you can start rqt, and from plugins -> visualization chose image view and then chose your topic.
You can also start rviz, and add robot model in the display view. Chose also base_link as fixed frame, and you should see the rover model with camera attached.
You can also display tf tree in rqt, to see if everything is configured correctly (plugins -> visualization -> TF Tree)