This assignment explores developing control systems for a hopper and a walker.
We are distributing matlab code for the hopper and walker simulations. It is easy to convert these to other languages (C or Fortran, for example) if your prefer. You can also explore implementing a simulation in ODE or OpenSim. Constants that your should treat as fixed are mass = 1.0 and g = 9.81. All other parameters are adjustable by you.
We are going to explore two optimization criteria:
Optimize efficiency by minimizing leg forces per distance travelled. For the hopper, measure the sum/integral of the leg force squared divided by the distance travelled: sum( f_leg^2 )/distance. Measure this quantity for approximately a distance 10 times the average height of the hopper body off the ground. For the walker, combine the sum/integral of each leg force squared, and then divide by the distance travelled: sum( f_leg_left^2 + f_leg_right^2 )/distance. Measure this quantity for approximately a distance 10 times the average height of the walker body off the ground. We should have a discussion as to whether minimizing this criteria actually optimizes efficiency.
Maximizing robustness. There are several kind of robustness to consider.
Part 1: Calculate efficiency for the example controllers given above for hopping and walking.
Part 2: Optimize efficiency: Optimize efficiency by minimizing the formula given above. Start with a body velocity of 0.1 "leg length"/second, where leg length is the average height of the body. One way to do this is to just tune the parameters of the example controllers by hand or by using optimization code. Another way is to write your own controller with its own parameters, or by commanding leg forces directly.
Part 2a: Optimize efficiency for the hopper.
Part 2b: Optimize efficiency for the walker.
Part 3: Maximize Robustness: One way to do this is to just tune the parameters of the example controllers by hand or by using optimization code. Another way is to write your own controller with its own parameters, or by commanding leg forces directly. The body must move on average at least 1 "leg length" per second for 10 leg lengths, where leg length is the average height of the body.
Part 3a: Maximize robustness for the hopper.
Part 3b: Maximize robustness for the walker.
You can use any type of computer/OS/language you want. You can work in groups or alone.
A1: Well, we are going to have to rely on your aesthetic judgment. The hopper should remain a one legged robot. It should have an aerial phase. You could make it really big or really small. You could move or add mass to the leg or foot, but the total mass cannot be reduced below 1. It should only touch the ground with the foot. The walker should remain a two legged robot with no aerial phase. You could make it really big or really small. You could move or add mass to the leg or foot, but the total mass cannot be reduced below 1. It should only touch the ground with the feet. If you friends don't recognize it a hopper and a walker, you have probably gone too far.
Q2: It seems like the way to be "most efficient" according to your definition is to move really fast, starting with an infinite initial velocity.
A2: Okay, we have now specified an initial body velocity: 0.1 leg length/second, where leg length is the average height of the body.
Q3: You talked about maximizing efficiency, but you seem to want to minimize the formula you specified. What's up with that?
A3: Okay, we have reworded the assignment to be a little clearer. The score function is a crude measure of energy/fuel used and should be minimized (like golf, a lower score is better).
Q4: Is maximizing robustness of this system under the assumption of maximum efficiency or something else?
A4: Very good question. Perhaps the most robust system is the system that does nothing. So we need to specify some performance threshold. Let's use: the body must move at least 1 "leg length" per second for 10 leg lengths, where leg length is the average height of the body. Efficiency is not considered. In fact, often efficiency and robustness are in conflict.
Q5: Are the adjustable variables only in the Control*.m? Can the k, b change to other values? If yes, can they be changed dynamically, i.e. changed with time?
A5: There are severals ways you can approach this problem. a) Only vary parameters in the Control*.m files. b) Also vary other parameters, as long as mass=1 and gravity=9.81.
Q6: In the efficiency measure, when you're talking about distance, is that straight line distance from the start of the simulation to the end, or the summed up distance between all the hops?
A6: Straight line start to end.
Q7: I was going through the examples right now and I found something that doesn't look right in the hopper (control4.m). You say there is a smooth push-off force on the spring, but in the code you only change the free length once every hop, when the exit condition of state 1 is met:
[... control4.m ...] elseif ( control_state == 1 ) % landing if ( yd > 0 ) l0 = l0_extended + l0_gain*(y - y_bottom); control_state = 2; %taking off, this must happen end elseif ( control_state == 2 ) % taking off if ( f_leg < f_leg_zero_threshold ) l0 = l0_retracted; control_state = 0; % now in air. end
Shouldn't L0 be changed at every step while taking off? It would make more sense that way (and it jumps about 3 times more).
A7: The way this code works is that l0 is changed once and then stays changed until liftoff.
Q8: When calculating the score for the assignment, should we normalize somehow by the amount of steps/time? Or is the number of steps fixed?
A7: No. We want to be able to compare wheeled vehicles and legged vehicles. The formula is already normalized by distance. Do not normalize by number of steps (or you will end up taking very small or very big steps).