A hands-on workshop where you program a quadruped robot dog using Python. The robot runs a Raspberry Pi, so you can connect to it over the network and run scripts directly on the hardware.
Before you can connect to the robot you need to make sure it's on the same network as your laptop. To do so you need to add the SSID and password of your wifi network to the robot. This can be done by having it's camera scan the QR code on your mobile phone by sharing the network you want the robot to connect to. https://docs.google.com/document/d/15MvHfDQDW5mT1O_XRLc6QtZqjjpieBM6wqgk4J_BnBg/edit?tab=t.0#heading=h.cjzhwvmojcsd
| Field | Value |
|---|---|
| Username | pi |
| Password | pi |
SSH gives you a command-line shell on the robot's Raspberry Pi.
To copy a script from your laptop to the robot:
scp scripts/robo-walk.py pi@<input.robot.ip.here>:/home/pi/To run it on the robot:
ssh pi@192.168.4.1 "python /home/pi/robo-walk.py"VNC lets you see and control the robot's desktop remotely — useful when working with the camera feed or OpenCV windows.
- Download TigerVNC (free): https://github.com/TigerVNC/tigervnc/releases
- Open TigerVNC and enter the robot's IP address.
- Log in with the credentials above.
The desktop that appears is running directly on the robot's Raspberry Pi.
All scripts must run on the robot (not on your laptop), because the serial port /dev/ttyAMA0 and the camera are physically connected to the Pi inside the robot.
- SSH into the robot.
- Navigate to the scripts folder or copy your script there.
- Run with
python <script_name>.py.
Install dependencies if needed:
pip3 install xgolib opencv-python numpyWork directly on the robot via SSH or VNC.
Goal: Connect robot to the correct WIFI network and access through SSH of VNC
Your task:
- Make sure your laptop and phone are connected to the correct WIFI network
- Create a QR code on your phone
- Scan the QR code with the camera of the robot
- On the robot use the buttons on the sides of the screen to navigate to "Try Demo"
- Browse through the multiple options and select "Network"
- The robot will start the camera, hold the QR code from your phone in front of the camera and wait for you to scan it
- The robot will then connect to your wifi network and you can access the robot via SSH or VNC
- Reboot the robot
- In the main menu of the robot, select "Program"
- A IP address will be displayed on the robot's screen. This IP can be used to connect to the robot.
- Connect to the robot via SSH or VNC
Goal: Make the robot perform a set of actions.
Your task:
- Use SSH or VNC to connect to the robot
- Look at the exampel scripts in the
scriptsfolder - Study the code and write your own script to make the robot move
Useful API calls:
dog.move('x', 18) # forward (positive) or backward (negative), mm
dog.move('y', 10) # strafe left/right
dog.turn(60) # turn at degrees/second (negative = right)
dog.attitude(['p', 'y', 'r'], [pitch, yaw, roll]) # body tilt in degrees
dog.pace('normal') # gait: 'slow', 'normal', 'high'
dog.stop() # stop all movement
dog.read_battery() # returns battery % as an integerDone when: The robot completes your sequence of actions.
Goal: Use the camera to make the dog react to the ball.
The robot has a front-facing camera that can be used to detect objects in the environment.
Your task:
Look at the example script scripts/detect_ball.py and study the code.
This code reads the camera feed, creates a mask image and uses OpenCV to find the ball in the image.
It highlights the ball, including the coordinates, size and distance to the camera and displays it on the screen.
If you are connected to the robot via VNC, it will also open windows to show the camera feed and the mask image. Write a script that makes the robot react to the ball.
Done when: The robot performs at least one action when the ball is in the camera's view.
Goal: Combine the last two assignments and make the robot detect a ball, pick it up and bring it to a highlighted area.
In the last two assignments you made the robot move and used the camera to detect objects. In this assignment you will combine the two to make the robot interact with the ball and the environment.
Your task:
Use your previous scripts to make the robot detect the ball and pick it up.
If you were unable to do this in the previous assignments, use the grab_object.py script in the scripts folder.
Pick up the ball and bring it to a highlighted area using the actions from the previous assignments.
Done when: The robot performs at least one action when the ball is in the camera's view.
Useful links: