Giter Site home page Giter Site logo

russtedrake / underactuated Goto Github PK

View Code? Open in Web Editor NEW
691.0 38.0 202.0 25.35 MB

The course text for MIT 6.832 (and 6.832x on edX)

License: Other

MATLAB 0.31% HTML 48.69% TeX 0.34% Shell 0.49% Python 8.49% Jupyter Notebook 41.51% Perl 0.03% Ruby 0.01% Dockerfile 0.11% Starlark 0.01% CSS 0.03%

underactuated's Introduction

Underactuated Robotics

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

This is the companion software for the textbook available at: https://underactuated.csail.mit.edu/

To cite this software (or the corresponding textbook), please use:

Russ Tedrake. Underactuated Robotics: Algorithms for Walking, Running, Swimming, Flying, and Manipulation (Course Notes for MIT 6.832). Downloaded on [date] from https://underactuated.csail.mit.edu/.

underactuated's People

Contributors

ajm4mit avatar alexandreamice avatar dclee131 avatar dependabot[bot] avatar dfannius avatar echen9898 avatar ericcousineau-tri avatar gizatt avatar hongkai-dai avatar iamsavva avatar jaehunchoe827 avatar jamiesnape avatar jwnimmer-tri avatar karlobermeyer avatar lujieyang avatar meenalparakh avatar mtomassoli avatar peteflorence avatar rdeits avatar richardrl avatar rpoyner-tri avatar russtedrake avatar shensquared avatar spmaniato avatar tangsun avatar tkoolen avatar tobiamarcucci avatar wernerpe avatar wilkosch avatar znewman01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

underactuated's Issues

planar rigid body visualization minor requests

the rimless wheel sim in #111 reveals two small quirks.

  • cylinders viewed along their long axis are viewed by their bounding box instead of as a circle.
  • xlim and ylim don't actual change the shape of the figure, so I get a LOT of ground.

experimental mac and ubuntu builds have different timestamps

my current drake_version.json logic does not support that. so, as it stands, the links to the mac binaries in the text will be broken whenever drake_version is pointing to the (linux) experimental.

fyi @jamiesnape . (but unless there is a trivially different naming solution, i think this one is on me to fix).

Time derivative of energy in a pendulum

The pendulum example in section 11.1 states:

