This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

Overview

Stanford Quadruped

Overview

This repository hosts the code for Stanford Pupper and Stanford Woofer, Raspberry Pi-based quadruped robots that can trot, walk, and jump.

Pupper CC Max Morse

Video of pupper in action: https://youtu.be/NIjodHA78UE

Project page: https://stanfordstudentrobotics.org/pupper

Documentation & build guide: https://pupper.readthedocs.io/en/latest/

How it works

Overview diagram The main program is run_robot.py which is located in this directory. The robot code is run as a loop, with a joystick interface, a controller, and a hardware interface orchestrating the behavior.

The joystick interface is responsible for reading joystick inputs from a UDP socket and converting them into a generic robot command type. A separate program, joystick.py, publishes these UDP messages, and is responsible for reading inputs from the PS4 controller over bluetooth. The controller does the bulk of the work, switching between states (trot, walk, rest, etc) and generating servo position targets. A detailed model of the controller is shown below. The third component of the code, the hardware interface, converts the position targets from the controller into PWM duty cycles, which it then passes to a Python binding to pigpiod, which then generates PWM signals in software and sends these signals to the motors attached to the Raspberry Pi. Controller diagram This diagram shows a breakdown of the robot controller. Inside, you can see four primary components: a gait scheduler (also called gait controller), a stance controller, a swing controller, and an inverse kinematics model.

The gait scheduler is responsible for planning which feet should be on the ground (stance) and which should be moving forward to the next step (swing) at any given time. In a trot for example, the diagonal pairs of legs move in sync and take turns between stance and swing. As shown in the diagram, the gait scheduler can be thought of as a conductor for each leg, switching it between stance and swing as time progresses.

The stance controller controls the feet on the ground, and is actually quite simple. It looks at the desired robot velocity, and then generates a body-relative target velocity for these stance feet that is in the opposite direction as the desired velocity. It also incorporates turning, in which case it rotates the feet relative to the body in the opposite direction as the desired body rotation.

The swing controller picks up the feet that just finished their stance phase, and brings them to their next touchdown location. The touchdown locations are selected so that the foot moves the same distance forward in swing as it does backwards in stance. For example, if in stance phase the feet move backwards at -0.4m/s (to achieve a body velocity of +0.4m/s) and the stance phase is 0.5 seconds long, then we know the feet will have moved backwards -0.20m. The swing controller will then move the feet forwards 0.20m to put the foot back in its starting place. You can imagine that if the swing controller only put the leg forward 0.15m, then every step the foot would lag more and more behind the body by -0.05m.

Both the stance and swing controllers generate target positions for the feet in cartesian coordinates relative the body center of mass. It's convenient to work in cartesian coordinates for the stance and swing planning, but we now need to convert them to motor angles. This is done by using an inverse kinematics model, which maps between cartesian body coordinates and motor angles. These motor angles, also called joint angles, are then populated into the state variable and returned by the model.

How to Build Pupper

Main documentation: https://pupper.readthedocs.io/en/latest/

You can find the bill of materials, pre-made kit purchasing options, assembly instructions, software installation, etc at this website.

Help

