Using ROS2 for Linux

Using ROS2 for Linux

Robot Operating System (ROS) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. This document shows how to install arena_camera, LUCID’s ROS2 driver.

System Requirements

Arena SDK Setup

Download and install Arena SDK. Arena SDK for Linux is available on the Downloads page at https://thinklucid.com/downloads-hub/. The Arena SDK dependencies are listed in the README file included with the SDK.

Note: These instructions will assume Arena SDK is installed at ~/ArenaSDK_Linux_x64:

$ tar -xvf ArenaSDK_v0.1.59_Linux_x64.tar.gz -C ~

Please remember to go over the Getting Started steps discussed in the Arena SDK documentation and run the Arena_SDK.conf file in the Arena_SDK directory:

$ cd ~/ArenaSDK_Linux_x64/
$ sudo sh Arena_SDK.conf

Set up your ARENA_ROOT environment variable. This environment variable should be the path where you have installed Arena SDK.

$ echo "export ARENA_ROOT=~/ArenaSDK_Linux_x64" >> ~/.bashrc$ source ~/.bashrc

You can confirm the variable is set with the typing echo $ARENA_ROOT in the terminal.

arena_root_ros

Initial ROS2 Setup

After installing Arena SDK, review our Getting Started steps discussed in the Arena SDK documentation and run the Arena_SDK.conf file in the Arena_SDK directory: Installing ROS2 involves extracting the arena_camera ROS2 tarball and running our initial setup script:

$ tar -xvf arena_camera_ros2-1.1.tar.gz -C ~
$ cd ~/arena_camera_ros2-1.1
$ `cat arena_camera_ros2\ros2_arena_setup.sh` to view the script

Uncomment `echo “source /opt/ros/eloquent/setup.bash” >> ~/.bashrc` if using a regular terminal:

install ROS2 Eloquent distro:

$ cd arena_camera_ros2-1.1 ; sudo sh ros2_arena_setup.sh

Building and Running the arena_camera ROS Driver

Installing dependency colcon:

$ sudo apt update
$ sudo apt install python3-colcon-common-extensions

$ echo "source /opt/ros/eloquent/setup.bash" >> ~/.bashrc
$ echo "source /opt/ros/eloquent/setup.zsh" >> ~/.zshrc
$ source ~/.bashrc
$ sudo apt-get install python-rosdep
$ sudo rosdep init
$ rosdep update

*If rosdep initialization fails:

$ sudo apt install python3-catkin-lint python3-pip
$ pip3 install osrf-pycommon
$ sudo rosdep init
$ sudo rosdep update

Copy the included image_encoding.h to your ROS include folder

$ sudo cp /opt/ros/eloquent/include/sensor_msgs/image_encodings.h /opt/ros/eloquent/include/sensor_msgs/image_encodings.h.bak$ sudo cp inc/image_encodings.h /opt/ros/eloquent/include/sensor_msgs/image_encodings.h

Note: A custom image_encoding.h is included to enable streaming support for LUCID’s Helios camera.

Build the ROS2 Workspace:

$ cd ~arena_camera_ros2-1.1/ros2_ws
$ rosdep install --from-paths src --ignore-src -r -y
$ colcon build --symlink-install

*If a Cmake version error is shown:

$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget
$ wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
$ sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
$ sudo apt-get update
$ sudo apt-get install cmake
$ colcon build --symlink-install

Install the build (below would be running from the ros2_ws folder):

$ . install/setup.bash 

After installing the build, you will find two ROS2 if you run the command ros2 pkg executables |
grep arena in the terminal. The two executables would be start and trigger_image.

To run arena_camera_node:

$ ros2 run arena_camera_node start

The above will start arena_camera_node and by default outputs images to the topic /arena_camera_node/images.

To start a camera in trigger mode and trigger and image:

$ ros2 run arena_camera_node start --ros-args -p exposure_time:=1000.0 -p
trigger_mode:=true
ros2 run arena_camera_node trigger_image

Note: If you open a new Terminal tab, you may need to run:

$source ~/arena_camera_ros2-1.1/ros2_ws

You will also find the command to look at the captured images using ros2 run image_tools
showimage -t /arena_camera_node/images. By default we are publishing the images
to /arena_camera_node/images

The readme file contains a list of supported parameters.