DEV Community

DEBIX Industrial Computers
DEBIX Industrial Computers

Posted on

DEBIX Camera support for ROS2

OS: Ubuntu22.04
ROS2 version: Humble

Install ROS2
Run the command:
sudo apt update && sudo apt install locales

Set the language environment, and run the command:

sudo locale-gen en_US en_US.UTF-8

sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

export LANG=en_US.UTF-8
Enter fullscreen mode Exit fullscreen mode

Check the language environment, run Locale to confirm the language is UTF-8.

Authorize the GPG key with apt, run the command:
sudo apt update && sudo apt install curl gnupg2 lsb-release

Run the command:

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
Enter fullscreen mode Exit fullscreen mode

If the command fails: manually download the file from https://raw.githubusercontent.com/ros/rosdistro/master/ros.key, rename it to ros-archive-keyring.gpg, and save it to the /usr/share/keyrings/ directory.

Then add the library to the source code list:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
Enter fullscreen mode Exit fullscreen mode

Update apt repository cache, run the command:sudo apt update

Install the full version of ROS2, run the command:
sudo apt install ros-humble-desktop -y

Set the environment variables, run the command:

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Test ROS2
Open two terminals on DEBIX desktop.

Terminal 1 runs the talker node, run the command:

ros2 run demo_nodes_cpp talker

Terminal 2 runs the listener node, run the command:

ros2 run demo_nodes_py listener

The two terminals show that the talker is posting a message and the listener receives the message posted by the talker.

Support DEBIX Camera Module
Install the V4L2 software package, run the command:

sudo apt-get install ros-humble-v4l2-camera


Use of the V4L2 software package
Note:
Take IMX219 camera for example, the device tree is imx8mp-debix-core-ar1335.dtb, and the device node is /dev/video2

  • Run the camera node
    ros2 run v4l2_camera v4l2_camera_node --ros-args -p video_device:=/dev/video2 -p output_encoding:=yuv422_yuy2

  • View topic
    ros2 topic list

  • Install dependencies
    sudo apt-get install qtwayland5

  • open a terminal on your desktop and run the following command to subscribe and display the image data on the /image_raw topic
    ros2 run rqt_image_view rqt_image_view
    Select /Image_raw to view the image data on the /image_raw topic.

Top comments (0)