This repo aims provides a generic ROS2 driver for the XIMEA MQ022CG-CM camera. The repo was adapted from wavelab's ROS1 version. And so credit is given to this version for much of the code and convention in this driver.
-
Tested on ROS2 foxy
-
Using eCAL RWM as an alternative to ROS2 DDS implementations showed significant perfomance improvements
Installed and tested on Ubuntu 20.04 LTS.
OPTIONAL: For full installation and setup, you could simply run the bash script: ximea_install.sh. Make sure you have the limits.txt file in the same directory. Also checkout the docker file for possible use with ROS2 Humble using the nvidia-isaac-ros docker workspace.
Download and extract the most recent software package:
$ cd ~; mkdir tmp; cd tmp
$ wget https://www.ximea.com/downloads/recent/XIMEA_Linux_SP.tgz
$ tar xzf XIMEA_Linux_SP.tgz
$ cd package
Install the package depending on you camera type
$ ./install -<type>
types:
-cam_usb30
-pcie
$ sudo gpasswd -a $USER plugdev
Set the USB FS memory allocation to infinite for sufficient buffering size for high bandwith USB3.0 streams:
$ echo 0 > /sys/module/usbcore/parameters/usbfs_memory_mb
# You can put this line to your bashrc file to apply to every new shell
* - rtprio 0
@realtime - rtprio 81
* - nice 0
@realtime - nice -16
then add the user to realtime
$ sudo groupadd realtime #if it doesn't exist yet
$ sudo gpasswd -a $USER realtime
You may need to reboot your system for some changes to take effect.
clone this repo to your ros2 workspace source directory:
$ cd ~/ros2_ws
$ git clone https://github.com/African-Robotics-Unit/ximea_ROS2_driver.git
$ cd ~/ros2_ws/ximea_ROS2_driver
$ colcon build --packages-select ximea_ros2_cam
Modify camera parameters as desired in the config and launch files, and run the node using the provided launch file or a custom one.
$ ros2 launch ximea_ros2_cam xiCam.launch.xml
# To view the stream
$ ros2 run rqt_image_view rqt_image_view
NOTE: Ximea API's demosaic color defect correction is not optimized for ARM processors, and so performance may degrade significantly. To avoid this you can instead capture raw 8-bits or 16-bits images (by setting the format parameter to RAW8 or RAW16 in the config file) and post-process later using the API's offline processing.