This repository contains the code and configuration necessary for the Raspberry Pi to act as the hardware control interface for the Robot5A robotic arm. The Raspberry Pi handles the ROS2 Control framework and integrates with the SlushEngine to drive the stepper motors of the arm. This setup is designed to work with ROS2 Humble on Ubuntu 22.04.
- Project Overview
- Features
- Hardware Requirements
- Software Prerequisites
- Setup Guide
- Directory Structure
- Usage
- Contributing
- License
This repository is part of the Robot5A project and focuses on the Raspberry Pi hardware interface. The Raspberry Pi communicates with the SlushEngine, which controls the stepper motors, and runs the ROS2 Control stack to receive and execute commands from the central controller on a remote Ubuntu machine.
- SlushEngine: Hardware driver board for stepper motors.
- ROS2 Control: Framework to manage hardware abstraction and control commands.
- Visual Servoing: The Raspberry Pi relies on visual joint state feedback from a remote system.
- Integration with SlushEngine for precise stepper motor control.
- ROS2 hardware interface to bridge ROS2 controllers and the SlushEngine.
- Modular configuration with YAML files for controllers and URDF descriptions.
- Support for networked ROS2 communication between the Raspberry Pi and a central controller.
- Raspberry Pi 4B with Ubuntu 22.04 (64-bit).
- SlushEngine Model D for stepper motor control.
- Stepper Motors (compatible with the SlushEngine).
- Ethernet or Wi-Fi connectivity for ROS2 communication.
Before setting up this project, ensure the following are installed on your Raspberry Pi:
-
ROS2 Humble
Follow the ROS2 Humble installation guide for Ubuntu 22.04. -
Python 3
Install Python and its dependencies:
sudo apt update
sudo apt install -y python3 python3-pip- Git Install Git for version control:
sudo apt install -y gitStart by cloning this repository onto your Raspberry Pi:
cd ~
git clone https://github.com/ABMI-software/Robot5A-RaspberryPi.git
cd Robot5A-RaspberryPi- Install ROS2 Dependencies Run the following to install ROS2 dependencies:
sudo apt install -y python3-colcon-common-extensions ros-humble-ros2-control ros-humble-ros2-controllers- Install SlushEngine Dependencies Follow these steps to set up the SlushEngine:
sudo apt install -y python3-pip i2c-tools
pip3 install spidev
git clone https://github.com/Roboteurs/slushengine.git
cd slushengine
python3 setup.py install- Enable I2C and SPI Interfaces Enable I2C and SPI on the Raspberry Pi:
sudo raspi-configNavigate to Interface Options and enable I2C and SPI.
- Build the ROS2 Workspace Build the workspace after cloning the repository:
cd ~/Robot5A-RaspberryPi
colcon build --packages-select R5A_hardware
source install/setup.bash- Verify ROS2 Installation Test that ROS2 is working by running:
ros2 topic list- Connect the SlushEngine to the Raspberry Pi via GPIO.
- Test the Connection Run the following test script:
python3 src/R5A_hardware/scripts/slush_test.pyThis script will initialize the motors and execute basic movement commands.
-
Assign Static IPs Ensure the Raspberry Pi and your Ubuntu computer are on the same network. Assign static IPs if necessary.
-
Enable ROS2 Multicast Configure ROS2 to use multicast for discovery:
export ROS_DOMAIN_ID=1- Test ROS2 Talker-Listener On the Raspberry Pi, run:
ros2 run demo_nodes_py talkerOn your Ubuntu machine, run:
ros2 run demo_nodes_py listenerRobot5A-RaspberryPi/
├── config/
│ ├── controllers.yaml # Controller configuration
│ ├── robot_description.urdf # Robot description
│ └── ros2_control_config.yaml # Hardware interface configuration
├── launch/
│ ├── controller_manager.launch.py
│ ├── hardware_interface.launch.py
│ └── robot_state_publisher.launch.py
├── R5A_hardware/
│ │ ├── __init__.py
├── src/
│ ├── slush_engine_hardware.py
├── scripts/
│ └── slush_test.py # Test script for SlushEngine
├── README.md # This README file
├── setup.py # Package setup file
└── package.xml # ROS2 package metadata- Start Hardware Interface:
ros2 launch R5A_hardware hardware_interface.launch.py- Start Controller Manager:
ros2 launch R5A_hardware controller_manager.launch.py- Publish Robot State:
ros2 launch R5A_hardware robot_state_publisher.launch.pyRun the SlushEngine test script to verify motor control:
python3 src/R5A_hardware/scripts/slush_test.pyContributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch.
- Submit a pull request.
This project is licensed under the MIT License.