Skip to content

Commit 931fcfa

Browse files
Updatd readme
1 parent f70708f commit 931fcfa

1 file changed

Lines changed: 113 additions & 15 deletions

File tree

readme.md

Lines changed: 113 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# iki_diff_base
2-
Current setup is just the stripped demo-example from ros2 controll for the diff-controler.
1+
# Diff base
2+
3+
[![Build Status](https://gitlab.rwu.de/prj-iki-ros2/robots/iki_diff_base/badges/main/pipeline.svg)](https://gitlab.rwu.de/prj-iki-ros2/robots/iki_diff_base/-/pipelines)
4+
5+
Current setup is just the stripped demo-example from ros2 control for the diff-controler.
36

47
## Setup Instructions
58

@@ -15,27 +18,54 @@ git submodule update --init
1518
docker compose -f docker/build.yml build
1619
```
1720

21+
## Docker Compose Files
22+
23+
This project uses several docker-compose files for different purposes:
24+
25+
- `docker/build.yml`: Used to build the Docker images
26+
- `docker/docker-compose.yml`: Launches the system with fake hardware interfaces for simulation
27+
- `docker/docker-compose-hardware.yml`: Launches the system with real hardware interfaces connected to physical motors
28+
- `docker/docker-compose-amd64.yml`: Configuration specific for AMD64 architecture
29+
- `docker/docker-compose-arm64.yml`: Configuration specific for ARM64 architecture
30+
1831
## Start without real hardware:
1932

33+
This mode uses a fake hardware interface that simulates the robot's behavior without requiring physical hardware.
34+
2035
```bash
2136
docker compose -f docker/docker-compose.yml up
2237
```
2338

2439
## Start with real hardware:
2540

26-
### Hardware
27-
1. `Connect` your laptop via the can2usb adapter to the diff-base
28-
2. `Power up` the diff-base (bike cell)
41+
This mode connects to the actual physical hardware (motors and sensors) of the diff-base.
2942

30-
From now on u have to be connected via the usb2can adapter
31-
```bash
32-
sudo ip link set can0 up type can bitrate 250000
33-
```
34-
```bash
35-
docker compose -f docker/docker-compose-hardware.yml up
36-
```
43+
### Hardware Setup
44+
1. **Connect CAN interface**: Connect your laptop to the diff-base via the CAN2USB adapter
45+
2. **Set up CAN interface**: The CAN interface needs to be configured before running the robot
46+
```bash
47+
sudo ip link set can0 up type can bitrate 250000
48+
```
49+
If the above command fails, you may need to first create the CAN interface:
50+
```bash
51+
sudo ip link add dev can0 type can bitrate 250000
52+
sudo ip link set can0 up
53+
```
54+
55+
3. **Power up the diff-base**:
56+
- Ensure the battery (bike cell) is properly connected
57+
- Turn on the main power switch located on the side of the robot
58+
- Verify the status LEDs on the ODrive controllers are lit
59+
60+
4. **Launch the hardware container**:
61+
```bash
62+
docker compose -f docker/docker-compose-hardware.yml up
63+
```
64+
65+
### Sending movement commands
66+
67+
To send a simple movement command to the robot:
3768

38-
### Sending a simple movement command
3969
```bash
4070
ros2 topic pub --rate 30 /cmd_vel geometry_msgs/msg/TwistStamped "
4171
twist:
@@ -49,9 +79,77 @@ ros2 topic pub --rate 30 /cmd_vel geometry_msgs/msg/TwistStamped "
4979
z: 0.3"
5080
```
5181

52-
## Debugging
82+
Alternatively, for a one-time command:
83+
84+
```bash
85+
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}}}"
86+
```
87+
88+
## Fake vs Real Hardware Interfaces
89+
90+
### Fake Hardware Interface
91+
- Used for simulation and testing without physical hardware
92+
- Provides simulated feedback and accepts commands just like the real hardware
93+
- Useful for development and testing of algorithms before deploying to the real robot
94+
- No risk of damaging physical equipment during testing
95+
96+
### Real Hardware Interface
97+
- Connects to the actual motor controllers (ODrives) via CAN bus
98+
- Reads real sensor data and sends commands to real motors
99+
- Requires proper hardware setup and configuration
100+
- Used for actual deployment and real-world testing
101+
102+
## Common Issues and Troubleshooting
103+
104+
### No Odometry or Incorrect Movement
105+
106+
**Symptom**: No odometry data is published, or motors turn in unexpected ways.
107+
108+
**Possible Cause**: ODrive controllers have incorrect CAN IDs
109+
110+
**Solution**:
111+
- Check if the ODrives are configured with CAN ID 0 (left motor) and 1 (right motor)
112+
- You can verify the CAN IDs using the ODrive Tool or by checking the configuration parameters
113+
114+
### Motors Turning in the Same Direction
115+
116+
**Symptom**: Both wheels turn in the same direction when sending rotation commands.
117+
118+
**Solution**:
119+
1. Check the motor configuration in your hardware YAML file (typically in `bringup/config/`):
120+
121+
2. Rebuild and restart the container after modifications
122+
123+
### Robot Not Responding to Commands
124+
125+
**Symptom**: Robot doesn't move when sending velocity commands.
126+
127+
**Possible Causes**:
128+
1. **Wrong topic**: Ensure you're publishing to `/cmd_vel` with the correct message type
129+
2. **Controller not running**: Check if the controller is loaded with:
130+
```bash
131+
ros2 control list_controllers
132+
```
133+
3. **Hardware not ready**: Verify ODrive status LEDs and CAN communication
134+
135+
### CAN Interface Issues
136+
137+
**Symptom**: Communication errors or no response from hardware.
53138

54-
In case there is no odometry for a given link, or both motors are turing in the same direction no matter what, check if the odrives are configured with CAN ID 0 and 1.
139+
**Solution**:
140+
- Check CAN interface status:
141+
```bash
142+
ip -details link show can0
143+
```
144+
- Monitor CAN traffic:
145+
```bash
146+
candump can0
147+
```
148+
- If needed, reset the interface:
149+
```bash
150+
sudo ip link set can0 down
151+
sudo ip link set can0 up type can bitrate 250000
152+
```
55153

56154
## Important links
57155
https://github.com/ros-controls/ros2_control_demos

0 commit comments

Comments
 (0)