This README describes the usage of the control system for the quadruped robot, including both walking and rolling modes. The ROS2 code also performs autonomous bowling using computer vision (YOLO) and machine learning.
quad-demo.mp4
The robot has two main modes of operation:
- Walking Mode - Standard quadruped locomotion on four legs
- Rolling Mode - Transformation into a circular shape for efficient rolling locomotion
The robot has 12 servo motors, with 3 motors per leg. Each leg has the following motors:
- Roll Motor - Controls up/down movement
- Yaw Motor - Controls side-to-side movement
- Fold Motor - Controls folding/unfolding of the leg
cd self-reconfigurable-quadruped/c++/control/sync_read_write
make
./sync_read_write
# then type `h1` command to move to home position for walking# Terminal 1
cd self-reconfigurable-quadruped/c++/control/sync_read_write
make
./sync_read_write
# type `h1` command to move to home position for walking
# then type `hcir` command to transform to rolling mode# Terminal 2
cd self-reconfigurable-quadruped/c++/control/rolling_imu
make
./rollThe system provides a command-line interface that accepts various commands.
| Command | Description |
|---|---|
get |
Scan and display all connected motors with their current positions |
exit |
Exit the program |
h1 |
Move to home position for walking |
ali |
Move to aligned position |
en X Y Z |
Enable torque for motors with IDs X, Y, Z |
d X Y Z |
Disable torque for motors with IDs X, Y, Z |
set ID:pos ID:pos ... |
Directly set motor positions (e.g., set 1:2048 2:3000) |
| Command | Description |
|---|---|
up X:Y Z ... |
Move legs Y, Z up by X degrees (e.g., up 30:1 3) |
down X:Y Z ... |
Move legs Y, Z down by X degrees |
cw X:Y Z ... |
Rotate legs Y, Z clockwise by X degrees |
ccw X:Y Z ... |
Rotate legs Y, Z counter-clockwise by X degrees |
fcw X:Y Z ... |
Fold legs Y, Z clockwise by X degrees |
fccw X:Y Z ... |
Fold legs Y, Z counter-clockwise by X degrees |
| Command | Description |
|---|---|
crawl |
Begin crawling gait (continuous) |
ri |
Turn right (continuous) |
le |
Turn left (continuous) |
hcir |
Transform from walking to rolling shape |
| Command | Description |
|---|---|
cir |
Move to perfect circle position |
cirh |
Transform from rolling back to walking configuration |
The robot uses the following leg numbering convention:
- Leg 1: Front-left
- Leg 2: Front-right
- Leg 3: Rear-left
- Leg 4: Rear-right
When using the up, down, cw, ccw, fcw, and fccw commands, you reference these leg numbers.
For transformation from walking to rolling (hcir):
- The robot first moves to aligned position
- Then transitions to circular form through intermediate positions
For transformation from rolling to walking (cirh):
- Moves from circle to transition position
- Then unfolds legs sequentially
- Finally settles into walking stance
When using the rolling executable, the robot has an automatic mode where it detects orientation using the IMU sensor and automatically propels the appropriate side. This allows the robot to continue rolling even when its orientation changes.
If motors are not responding:
- Check connections and power
- If a motor shows errors, try disabling and re-enabling its torque, switching the U2D2 off and on, and/or unplugging the power source to the U2D2
- Run ./sync_read_write again and run
h1command to reset the robot to its home position
If the robot falls during rolling:
- Cancel ./roll
- Return to circle position with
cir - Run ./roll again
This setup enables autonomous bowling using computer vision (YOLO) and machine learning. The robot uses IMU data and visual feedback to find, roll toward, and knock down bowling pins.
ROS2 version: Jazzy
# DYNAMIXEL requirements
sudo apt install ros-jazzy-dynamixel-sdk ros-jazzy-dynamixel-sdk-custom-interfaces- The laptop and the pi must have the same wifi.
quad_motor_control node:
- Controls the motors and reads IMU data for rolling mode
- Publishes motor positions and subscribes to rolling commands
# On laptop - RPi5 Terminal
ssh <rpi_name>@<ip_address>
cd self-reconfigurable-quadruped/ros2_ws
colcon build
source install/setup.bash
ros2 run quad_motor_control quad_motor_control# On laptop
cd self-reconfigurable-quadruped
python3 -m venv venv # create the venv
source venv/bin/activate # activate it
pip install -r requirements.txt # install everything from the fileThese nodes:
- Handle motion planning and execution
- Use YOLO to detect and count bowling pins
# On laptop - Terminal 1
cd self-reconfigurable-quadruped/ros2_ws
colcon build
source install/setup.bash
ros2 run quad_control move_action_server &
ros2 run quad_control move_action_client# On laptop - Terminal 2
cd self-reconfigurable-quadruped
# Activate the virtual environment to access YOLO from Ultralytics
source venv/bin/activate
cd ros2_ws
source install/setup.bash
ros2 run quad_vision yolo_nodeOnce all nodes are active, the system will:
- Command the robot to turn in place while scanning for pins
- Use YOLO to detect if 2 or more pins are visible for 3 or more seconds
- Transform into the rolling configuration
- Roll forward to knock down the pins