Skip to main content

Python module to control Upkie wheeled bipeds.

Project description

Upkie wheeled biped robot

CI Documentation Coverage PyPI version Chat

Upkie is a fully open source self-balancing wheeled biped robot. It has wheels for balancing and legs to negotiate uneven terrains. Upkies are designed to be buildable at home using only tools and components ordered online, like mjbots actuators. You can develop in Python or C++, on Linux or macOS, then deploy your software to the robot's Raspberry Pi.

This repository contains all the materials needed to build and animate an Upkie:

Questions are welcome in the Chat and Discussions forum.

Getting started

You can play with a balancing Upkie right away from your command line:

git clone https://github.com/upkie/upkie.git
cd upkie
./try_pid_balancer.sh

Click on the robot in the simulator window to apply external forces. If you have a gaming controller connected to your computer, steer its joysticks to move the robot around 🎮

Installation

From conda-forge

Conda version

conda install -c conda-forge upkie

From PyPI

PyPI version

pip install upkie

Example

First, let's start a simulation:

./start_simulation.sh

Once a spine (simulation or real robot) is running, you can control the robot in Python using one of the Gymnasium environments. For example, here is a proportional feedback balancer:

import gymnasium as gym
import upkie.envs

upkie.envs.register()

with gym.make("UpkieGroundVelocity-v3", frequency=200.0) as env:
    observation, _ = env.reset()
    action = 0.0 * env.action_space.sample()
    for step in range(1_000_000):
        observation, reward, terminated, truncated, _ = env.step(action)
        if terminated or truncated:
            observation, _ = env.reset()
        pitch = observation[0]
        action[0] = 10.0 * pitch

Executing the code above will balance the simulated Upkie. To run the agent on the robot, do the same but running the pi3hat spine instead of the simulation.

Agents

The demo agent simply balances in place by PID control. There are more advanced Upkie agents distributed in their own repositories. Check out the ones you are interested in:

  • MPC balancer: balance in place using model predictive control.
  • Pink balancer: an extended PID balancer than can crouch and lift its legs.
  • PPO balancer: balance in place with a policy trained by reinforcement learning.

Head over to the new_agent template to create your own.

Frequently Asked Questions

Citation

If you built an Upkie or use parts of this project in your works, please cite it as follows:

@software{upkie,
  title = {{Upkie open source wheeled biped robot}},
  author = {Caron, St\'{e}phane and Perrin-Gilbert, Nicolas and Ledoux, Viviane and G\"{o}kbakan, \"{Umit} Bora and Raverdy, Pierre-Guillaume and Raffin, Antonin and Tordjman--Levavasseur, Valentin},
  license = {Apache-2.0},
  url = {https://github.com/upkie/upkie},
  version = {5.0.0},
  year = {2024}
}

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-5.0.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

upkie-5.0.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file upkie-5.0.0.tar.gz.

File metadata

  • Download URL: upkie-5.0.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for upkie-5.0.0.tar.gz
Algorithm Hash digest
SHA256 b5cfe9ad7ebd28693e3e903c5e5e247159d12fcdbf4863ea1b21aaa84977085e
MD5 e0c939ffcff3d59dcfbee788fe597d08
BLAKE2b-256 973ba63887871c3505e93ea5ca69b9df7b5ea54ab645ec7b269b7f78bea2a2f8

See more details on using hashes here.

File details

Details for the file upkie-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: upkie-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for upkie-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db7e23dca7e637891e3076a107908fb679c318d9bd262599e7ca5d07c6422807
MD5 7e0a7cd56b03d70d2ed4fcc8b0f5345b
BLAKE2b-256 62c09879634a63ef67f407e450e6299f9f8b7a278e9de7a52dee1b0c0191f437

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