Skip to content

Setting Up the `roboclaw_ros` Node with ROS Noetic in Docker

Introduction

In this guide, we’ll walk through setting up the roboclaw_ros node in ROS Noetic using Docker. This approach ensures a clean, consistent environment for development and deployment while leveraging Docker's flexibility. We'll cover everything from creating the Docker image to running the node with the correct configurations.


Prerequisites

Before proceeding, ensure you have:

  1. Docker Installed: Docker must be installed and operational on your system.
  2. Hardware Setup:
  3. A Roboclaw motor controller connected to /dev/ttyACM0.
  4. Encoders configured for your robot’s specific dimensions.
  5. Dependencies Installed:
  6. The roboclaw_driver library for ROS.
  7. Python libraries like pyserial for communication.

Setup Steps

1. Pull the Base Docker Image

Start by pulling the base Docker image for ROS Noetic:

sudo docker pull arm64v8/ros:noetic-ros-base

2. Run a Container and Install ROS Noetic Components

Launch a container from the base image:

sudo docker run -it --name ros_noetic_container --rm arm64v8/ros:noetic-ros-base

Inside the container, update and install required packages:

apt update
apt install -y ros-noetic-rosbridge-server ros-noetic-tf python3-serial python3-pip
pip3 install diagnostic-updater

3. Create and Mount a Workspace

To persist your workspace across sessions, create a workspace on your host machine and mount it in the container:

mkdir -p ~/ros_noetic_ws/src
sudo docker run -it --name ros_noetic_container --rm -v ~/ros_noetic_ws:/root/ros_noetic_ws arm64v8/ros:noetic-ros-base

Inside the container, initialize the workspace:

cd /root/ros_noetic_ws
catkin_make

4. Clone the roboclaw_ros Repository

Clone the repository into the workspace:

cd /root/ros_noetic_ws/src
git clone https://github.com/DoanNguyenTrong/roboclaw_ros.git

5. Build the Workspace

Return to the root of the workspace and build it:

cd /root/ros_noetic_ws
catkin_make
source devel/setup.bash

6. Save the Docker Image

To save your container for future use, commit it as a new image:

sudo docker commit ros_noetic_container ros_noetic_saved

Run this saved image with automatic restart enabled:

sudo docker run -it --name ros_noetic_container --restart always ros_noetic_saved

Running the roboclaw_ros Node

To run the roboclaw_ros node, use the following steps:

1. Start the Container

Start the container with the saved image:

sudo docker start -ai ros_noetic_container

2. Launch the Node

Inside the container, run the launch file:

roslaunch roboclaw_node roboclaw.launch

Testing the Node

To verify the node's functionality:

  1. Publish Commands to /cmd_vel:
rostopic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 0.5}, angular: {z: 0.1}}'
  1. Monitor Output:

Check odometry data on /odom:

rostopic echo /odom

Viewing Docker Folder Structure

To view the folder structure inside the container, use:

sudo docker exec -it ros_noetic_container bash
cd /root/ros_noetic_ws
tree

Conclusion

This guide provides a straightforward approach to setting up and running the roboclaw_ros node in a ROS Noetic Docker environment. Docker ensures consistency and portability, making it an ideal choice for robotics development. By following these steps, you can integrate Roboclaw into your robotic system efficiently.


Created 2025-01-23, Updated 2025-01-26
Authors: Harminder Singh Nijjar (4)

Comments