| Build Step | Status |
|---|---|
| Overall Build | |
| AMD64 Build | |
| ARM64 Build | |
| Multi-Arch Manifest |
Current setup is just the stripped demo-example from ros2 control for the diff-controler.
git clone git@github.com:RWU-R2M/r2m_diff_bot.git && cd r2m_diff_botgit submodule update --initdocker compose -f docker/build.yml buildThis project uses several docker-compose files for different purposes:
docker/build.yml: Used to build the Docker imagesdocker/docker-compose.yml: Launches the system with fake hardware interfaces for simulationdocker/docker-compose-hardware.yml: Launches the system with real hardware interfaces connected to physical motorsdocker/docker-compose-amd64.yml: Configuration specific for AMD64 architecturedocker/docker-compose-arm64.yml: Configuration specific for ARM64 architecture
This mode uses a fake hardware interface that simulates the robot's behavior without requiring physical hardware.
docker compose -f docker/docker-compose.yml upThis mode connects to the actual physical hardware (motors and sensors) of the diff-base.
-
Connect CAN interface: Connect your laptop to the diff-base via the CAN2USB adapter
-
Set up CAN interface: The CAN interface needs to be configured before running the robot
sudo ip link set can0 up type can bitrate 250000
If the above command fails, you may need to first create the CAN interface:
sudo ip link add dev can0 type can bitrate 250000 sudo ip link set can0 up
-
Power up the diff-base:
- Ensure the battery (bike cell) is properly connected
- Turn on the main power switch located on the side of the robot
- Verify the status LEDs on the ODrive controllers are lit
-
Launch the hardware container:
docker compose -f docker/docker-compose-hardware.yml up
To send a simple movement command to the robot:
ros2 topic pub --rate 30 /cmd_vel geometry_msgs/msg/TwistStamped "
twist:
linear:
x: 0.2
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.3"Alternatively, for a one-time command:
ros2 topic pub -1 /cmd_vel geometry_msgs/msg/TwistStamped "{header: {stamp: {sec: 0}, frame_id: 'base_link'}, twist: {linear: {x: 0.2, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.3}}}"- Used for simulation and testing without physical hardware
- Provides simulated feedback and accepts commands just like the real hardware
- Useful for development and testing of algorithms before deploying to the real robot
- No risk of damaging physical equipment during testing
- Connects to the actual motor controllers (ODrives) via CAN bus
- Reads real sensor data and sends commands to real motors
- Requires proper hardware setup and configuration
- Used for actual deployment and real-world testing
Symptom: No odometry data is published, or motors turn in unexpected ways.
Possible Cause: ODrive controllers have incorrect CAN IDs
Solution:
- Check if the ODrives are configured with CAN ID 0 (left motor) and 1 (right motor)
- You can verify the CAN IDs using the ODrive Tool or by checking the configuration parameters
Symptom: Both wheels turn in the same direction when sending rotation commands.
Solution:
-
Check the motor configuration in your hardware YAML file (typically in
bringup/config/): -
Rebuild and restart the container after modifications
Symptom: Robot doesn't move when sending velocity commands.
Possible Causes:
- Wrong topic: Ensure you're publishing to
/cmd_velwith the correct message type - Controller not running: Check if the controller is loaded with:
ros2 control list_controllers
- Hardware not ready: Verify ODrive status LEDs and CAN communication
Symptom: Communication errors or no response from hardware.
Solution:
- Check CAN interface status:
ip -details link show can0
- Monitor CAN traffic:
candump can0
- If needed, reset the interface:
sudo ip link set can0 down sudo ip link set can0 up type can bitrate 250000
https://github.com/ros-controls/ros2_control_demos
https://articulatedrobotics.xyz/tutorials/mobile-robot/applications/ros2_control-real/