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
- Ubuntu 18.04
- ROS2 Eloquent for Ubuntu 18.04
- Arena SDK for Linux x64 v0.1.43 or higher
- Dependencies: g++, make, python3, pip
- Driver file: arena_camera_ros2 found at https://github.com/lucidvisionlabs/arena_camera_ros2/releases/
Arena SDK Setup
Download and install Arena SDK. Arena SDK for Linux is available on the Downloads page at https://dev.thinklucid.com/downloads-hub/. The Arena SDK dependencies are listed in the README file included with the SDK.
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
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
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