Skip to main content

Real-time motion control for Python.

Project description

Upkie locomotion

Build Documentation Coverage 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

UpkieWheelsEnv
Upkie with full observation but only wheel velocity actions. This environment is single-threaded rather than vectorized. In return, it runs 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

upkie_locomotion-0.2.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

upkie_locomotion-0.2.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file upkie_locomotion-0.2.0.tar.gz.

File metadata

  • Download URL: upkie_locomotion-0.2.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for upkie_locomotion-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b76ada338fdb03f83fc221bc2e540fa713e9dd07285101e94086634f3c04ea16
MD5 09c89cdf167100ce7141944824404477
BLAKE2b-256 0e5b74eab7578f14b636d1ac24601f2657620deef6e28c85d387744d01ceb4ea

See more details on using hashes here.

File details

Details for the file upkie_locomotion-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for upkie_locomotion-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc840528eeaf7c84908ff56a733dfd5228debae601dc18cf0947ba74ec68b05e
MD5 62784a4645b418d484a234fb7bccd998
BLAKE2b-256 ebd93dd6198575ad7a7ed75515bd1ca71c286042cc4a39bb8e5256e2fedb686c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page