This repository contains a ROS2 python node wrapping the hexapod controller.
For a complete overview of the project refer to the main Hexapod repository.
Prerequisite: having ROS2 installed. I am running Ubuntu Server 24.04 on the RPI. The recommended stable distribution is Jazzy Jalisco which was specifically designed to target Ubuntu 24.04 as its primary platform.
Note:️ on a fresh Ubuntu install, following the official ROS2 guide, I had problems installing
ros-dev-toolsdue to a library version mismatch. I solved them with:sudo apt install libbz2-1.0=1.0.8-5.1 -y --allow-downgrades sudo apt install bzip2 -y sudo apt update && sudo apt install ros-dev-tools
sudo apt install ros-<your-distro>-tf-transformationsClone the repo. For simplicity, I will assume the ROS workspace is in the home folder.
A ROS best practice is to put any packages in the workspace into the src directory.
cd ~/ros_ws/src # use your actual ROS workspace
git clone https://github.com/ggldnl/Hexapod-ROS-Python.gitBuilding this node will require the python controller to be installed as a python package.
When colcon build installs the node it only knows about packaged code installed for system python:
pip install --break-system-packages git+https://github.com/ggldnl/Hexapod-Controller.gitcd ~/ros_ws
colcon build --packages-select hexapod_controller
source install/setup.bashRun the node:
ros2 run hexapod_controller hexapod_controllerIn a second terminal, listen to the topic:
source ~/ros_ws/install/setup.bash
ros2 topic echo /hexapod/stateYou should see the status of the robot (e.g. IDLE) printed every second on the terminal.
Run the node:
ros2 run hexapod_controller hexapod_controllerROS2 parameters can be overridden at launch time without touching the code:
ros2 run hexapod_controller hexapod_controller --ros-args -p port:=/dev/ttyAMA0 -p config_path:=/path/to/node/Hexapod-Controller/config/config.ymlFeel free to contribute by opening issues or submitting pull requests. For further information, check out the main Hexapod repository. Give a ⭐️ to this project if you liked the content.