-
Notifications
You must be signed in to change notification settings - Fork 25
5) Motion control software
The prerequisites for this stage are:
- Local copy of the main
upkie
repository from 1) Getting started - Electronics setup from 4) Electronics testing
- USB controller from the Bill of materials
Change directory to your local copy of the upkie
repository:
$ cd upkie
In the following instructions, we will run everything from this directory.
Ask questions about this step in Software discussions.
- Copy robot scripts from this repository to the robot:
$ scp -r tools/ pi@upkie:tools
- Log into the robot and move utility scripts somewhere in the
PATH
of theroot
administrator:
$ ssh pi@upkie
pi@upkie:~$ sudo mv tools/hard_rezero /usr/local/bin/
pi@upkie:~$ sudo mv tools/stop_servos /usr/local/bin/
pi@upkie:~$ sudo mv tools/upkie_tool /usr/local/bin/
Ask questions about this step in Software discussions.
Go to the tools directory on the robot and run the servo configuration script:
pi@upkie:~$ cd tools/setup
pi@upkie:tools$ python python configure_servos.py
Check that the output lines are only OK
or AOK
.
Ask questions about this step in Software discussions.
In your local copy of upkie
, build Raspberry Pi targets by:
$ make build
Running this for the first time requires an Internet connection.
Ask questions about this step in Software discussions.
Connect to the robot's Wi-Fi network, then from the upkie
directory run:
$ make upload UPKIE_NAME=your_robot_hostname
This will create a remote directory (also named upkie
) on the Raspberry Pi with a copy of all the build files necessary to run the spine and balancer on the robot.
The UPKIE_NAME
environment variable should contain the Raspberry Pi's hostname or IP address used in SSH commands. You can define it inline for a one-time use, as we did above, or add the following line to your shell configuration:
export UPKIE_NAME=your_robot_hostname
Ask questions about this step in Software discussions.
Make sure the USB controller is connected to the Raspberry Pi. The controller has two functions:
- Communicate commands to the robot, for instance using the joysticks to move around.
- Emergency stop: pressing the right button (red button 🔴 on an Xbox controller) shuts down all motors immediately.
Always keep the emergency stop around when you run a new agent on the robot, and don't hesitate to press it if the beast misbehaves 😉
Ask questions about this step in Software discussions.
Connect via SSH to the robot and start the pi3hat spine:
pi@upkie:~$ cd upkie
pi@upkie:upkie$ make run_pi3hat_spine
The spine is a fast program in charge of two-way communications between your agent's code (for us it will be the PID balancer here) and the robot's actuators.
Ask questions about this step in Software discussions.
Take the Raspberry Pi in your hand (only touching the sides of the board) and put it upside-down (as it will be when the assembled robot stands upright). In a separate shell on the robot, run the PID balancer:
pi@upkie:upkie$ make run_pid_balancer
Rotate the Raspberry Pi in your hands: the qdd100 servos should stay still while the two mj5208 servos turn in opposite directions.
Ask questions about this step in Software discussions.
Next: 6) Assembly