Evaluating the time derivative of the energy reveals:
dE/dt = −b(θ')^2

My apologies if it's obvious, but where did this come from? If energy of the simple pendulum as a function of time was derived elsewhere in the book, maybe it would be good to add a reference to it from this example.

Consider a notation change to support output feedback

Throughout the notes I use xdot = f(x,u) for the state-space dynamics, and g(x,u) for the running cost in optimal control. And then the few times I use output so far in the notes, I use y=h(x,u). This is not so uncommon (https://en.wikipedia.org/wiki/State-space_representation#Nonlinear_systems, https://en.wikipedia.org/wiki/Observability#Nonlinear_case).

But, it would be much more satisfying to have xdot = f(x,u), y = g(x,u). I could switch to e.g. c(x,u) for my running cost -- but would have to touch a lot of places in the text.

Cable-driven robots can be partially underactuated

The simplest example is a one-dimensional cable-driven robot actuated by a single motor that winds a cable the robot hangs from. If the actuator is falling at 1g the motor has at best unidirectional control over the motion. Of course this robot is fairly trivial, but people are building two-dimensional graffiti bots that hang from two cables and can move over a building wall; they suffer the same sort of constraint, and motion planning is nontrivial. More common is to overconstrain such robots; for example to use eight cables for a six-axis robot. I believe this is what is used for coarse positioning of the receiver room of the Chinese radio telescope FAST. These overconstrained systems always operate near but not in the going-slack region (which has a complicated shape), and many of them (okay not FAST) are interesting for rapid motion, since no motors need be moved.

controllability vs fully-actuated

As I can understand, the rank condition is almost the same and they seem to be the same concept.

Could you please correct or approve this?

Question about ../src/lyapunov/cubic_polynomial.py

Hello,

Can anyone help me explain the code of one line inside ../src/lyapunov/cubic_polynomial.py

"prog.AddSosConstraint((V-rho) * x.dot(x) - lambda_ToExpression() * Vdot) "

Why the SOS constraint is like above?

I feel like it should be like " -Vdot - lambda_ToExpression() * ( rho - V ) ". But it will cause some bugs when I tried this expression.

Can you provide more info about how to use SOS optimization to get the ROA?

Thanks!

add macos coverage on CI

circleci now supports mac, but it's not in drake-external-examples yet
drake-external-examples uses travis for macos

either is aok.

Possible mistake or lack of clarity in formula in chapter 2.

In the final few paragraphs of chapter 2: a feedback linearization solution to stabilize pendulum in vertical position is presented. u = 2gcos(theta)/l. It is not clear how this input policy will stabilize the pendulum at theta = pi. Maybe the intended formula was u' = 2gcos(theta/2)/l?

Minor typo in 1.3: 'cos' should be 'sin'

Shouldn't the cos in chapter 1 section 3 "Feedback-Cancellation Double Pendulum" example be sin ..?

Line 874
\begin{align*} \ddot \theta_1 &= -\frac{g}{l}\sin\theta_1 -b\dot\theta_1 \\

Line 879
{\bf M}\begin{bmatrix} -\frac{g}{l}s_1 - b\dot{q}_1 \\ 0 \end{bmatrix}

In the "as_single_pendulum.py" example it's

# Cancel double pend dynamics and inject single pend dynamics.

torque[:] = Cv - tauG + \
           M.dot([-self.g / length * sin(q[0]) - b * v[0],
           -kp * q[1] + kd * v[1]])

Issues during native Mac install via binaries

Would have just made PR for first issue but not sure if this was particular to something on my system

Following instructions here

Issue 1

Needed this:

export PYTHONPATH=/opt/drake/lib/python2.7/site-packages:${PYTHONPATH}

instead of

export PYTHONPATH=/opt/drake/install/lib/python2.7/site-packages:${PYTHONPATH}

(don't have a /opt/drake/install)

Issue 2

Petes-MacBook-Pro:russdrake pflomacpro$ python -c 'import pydrake; print(pydrake.__file__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/drake/lib/python2.7/site-packages/pydrake/__init__.py", line 8, in <module>
    from . import common
  File "/opt/drake/lib/python2.7/site-packages/pydrake/common.py", line 3, in <module>
    from ._common_py import *
ImportError: dlopen(/opt/drake/lib/python2.7/site-packages/pydrake/_common_py.so, 2): Library not loaded: /usr/local/opt/[email protected]/lib/libvtkFiltersSources-8.0.1.dylib
  Referenced from: /opt/drake/lib/python2.7/site-packages/pydrake/_common_py.so
  Reason: image not found

Looks like vtk issues (maybe is finding a different vtk I have?)

matplotlib visualizer complaints

Not sure where visualizer development is at but getting these:

/usr/lib/python2.7/dist-packages/matplotlib/figure.py:397: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "

Running the block of code twice makes the warning go away, and displays a static image

Quick look around suggests there are fixes for this warning: rasterio/rasterio#686

Problem when using SOS to do lyapunov analysis

Hello, I wanna use SOS to do the lyapunov analysis of the simple pendulum. There's no bug for my code but I got V = 0 and lambda = 0 which indicates obviously that something goes wrong. Can you help me have a look at my code?

I just followed the following formulation to find the V.
screen shot 2018-09-26 at 1 14 54 pm

import math
import numpy as np

from pydrake.all import (Jacobian, MathematicalProgram, SolutionResult,
                         Variables)


def dynamics(x):
    return [x[1]*x[2], -x[0]*x[2], -(x[2] + 9.81*x[0])]


prog = MathematicalProgram()
x = prog.NewIndeterminates(3, "x")

# Define the Lyapunov function.
(V, constraint1) = prog.NewSosPolynomial(Variables(x), 2)
Vdot = Jacobian([V.ToExpression()], x).dot(dynamics(x))[0]

# Define the Lagrange multipliers.
(lambda_, constraint2) = prog.NewSosPolynomial(Variables(x), 4)

prog.AddSosConstraint(-Vdot - lambda_.ToExpression()*(pow(x[0],2) + pow(x[1],2) - 1))

result = prog.Solve()

assert(result == SolutionResult.kSolutionFound)

print(prog.SubstituteSolution(V.ToExpression()))
print(prog.SubstituteSolution(lambda_.ToExpression()))

Originally posted by @Jingwen-Zhang-Aaron in #145 (comment)

enable support for cross-chapter references in chapter-only display

used to work by rendering everything with mathjax (but that was slow). now that I render only the displayed chapter, the cross-references break. ideally i'd be able to process, but not render the hidden chapters. presumably i could insert commands to link to different chapter displays, too.

i also want to facilitate cross-chapter references in the non-math text, too.

simple_continuous_time_system fails to build on mac

@jamiesnape

I've verified that this is also true on shambhala/drake_cmake_installed (I get the same errors):

[ 50%] Building CXX object src/CMakeFiles/simple_continuous_time_system.dir/simple_continuous_time_system.cc.o
In file included from /Users/russt/underactuated/src/simple_continuous_time_system.cc:9:
In file included from /Users/russt/drake-build/install/include/drake/systems/analysis/simulator.h:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:635:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iterator:417:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:90:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h:119:
In file included from /usr/include/wchar.h:91:
In file included from /Users/russt/drake-build/install/include/fmt/time.h:13:
In file included from /Users/russt/drake-build/install/include/fmt/format.h:38:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:83:32: error: unknown type name 'string'
    explicit logic_error(const string&);
                               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:100:34: error: unknown type name 'string'
    explicit runtime_error(const string&);
                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:115:59: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
                                                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:125:63: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
                                                              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:135:59: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
                                                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:145:59: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
                                                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:155:58: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
                                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:165:61: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
                                                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdexcept:175:62: error: unknown type name 'string'
    _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
                                                             ^

set_1: RunPendulumSimulation does not log initial condition

In the problem assignment, when plotting, x(t = 0) is shown as [0, 0], rather than [1, 0] (from logger.get_data()).
This can be solved by setting the initial state on the simulator's context before running initialization. One way would be to change the code to:

# Set the initial conditions for the simulation.
context = diagram.CreateDefaultContext()
state = context.get_mutable_continuous_state_vector()
state.SetFromVector(x0)

# Create the simulator.
simulator = Simulator(diagram, context)

\cc @peteflorence @gizatt

planar_rigid_body_visualizer edgecolor is not visible

For the purely grey double pendulum, it makes for a pretty visually unappealing render. Everything looks much sharper with the black edge.

I see you've set edgecolor='k', but it's not working (at least not on my machine... though the pendulum works fine). i spent a minute looking at it, but @gizatt would appreciate if you could take this one.

interactive slider pendulum/torque_slider_demo.py

It works for me by adding this at the top:
from pylab import *

and replacing simulator.StepTo(args.duration) with

plt.pause(0.1)
for i in range(1000000):
	plt.pause(0.000000001)
	simulator.StepTo(i)

It's not a good solution, but from my understanding is that simulator is a C++ code and I don't understand how it would interactively updated from mathplotlib?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.