Underactuated Robotics

Algorithms for Walking, Running, Swimming, Flying, and Manipulation

Russ Tedrake

© Russ Tedrake, 2022
Last modified .
How to cite these notes, use annotations, and give feedback.

Note: These are working notes used for a course being taught at MIT. They will be updated throughout the Spring 2022 semester. Lecture videos are available on YouTube.

Previous Chapter Table of contents Next Chapter

Drake

is the main software toolbox that we use for this text, which in fact originated in a large part due to the MIT underactuated course. The website is the main source for information and documentation. The goal of this chapter is to provide any additional information that can help you get up and running with the examples and exercises provided in these notes.

Pydrake

is primarily a C++ library, with rigorous coding standards and a maturity level intended to support even professional applications in industry. In order to provide a gentler introduction, and to facilitate rapid prototyping, I've written these notes exclusively in python, using Drake's python bindings (pydrake). These bindings are less mature than the C++ backend; your feedback (and even contributions) are very welcome. It is still improving rapidly.

In particular, while the C++ API documentation is excellent, the autogenerated python docs are still a work in progress. I currently recommend using the C++ documentation to find what you need, then checking the Python documentation only if you need to understand how the class or method is spelled in pydrake.

There are also a number of tutorials in that can help you get started.

Online Jupyter Notebooks

I will provide nearly all examples and exercises in the form of a Jupyter Notebook so that we can leverage the fantastic and relatively recent availability of (free) cloud resources.

Running on Deepnote

We'll use Deepnote as the primary platform for the course. After following any of the links from the chapters, you should:

  1. Log in (the free account will be sufficient for this class)
  2. "Duplicate" the document. Icon is in the top right next to Login.
  3. Run all of the cells (can use the "Run notebook" icon just above this cell)
  4. Many of the notebooks use MeshCat for interactive visualizations. Click on the url printed just below "StartMeshcat" (often the second code cell of the notebook) to see the MeshCat window.

Running on Google Colab

Although I believe that Deepnote provides a better and more reliable experience overall, there are a few reasons to be able to also run the notebooks on Google Colab. It has very convenient connections to Google Drive, and also substantial free GPU resources (useful for training big neural nets).

To run any notebook on Colab, just open the file in colab using a direct link to the relevant notebook, e.g.: https://colab.research.google.com/github/RussTedrake/underactuated/blob/master/intro.ipynb. Then you must manually add the following line in a code cell at the top of the notebook (and run it once)

!pip install underactuated

Note: Drake's pip wheels are only updated at each (monthly) release. During the semester, I will often use bleeding-edge features from Drake; they will be available in Deepnote immediately, but will only work in Colab after the next monthly release.

Running on your own machine

As you get more advanced, you will likely want to run (and extend) these examples on your own machine. The website has a number of installation options, including precompiled binaries and Docker instances. Here I provide an example workflow of setting up drake from the precompiled binaries and running the textbook examples.

First, pick your platform (click on your OS):

Ubuntu Linux (Bionic) | Mac Homebrew Ubuntu Linux (Bionic) | Mac Homebrew

Install Drake

The links below indicate the specific distributions that the examples in this text have been tested against.

Download the binaries

curl -o drake.tar.gz 
https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-bionic.tar.gz
curl -o drake.tar.gz 
https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-mac.tar.gz

Unpack and set your PYTHONPATH and Test

sudo tar -xvzf drake.tar.gz -C /opt
sudo /opt/drake/share/drake/setup/install_prereqs
export PYTHONPATH=/opt/drake/lib/python3.6/site-packages:${PYTHONPATH}

python3 -c 'import pydrake; print(pydrake.__file__)'
sudo tar -xvzf drake.tar.gz -C /opt
/opt/drake/share/drake/setup/install_prereqs
export PYTHONPATH=/opt/drake/lib/python3.9/site-packages:${PYTHONPATH}

python3.9 -c 'import pydrake; print(pydrake.__file__)'

Download the textbook supplement

git clone https://github.com/RussTedrake/underactuated.git

and install the prerequisites using the platform-specific installation script provided:

cd underactuated
sudo setup/ubuntu/18.04/install_prereqs.sh
pip3 install --requirement requirements.txt
export PYTHONPATH=`pwd`:${PYTHONPATH}
cd underactuated
setup/mac/install_prereqs.sh
pip3.9 install --requirement /opt/drake/share/drake/setup/requirements.txt --requirement requirements.txt
export PYTHONPATH=`pwd`:${PYTHONPATH}

Note that, as always, I would strongly recommend running pip commands in a virtualenv.

Run Jupyter Notebook

You'll likely want to start from the underactuated root directory. Then launch your notebook with:

jupyter notebook

The examples for each chapter that has them will be in a .ipynb file right alongside the chapter's html file, and the notebook exercises are all located in the exercises subdirectory.

Getting help

If you have trouble with , please follow the advice here. If you have trouble with the underactuated repo, you can check for known issues (and potentially file a new one) here.

Previous Chapter Table of contents Next Chapter