# 16-264: Humanoids: Legged Locomotion

The point of this assignment is to explore how to plan and control legged locomotion.

The code below is a simulator that already walks. However, it used forces that are unrealistically large. We are asking you to implement planning and control for 3 of the behaviors listed below. You must keep the joint torques below 100Nm, and not slip (friction coefficient of 1). You must also keep the ratio of the ankle torques divided by the vertical force on the corresponding foot to be below 0.1.

• walk01.zip sets up directory walk and several subdirectories. Look at walk/notes.txt to see what they are. The simulate and control code are in walk/point-feet. To run the simulation type "simulate" in walk/point-feet. To animate a data file type "animate". To plot data look at walk/mrdplot/notes.txt
• ta-walk.zip sets up directory ta-walk and several subdirectories. This is the TA's example of a different kind of walking controller. Google "simbicon" to find out more about it.
• jump.zip has the files for a simple jump, and no landing control. Compare to those in walk01.zip.

## Possible Activities to Implement

Stop walking after 5 steps and stand.

Step over an obstacle you define.

Walk over a pattern of stepping stones.

Walk with small joint torques. Minimize the sum of squared joint torques for a given distance.

Maximize walking speed.

Walk over uneven terrain.

Walk over uneven terrain where the terrain potentially moves when you step on it (rolling boulders, for example).

Standing high jump.

Standing long jump.

Run.

Maximize running speed.

Running high jump.

Running long jump.

Do some other planar gymnastics task.

Add arms to the simulation, and actually pick things up, carry them, and put them down.

Get the simulation to play golf.

Add actual feet to the simulator.

Create a similar 3D simulator.

Double Triple Quadruple Bonus: Solve the DARPA Robotics Challenge:

```1. Drive a utility vehicle at the site.
2. Travel dismounted across rubble.
3. Remove debris blocking an entryway.
4. Open a door and enter a building.
5. Climb an industrial ladder and traverse an industrial walkway.
6. Use a tool to break through a concrete panel.
7. Locate and close a valve near a leaking pipe.
8. Replace a component such as a cooling pump.
```

You can use any type of computer/OS/language/simulation package you want. You can work in groups or alone.

## What to turn in?

• Create a web page describing what you did and email the URL to the Prof. and TA. You choose the format of your writeup. The writeup is more important than the code. What did you do? Why did it work? What didn't work and why? Be sure to list the names of all the members of your group. Include links to your source and any compiled code in either .zip, .tar, or .tar.gz format.
• We encourage you to create and post a YouTube video showing your work. Be sure to put "CMU 16-264" in the text describing the video, so we can search for the videos.

## Some Questions and Answers

How do I compile this stuff for different archtectures?

You all should already have successful ODE installations from the previous assignments.

On 32bit Linux you shouldn't have to do anything. If there seems to be a problem follow the following instructions.

```FOR 64bit LINUX:
You should have the correct libdrawstuff files in /usr/local/lib:
ls -l /usr/local/lib/libdraw*
-rw-rw-r--. 1 cga cga 95530 May 24  2011 /usr/local/lib/libdrawstuff.a
-rw-rw-r--. 1 cga cga   874 May 24  2011 /usr/local/lib/libdrawstuff.la

In Linux the Makefile currently says:
g++ \$(CFLAGS) -o \$@ animate.o dynamics.o \$(LIBS) \$(USEFUL)/drawstuff/libdrawstuff.a \$(XLIBS) -lrt

You can change the above line to:
g++ \$(CFLAGS) -o \$@ animate.o dynamics.o \$(LIBS) /usr/local/lib/libdrawstuff.a \$(XLIBS) -lrt
```

On Windows 32bit you should be fine with the walk/point-feet/drawstuff.dll and the walk/lib directory.

On Windows 64bit you will need to replace drawstuff.dll and walk/lib with whatever you have in your ODE directories in ode/lib
copy ode/lib -> walk/lib
copy drawstuff.dll from the appropriate subdirectory of ode/lib to walk/point-feet/

```> How are the joint angles defined? hip's z axis is pointing out, angle
> defined from vertical down to thigh? knee's z points inward, angle
> from thigh to shank?? how's the ankle angle defined?
```
```I don't find talking about z axes useful, because you still have
to order the joints.

Look at forward_kinematics().

// angles with respect to vertical.
d->athl = ato + ahl;
d->athr = ato + ahr;
d->asl = d->athl - akl;
d->asr = d->athr - akr;

d->aal = d->asl;
d->aar = d->asr;

d->xhead = xh - tol*Sin(ato);

d->xkl = xh + thl*Sin(ahl + ato);

d->xal = d->xkl + sl*Sin(ahl - akl + ato);

It is a floating body with the root at the bottom of the torso.
Assume it is facing towards +x
ato rotates the torso so head moves -x.
ahl rotates the thigh so knee moves +x.
akl rotates the shank so ankle moves -x.
```
Ankle angle is the same as asl, asr (angles of shank with respect to vertical). This means toes down is positive with the shank fixed.