ROS2 control system for humanoid robots using Waveshare Bus Servo Adapter and Feetech STS3215 servos.
- Windows 10/11 with WSL2 (Installation Guide)
- Docker Desktop (Download)
- Git (Download)
-
Install WSL2 if not already installed:
# Open Powershell as Administrator wsl --install wsl --set-default-version 2
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name -
Build the Docker container:
docker-compose build
-
Start the container:
docker-compose up -d
-
Enter the container:
docker exec -it ros2_waveshare bash
-
Inside the container, source ROS2:
source /opt/ros/humble/setup.bash source /ros2_ws/install/setup.bash
-
Launch the control system:
ros2 launch waveshare_servos example.launch.py
# Stop any running containers
docker-compose down
# Pull latest changes
git pull
# Rebuild and start
docker-compose up -d --build
# Enter container
docker exec -it ros2_waveshare bash# Start existing container
docker-compose up -d
# Enter container
docker exec -it ros2_waveshare bash# Exit container (when inside container)
exit
# Stop container
docker-compose downInside the container:
cd /ros2_ws
colcon build --merge-install
source install/setup.bash# View running containers
docker ps
# View all containers
docker ps -a
# Remove all stopped containers
docker container prune
# Remove all unused images
docker image prune
# Full cleanup (USE WITH CAUTION)
docker system prune -a-
Plug in Waveshare Bus Servo Adapter
-
Find device name:
ls /dev/ttyUSB* /dev/ttyACM*
-
Update config file:
cd /ros2_ws/src/waveshare_servos/config nano example_controllers.yaml # Update 'port:' to match your device
Connect one servo at a time:
ros2 run waveshare_servos set_id --ros-args -p start_id:=1 -p new_id:=<new_id>ros2 run waveshare_servos calibrate_midpoint --ros-args -p id:=<id>-
"Container not starting"
docker-compose down docker system prune -f docker-compose up -d
-
"USB device not found"
# Inside container chmod 666 /dev/ttyUSB0 # or your port
-
"Build failures"
# Inside container cd /ros2_ws rm -rf build install log colcon build --merge-install
-
"Controllers not spawning"
- Check if hardware is connected
- Verify port configuration
- Restart the launch file
-
"Communication errors"
- Check power supply
- Verify servo IDs
- Check USB connection