ROS 2 control software for a four-wheel omniwheel robot running on a Raspberry Pi. The active package targets ROS 2 Jazzy and is located at ROS/colcon_workspace/src/rosbot. The ROS/rosbot.old__TMP!__migrating_to_ros2_!/ directory is a legacy ROS 1 archive; its nodes and launch files are not used by the ROS 2 build.
- ROS 2 Jazzy on Ubuntu. For Raspberry Pi installation, see the ROS 2 Raspberry Pi installation guide.
colconandrosdep.- On the robot: pigpio and its Python package for GPIO control.
- Optional devices: a Linux-compatible gamepad, a libcamera-supported Raspberry Pi camera with
camera_ros, and/or a Hokuyo URG-LX04-UG01 withurg_node.
Do these steps once for each computer or Raspberry Pi where you want to build or run the package.
git clone https://github.com/markusk/rosbot.git
cd rosbotIf the repository is already cloned, use its existing directory instead.
source /opt/ros/jazzy/setup.bash
cd ROS/colcon_workspace
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --packages-select rosbotrosdep install installs the package dependencies, including the ROS joystick, camera, and laser drivers. Optional devices still need to be physically connected and configured. Re-run dependency installation if package dependencies change; rebuild after changing source code.
Motor GPIO access is enabled only when the system hostname is exactly rosbot. Set the hostname once on the robot and reboot if it changed:
sudo hostnamectl set-hostname rosbot
hostnameInstall pigpio and its Python binding:
sudo apt-get update
sudo apt-get install pigpio python3-pigpioConfigure one pigpio service option, depending on where pigpiod is installed. If it is at /usr/local/bin/pigpiod, use the repository service:
sudo cp ~/rosbot/raspi/etc__systemd__system__rosbot-boot.service /etc/systemd/system/rosbot-boot.service
sudo systemctl daemon-reload
sudo systemctl enable --now rosbot-boot.serviceIf pigpio was installed from the Ubuntu package and its daemon is not at /usr/local/bin/pigpiod, use the package-provided service instead:
sudo systemctl enable --now pigpiodCheck the selected service with sudo systemctl status rosbot-boot.service or sudo systemctl status pigpiod, then verify pigpio responds with pigs t.
On any host whose name is not rosbot, the motor node does not access GPIO and simulates motor output. Do not set the robot hostname on a development computer.
- Joystick: Connect a supported gamepad to Linux. To diagnose the Linux device, install
joystickand runjstest --normal /dev/input/js0. The ROSjoydriver is installed throughrosdep. - Camera: Connect a camera supported by the Pi's libcamera version. The
camera_rosdriver is installed throughrosdep. - Hokuyo laser: Connect the URG-LX04-UG01 over USB. Confirm its serial device and supported baud rate on the robot; prefer a stable path under
/dev/serial/by-id/when available.
Camera and laser launches are restricted to the host whose name is exactly rosbot. Their physical operation has not been verified; the scanner's base-to-laser transform must also be measured before use for navigation.
Do these steps in each new terminal session. No dependency installation or rebuild is needed unless dependencies or source code have changed.
source /opt/ros/jazzy/setup.bash
cd ~/rosbot/ROS/colcon_workspace
source install/setup.bashIf the repository is in a different location, replace ~/rosbot with its path.
ros2 launch rosbot rosbot_launch.pyThis starts the motor controller, command arbitrator, and keyboard teleoperation. The keyboard node needs an interactive terminal. Press ESC in that terminal or Ctrl+C in the launch terminal to stop all launched nodes. On the robot, make the first movement tests with the wheels raised and at low speed; the software watchdog is not a physical emergency stop.
Add launch arguments to the same command when you want to use an optional device:
ros2 launch rosbot rosbot_launch.py joystick_enabled:=true joy_device_id:=0
ros2 launch rosbot rosbot_launch.py camera_enabled:=true
ros2 launch rosbot rosbot_launch.py laser_enabled:=trueThe laser defaults to /dev/ttyACM0, baud 115200, and frame laser. Override the serial settings if needed:
ros2 launch rosbot rosbot_launch.py laser_enabled:=true laser_device:=/dev/serial/by-id/your-hokuyo laser_baud:=115200 laser_frame_id:=laserCombine multiple options in one launch command, for example joystick_enabled:=true camera_enabled:=true. The joystick requires a supported Linux device. Camera and laser nodes only start on the robot hostname rosbot.
From the workspace directory, rebuild and source the updated package in each terminal that will use it:
cd ~/rosbot/ROS/colcon_workspace
colcon build --symlink-install --packages-select rosbot
source install/setup.bashIf package.xml dependencies changed, run rosdep install --from-paths src --ignore-src -r -y before building.
The package README documents node topics, L298N BCM pin assignments, joystick mappings, and hardware limitations: ROS/colcon_workspace/src/rosbot/README.md.