Comments
  • Inverse Kinematic for a single leg

    Inverse Kinematic for a single leg

    Hi, I'm trying to create a small robot which has the same disposition of servos. I'm struggling with the 3DOF IK (2d works), so I tried to implement yours (for now with javascript for testing). I transpiled your Python code to Javascript, created a simple leg simulation in Three.js, and i tried to call you function leg_explicit_inverse_kinematics with custom x,y,z values : i changed (x, y, z) = r_body_foot to x=... y=..., z=...

    It outputs me 3 angles, but when I put them in my leg simulation, it goes to a wrong x,y,z location.

    My Parameters :

    ABDUCTION_OFFSET = 4
    LEG_L1 = 9.2
    LEG_L2 = 10
    

    --> the simulation : you can see at the bottom, I call pupperIk(19.2, 0, 4); which should place the arm straight, but it outputs : [98.11, -81.89, -89.99] which put my feet to the wrong location (obviously).

    --> My implementation of you IK in Js is correct : i have compared my js result to you python results.

    --> does it have something to do with the r_body_foot variable ?

    What I would like to know, is how to use your formula to do IK of one leg independently of any other legs (the coxa being the origin ?) ?

    Thank you :)

    robot_leg_schema

    opened by boehm-e 7
  • Questions about vision sensors

    Questions about vision sensors

    I'm sorry I didn't find any descriptions of vision sensors in the Puppet doc. And are there any vision sensors in the Puppet? If not, can we attach any vision sensors (or depth sensors, etc.) to the Puppet, and thus they can "see" the world?

    opened by xspkwy 1
  • Calibration improvements:

    Calibration improvements:

    • micros per degree initially defaults to 11.333
    • 'yes' and 'no' can be shortened to 'y' and 'n'
    • NEUTRAL_ANGLE_DEGREES matrix is written to ServoCalibration.py
    opened by Mark-Bowers 0
  • install.sh error

    install.sh error

    pi@raspberrypi(rw):~/StanfordQuadruped$ sudo bash install.sh Reading package lists... Done Building dependency tree Reading state information... Done libatlas-base-dev is already the newest version (3.10.3-8+rpi1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. install.sh: line 2: pip3: command not found install.sh: line 3: pip: command not found sudo: pip: command not found install.sh: line 7: git: command not found install.sh: line 8: cd: PupperCommand: No such file or directory bash: install.sh: No such file or directory install.sh: line 12: git: command not found install.sh: line 13: cd: PS4Joystick: No such file or directory bash: install.sh: No such file or directory Failed to enable unit: Unit file joystick.service does not exist. --2019-02-14 18:30:30-- https://github.com/joan2937/pigpio/archive/v74.zip Resolving github.com (github.com)... 20.205.243.166 Connecting to github.com (github.com)|20.205.243.166|:443... connected. ERROR: The certificate of ‘github.com’ is not trusted. ERROR: The certificate of ‘github.com’ is not yet activated. The certificate has not yet been activated unzip: cannot find or open v74.zip, v74.zip.zip or v74.zip.ZIP. install.sh: line 20: cd: pigpio-74: No such file or directory make: *** No targets specified and no makefile found. Stop. make: *** No rule to make target 'install'. Stop. install.sh: line 25: cd: StanfordQuadruped: No such file or directory ln: failed to create symbolic link '/etc/systemd/system/robot.service': File exists Failed to enable unit: Unit file robot.service does not exist. Failed to start robot.service: Unit robot.service not found.

    opened by xiangee2022 3
  • circuit diagram!

    circuit diagram!

    Anyone please provide me a circuit diagram , which motor will connect which pin of raspberry pi ,which pin will connect the IMU . I am super confused.

    opened by haxord7hasib 1
  • Update run_djipupper.py to send joint-space position commands

    Update run_djipupper.py to send joint-space position commands

    Update run_djipupper.py to send joint-space position commands rather than cartesian-space position commands. Experimental, ie haven't tested it on my own robot.

    opened by Nate711 0
  • Abnormal process about pwm_to_duty_cycle

    Abnormal process about pwm_to_duty_cycle

    Hello, Sometimes, I can get the abnormal return from functions "pwm_to_duty_cycle" in the file HardwareInterface.py. It's OK after change from return int(pulsewidth_micros / 1e6 * pwm_params.freq * pwm_params.range) to pulsewidth_micros = int(pulsewidth_micros / 1e6 * pwm_params.freq * pwm_params.range) if np.isnan(pulsewidth_micros): return 0 return int(np.clip(pulsewidth_micros, 0, 4096))

    Please double confirm whether the change point is OK, thanks! Best, Afreez

    opened by mangdangDOTnet 1
Owner
Stanford Student Robotics
Stanford Student Robotics
Mini Pupper - Open-Source,ROS Robot Dog Kit

Mini Pupper - Open-Source,ROS Robot Dog Kit

MangDang 747 Dec 28, 2022
Quasi-static control of the centroid of quadruped robot

Quasi-static control of quadruped robot   This is a demo of the quasi-static controller for the centroid of the quadruped robot. The Quadratic Program

Junwen Cui 21 Dec 12, 2022
2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

A number of 2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

Arghya Chatterjee 5 Nov 5, 2022
A python file which I wrote to allow the Dorna Robots API to draw an Image on a 3D plane

Dorna-Robotics-Internship Code In the directory "Code" is a python file which I wrote to allow the Dorna Robots API to draw an Image on a 3D plane. I

Stephen Otto 2 Dec 6, 2021
Isaac Gym Environments for Legged Robots

Isaac Gym Environments for Legged Robots This repository provides the environment used to train ANYmal (and other robots) to walk on rough terrain usi

Robotic Systems Lab - Legged Robotics at ETH Zürich 372 Jan 8, 2023
Designed a system that can efficiently sort recyclables and transfer them to corresponding bins using Python, a Raspberry Pi, and Quanser Labs.

System for Sorting and Recycling Containers - Project 3 Table of contents Overview The challenge Screenshot My process Built with Code snippets What I

Mit Patel 2 Dec 2, 2022
New armachat based on Raspberry Pi PICO an Circuitpython code

Armachat-circuitpython New Armachat based on Raspberry Pi PICO an Circuitpython code Software working features: send message with header and store to

Peter Misenko 44 Dec 24, 2022
Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Collector and Shelly EM.

raspberry-solar-mon Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Coll

cislow 10 Dec 23, 2022
An embedded application for toy-car controlling based on Raspberry Pi 3 Model B and AlphaBot2-Pi.

An embedded application for toy-car controlling based on Raspberry Pi 3 Model B and AlphaBot2-Pi. This is the source codes of my programming assignmen

StardustDL 4 Oct 19, 2022
A simple portable USB MIDI controller based on Raspberry-PI Pico and a 16-button keypad, written in Circuit Python

RPI-Pico-16-BTn-MIDI-Controller-using-CircuitPython A simple portable USB MIDI controller based on Raspberry-PI Pico, written in Circuit Python. Link

Rounak Dutta 3 Dec 4, 2022
Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the cost of the day.

Johan Jonk Stenström 3 Sep 8, 2022
Raspberry Pi Pico support for VS Code

Pico-Go VS Code Extension Pico-Go provides code auto-completion and allows you to communicate with your Raspberry Pi Pico board using the built-in REP

Chris Wood 114 Dec 28, 2022
A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost.

distance sensor cube timer A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost. How to

null 3 Feb 21, 2022
Mycodo is open source software for the Raspberry Pi that couples inputs and outputs in interesting ways to sense and manipulate the environment.

Mycodo Environmental Regulation System Latest version: 8.12.9 Mycodo is open source software for the Raspberry Pi that couples inputs and outputs in i

Kyle Gabriel 2.3k Dec 29, 2022
Minimal and clean dashboard to visualize some stats of Pi-Hole with an E-Ink display attached to your Raspberry Pi

Clean Dashboard for Pi-Hole Minimal and clean dashboard to visualize some stats of Pi-Hole with an E-Ink display attached to your Raspberry Pi.

Alessio Santoru 104 Dec 14, 2022
A global contest to grow and monitor your own food with Raspberry Pi

growlab A global contest to grow and monitor your own food with Raspberry Pi A capture from phototimer of my seed tray with a wide-angle camera positi

Alex Ellis 442 Dec 23, 2022
A Raspberry Pi Pico powered Macro board, like a Streamdeck but cheaper and simpler.

Env-MCRO A Raspberry Pi Pico powered Macro board, like a Streamdeck but cheaper and simpler. (btw this image is a bit outdated, some of the silkscreen

EnviousData 68 Oct 14, 2022
Raspberry Pi Pico and LoRaWAN from CircuitPython

Raspberry Pi Pico and LoRaWAN from CircuitPython Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040-based board using CircuitPython

Alasdair Allan 15 Oct 8, 2022
a weather application for the raspberry pi and the Pimorioni Inky pHAT.

raspi-weather a weather application for the raspberry pi and the Inky pHAT

Derek Caelin 59 Oct 24, 2022