This ROS 2 package provides helper methods and launch scripts to access the Kinova Vision module depth and color streams.
The following instructions are for ROS 2, tested on Humble on Ubuntu 22.02.
- gstreamer1.0-tools
- libgstreamer1.0-libav
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
- libgstreamer-plugins-good1.0-dev
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-base
sudo apt install gstreamer1.0-tools gstreamer1.0-libav libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-base
To build from source, clone the latest version from this repository into your catkin workspace and compile the package.
- Create a workspace
mkdir -p ~/colcon_ws/src
cd ~/colcon_ws/src/
- Clone this git repo into
~/colcon_ws/src
git clone https://github.com/Kinovarobotics/ros2_kortex_vision.git
cd ~/colcon_ws/
rosdep install --from-paths . --ignore-src -r -y
colcon build
source ~/colcon_ws/install/setup.bash
ros2 launch kinova_vision kinova_vision.launch.py
The launch file provides arguments for launching depth, color, or registered depth images, as well as overriding other parameters. For example, to only launch the color node,
source ~/colcon_ws/install/setup.bash
ros2 launch kinova_vision kinova_vision.launch.py launch_depth:=false
Additional information is available below.
Please note that establishing a connection between the computer and the camera may require several attempts, so please be patient. Sometimes you may need to restart both the robot and the connected computer to successfully establish the connection.
Start rviz using the following command:
rviz2 -d src/ros2_kortex_vision/launch/camera_streams.rviz
This allows the visualization of both the RGB and the depth streams as well as the RGB point cloud.
It's possible to override the default argument values when launching the kinova_vision node.
Arguments are set using the following syntax: <argument>:=<value>
.
For instance, the default value of the device
argument can be overridden to specify another IP address.
ros2 launch kinova_vision kinova_vision.launch.py device:=10.20.0.100
These arguments specify the custom camera information file to use instead of the default camera information file.
The file is specified via a specific URL syntax, using either of these two formats:
package://<package_name>/relative/path/to/file
file:///absolute/path/to/file
For example:
ros2 launch kinova_vision kinova_vision.launch.py color_camera_info_url:=file:///home/user/custom_color_calib_1280x720.ini depth_camera_info_url:=file:///home/user/custom_depth_calib_480x270.ini
A custom camera information file is typically created from a default information file (refer to launch/calibration/default_*.ini). Then, one simply needs to adjust the proper matrices.
The following matrices need to be adjusted with the proper values for FX
, FY
, PPX
, PPY
:
camera matrix
FX 0.00000 PPX
0.00000 FY PPY
0.00000 0.00000 1.00000
projection
FX 0.00000 PPX 0.00000
0.00000 FY PPY 0.00000
0.00000 0.00000 1.00000 0.00000
The values for FX
, FY
, PPX
, PPY
can be obtained via the Vision module API. They represent the focal length and the principal point offset in both the x and y coordinates.
This node publishes the raw stream and the meta information of the color camera.
None
-
/camera/color/camera_info
(sensor_msgs/CameraInfo)Color camera calibration and meta information.
-
/camera/color/image_raw
(sensor_msgs/Image)Color camera raw image (RGB8 encoding).
This node publishes the raw stream and the meta information of the depth camera.
None
-
/camera/depth/camera_info
(sensor_msgs/CameraInfo)Depth camera calibration and meta information
-
/camera/depth/image_raw
(sensor_msgs/Image)Depth camera raw image (millimeters - 16UC1 encoding).
This node publishes the static coordinate transformation between the color camera frame (camera_color_frame) and the camera link frame (camera_link).
None
-
/tf_static
(tf2_msgs/TFMessage)Color camera frame static transformation
This node publishes the static coordinate transformation between the depth camera frame (camera_depth_frame) and the camera link frame (camera_link).
None
-
/tf_static
(tf2_msgs/TFMessage)Depth camera frame static transformation
This node uses the image_proc package to create a nodelet graph, transforming raw data from the device driver into point clouds, rectified images, and other products suitable for processing and visualization.
First, make sure to install the image_proc
ROS2 package on your system using the following command:
sudo apt install ros-$ROS_DISTRO-depth-image-proc
Then, start the launch file with the depth_registration
argument set to true
ros2 launch kinova_vision kinova_vision.launch.py depth_registration:=true
-
/camera/color/camera_info
(sensor_msgs/CameraInfo)Color camera calibration and meta information
-
/camera/color/image_raw
(sensor_msgs/Image)Color camera raw image
-
/camera/depth/camera_info
(sensor_msgs/CameraInfo)Depth camera calibration and meta information
-
/camera/depth/image_raw
(sensor_msgs/Image)Depth camera raw image
-
/camera/depth_registered/camera_info
(sensor_msgs/CameraInfo)Color camera calibration and meta information
-
/camera/depth_registered/image_rect
(sensor_msgs/Image)Depth rectified image (millimeters - 16UC1 encoding)
-
/camera/depth/color/points
(sensor_msgs/PointCloud2)Depth camera point cloud data with color information (RGBD)