16-264: Humanoids: Assignment 3: Control

The point of this assignment is to:

This assignment involves designing control laws and choosing gains for a one legged hopping robot. Google "raibert one legged hopper" for more information on this type of robot. This assignment has three parts to help you incrementally build different parts of the controller.

Part 1: Height control: The Matlab software part1.zip has been designed to allow you to focus on designing control of hopping height. The function simulate.m only allows vertical movement. You need to modify the function control.m at the point where it says:

  % SET rest_leg_length TO ADD ENERGY
so that the hopper hops at the desired height (approximately). You should be able to set (in main.m)
height_desired = 0.6;
to values between 0.6 and 1.0 and have the hopping height vary accordingly.

Part 2: Leg control: The Matlab software part2.zip has been designed to allow you to focus on designing control of the leg. The function simulate.m has been modified to hang the hopper in the air. You need to modify the gains

hip_air_k = 10;
hip_air_b = 1;
in the function control.m so that the leg swings quickly without oscillation to the leg_angle_desired target in less than 0.3s.

Part 3: Full control: The Matlab software part3.zip has the full simulator (simulate.m). You need to write a control.m function based on part1 and part2 that does height control and leg control. You need to add body angle control (setting the gains hip_grnd_k and hip_grnd_b). You also need to figure out how control forward speed by choosing the leg angle at touchdown. You should be able to set (in main.m)

speed_desired = 1.0;
between 0 and 1 and have the forward speed vary accordingly.

How to run the code

When you start up matlab, type

To run a simulation, type


Look at notes.txt for examples of how to plot data.

What to turn in?

You can work in groups or alone. Create a web page describing what you did and email the URL to the professor (one web page per group). For this assignment I prefer you use Matlab. Include links to your source and any compiled code in either .zip, .tar, or .tar.gz format on the web page. Be sure to list the names of all the members of your group. 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?


Please provide plots of the hopper behavior that indicate that you have successfully controlled the hopper.

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 class videos.


Our main question is that do we only have to change the hip_grnd_k and
hip_grnd_b values and not change our values from parts 1 and 2?  Or do we
have to tune hip_air_k and hip_air_b again?

It is possible but unlikely that you would have to change values you set in part 1 and 2.

We are unsure of where
to exactly start for controlling the leg angle.  It seems we are going in
circles trying to figure out how leg angle, body angle, etc. play into
affecting forward speed.  Thank you in advance.

2) Remember from class:
a) to hop at a velocity v, you have to put the foot out the appropriate amount during the bounce. At the beginning of the bounce, the foot is ahead a distance d. At the end of the bounce, it should be behind you roughly the same distance d. The bounce takes T time. What should d be?
b) and then you need to stabilize control of forward speed with a feedback controller on velocity.

Looking on the web, I see the appropriate formulas on page 692 of this paper.

    I am pretty sure I have the correct equations and/or method in
figuring out the leg angle at touchdown, but now I am having trouble
figuring out how to implement those equations into the control
function. Should I replace the leg_angle_desired variables with my
function or just use the leg_angle variable, or do something else. I
tried playing around with the first two options, but didn't get any
good results.

My intent was that you set leg_angle_desired when in the air.

The code

  if bitget( floor( time ), 1 )
   leg_angle_desired = 0.5;
   leg_angle_desired = -0.5;
in part 2 was only to move the leg to test the servo. It should be replaced by
leg_angle_desired = your-control-law