Skip to main content

Upkie locomotion

Build Documentation Coverage PyPI version Vulp

Locomotion code for the Upkie wheeled biped.

Test it straight from the command line on Linux, no installation required:

git clone https://github.com/tasts-robots/upkie_locomotion.git
cd upkie_locomotion
./tools/bazelisk run -c opt //agents/blue_balancer:bullet

Connect a USB controller to move the robot around. 🎮

Getting started

There is no dependency to install thanks to Bazel, which builds everything locally. (Compilation will only take a while the first time.) The syntax is the same to deploy to the Raspberry Pi on Upkie with raspunzel.

The code is organized into spines, which communicate with the simulator or actuators using the Vulp C++ library, and agents, the main programs that implement behaviors in Python. In the example above we ran the blue agent. We could also run the Bullet spine independently:

bazel run -c opt //spines:bullet -- --show

The -c opt argument to Bazel makes sure we compile optimized code, while the --show argument to the spine displays the Bullet visualization.

Agents

Blue balancer
A baseline agent designed to check out Upkie's physical capabilities. It balances the robot using PD feedback from the head's pitch and wheel odometry to wheel velocities, plus a feedforward non-minimum phase trick for smoother transitions from standing to rolling. An analytical inverse kinematics is plugged in for crouching and standing up (crouching is controlled from D-pad of the USB controller, if one is found).
Pink balancer
Same as the Blue balancer, but inverse kinematics is computed by Pink rather than with a model-specific analytical solution. This is the controller that runs in the first two videos of Upkie.
PPO balancer
An agent trained by reinforcement learning to balance with straight legs. Training uses the UpkieWheelsEnv gym environment and the PPO implementation from Stable Baselines3.

Environments

UpkieServosEnv
Upkie with full observation and joint position-velocity-torque actions.
UpkieWheelsEnv
Upkie with full observation but only wheel velocity actions.

Environments are single-threaded rather than vectorized. In return, they run as-is on the real robot.

Observers

Floor contact
Detect contact between the wheels and the floor. Both Blue and Pink agents use contact as a reset flag for their integrators, to avoid over-spinning the wheels while the robot is in the air.
Wheel contact
Detect contact between a given wheel and the floor.
Wheel odometry
Measure the relative motion of the floating base with respect to the floor. Wheel odometry is part of their secondary task (after keeping the head straight), which is to stay around the same spot on the floor.

Spines

Bullet
Spawn Upkie in a Bullet simulation. Resetting this spine moves the robot back to its initial configuration in this world.
pi3hat
Spine is made to be called from a Raspberry Pi with an onboard mjbots pi3hat. Servos are stopped when the spine is stopped, and switch to position mode (which is a position-velocity-torque controller) when the spine idles. Check out the spine state machine for details.

Metadata

Release files for upkie_locomotion 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upkie_locomotion 0.4.0
File Size Uploaded
upkie_locomotion-0.4.0.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for upkie_locomotion 0.4.0
File Interpreter ABI Platform
upkie_locomotion-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.5 kB

Release files / upkie_locomotion-0.4.0.tar.gz

Download URL upkie_locomotion-0.4.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
18bb4e0e07102ae8296abbe66912a3aaaf49b4220feccdf9043d63bfa2330cea
BLAKE2b-256 checksum
How to use checksums
8c0087bf9d2833ee36d58dbcdfe1180757a4e0f7dba26fb799d17151c74ec965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / upkie_locomotion-0.4.0-py3-none-any.whl

Download URL upkie_locomotion-0.4.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee2727d4a39468db118983a6c91b204e17a46e497b3396c80c2cace80cd0ee36
BLAKE2b-256 checksum
How to use checksums
5c04039a79fb0f0ebf6615b513ed8a01aba3a58957f1ef4928f42d80d04efca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page