CMU RI 16-745: Dynamic Optimization: Assignment 2

This assignment explores trajectory optimization.

I would like you to optimize a sit to stand transition for a three link model of the DRC robot. The trajectory begins just as the robot is lifting off the chair, and ends when the robot is standing up straight. The model has an ankle, knee, and hip joint. The ankle joint can do +/-100Nm, and the other joints can do +/-400Nm. As we will discuss in class, one way to get up from a chair is to drive your torso forward while seated, and then drive the torso backwards to lift off the chair. So the starting position will be with the calf vertical (ankle angle should be pi for the inverse dynamics I will give you), and the knee is pi/2. The initial hip position and velocity should be optimized to reduce torques as much as possible during this behavior, and definitely below the torque limits.

The robot inverse dynamics are given in the example code below. The robot parameters are:

  double m1 = 11.0;
  double m2 = 18.5;
  double m3 = 111.1;
  double l1cm = 0.235;
  double l2cm = 0.1640;
  double l3cm = 0.3929;
  double l1 = 0.422;
  double l2 = 0.374;
  double I1 = 0.152; /* Icom */
  double I2 = 0.18; /* Icom */
  double I3 = 7.67; /* Icom */
COM locations: l1cm is measured from the ankle, l2cm is measured from the knee, and l3cm is measured from the hip.

You may use Matlab to do this, but I suggest using SNOPT. Here is an example of a SNOPT based trajectory optimization. A three joint pendulum is swung up from the stable position to the upright unstable position. The trajectory is parameterized by Hermite 5th order splines. Use SNOPT or optimization code you can find on the web as the optimizer. We have a site license for SNOPT in the Robotics Insitute, so don't distribute it to others. The manual is available from here. For my most recent installation of SNOPT-7.2-12.2 on a 64bit Linux Ubuntu 12.04 machine, here are my notes:

I installed the gfortran package using the Ubuntu Software Center
The following are done in the directory snopt7
sudo make install
sudo cp ~/snopt7/f2c/src/f2c.h /usr/local/include/
sudo cp ~/snopt7/cexamples/snopt.h /usr/local/include
sudo cp ~/snopt7/cexamples/snfilewrapper.h /usr/local/include
sudo cp ~/snopt7/cexamples/snfilewrapper.o /usr/local/lib
cd /usr/local/include
sudo chmod a+r f2c.h snopt.h snfilewrapper.h
I needed to type to my shell:

Here are some more examples of using SNOPT: example 1 and example 2.

Other constraints

The forces at the ankle should not violate its friction cone (u=1). To check this constraint, we would have to derive a version of the dynamics that computes the forces at the ankle joint. Since I haven't given you that, we will ignore this constraint.

The hip should not go below its starting position.

What to turn in?

You can use any type of computer/OS/language you want. You can work in groups or alone. Generate a web page describing what you did (one per group). Include links to your source and any compiled code in either .zip, .tar, or .tar.gz format. Be sure to list the names of all the members of your group. Mail the URL of your web page to [You complete the address, we are trying to avoid spam.] The writeup is more important than the code. What did you do? Why did it work? What didn't work and why?

Bug Fixes