Skip to content

RWU-R2M/r2m_diff_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Diff base

Build Status

Build Step Status
Overall Build Multi-Architecture Docker Build
AMD64 Build AMD64 Build Status
ARM64 Build ARM64 Build Status
Multi-Arch Manifest Multi-Arch Manifest

Current setup is just the stripped demo-example from ros2 control for the diff-controler.

Setup Instructions

git clone git@github.com:RWU-R2M/r2m_diff_bot.git && cd r2m_diff_bot
git submodule update --init
docker compose -f docker/build.yml build

Docker Compose Files

This project uses several docker-compose files for different purposes:

  • docker/build.yml: Used to build the Docker images
  • docker/docker-compose.yml: Launches the system with fake hardware interfaces for simulation
  • docker/docker-compose-hardware.yml: Launches the system with real hardware interfaces connected to physical motors
  • docker/docker-compose-amd64.yml: Configuration specific for AMD64 architecture
  • docker/docker-compose-arm64.yml: Configuration specific for ARM64 architecture

Start without real hardware:

This mode uses a fake hardware interface that simulates the robot's behavior without requiring physical hardware.

docker compose -f docker/docker-compose.yml up

Start with real hardware:

This mode connects to the actual physical hardware (motors and sensors) of the diff-base.

Hardware Setup

  1. Connect CAN interface: Connect your laptop to the diff-base via the CAN2USB adapter

  2. 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
  3. 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
  4. Launch the hardware container:

    docker compose -f docker/docker-compose-hardware.yml up

Sending movement commands

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}}}"

Fake vs Real Hardware Interfaces

Fake Hardware Interface

  • 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

Real Hardware Interface

  • 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

Common Issues and Troubleshooting

No Odometry or Incorrect Movement

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

Motors Turning in the Same Direction

Symptom: Both wheels turn in the same direction when sending rotation commands.

Solution:

  1. Check the motor configuration in your hardware YAML file (typically in bringup/config/):

  2. Rebuild and restart the container after modifications

Robot Not Responding to Commands

Symptom: Robot doesn't move when sending velocity commands.

Possible Causes:

  1. Wrong topic: Ensure you're publishing to /cmd_vel with the correct message type
  2. Controller not running: Check if the controller is loaded with:
    ros2 control list_controllers
  3. Hardware not ready: Verify ODrive status LEDs and CAN communication

CAN Interface Issues

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

Important links

https://github.com/ros-controls/ros2_control_demos

https://articulatedrobotics.xyz/tutorials/mobile-robot/applications/ros2_control-real/

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages