# E91 Assignment 7

### Task: Don't step on the cracks!

This week, you will create code to make your robot walk forward while avoiding "cracks in the sidewalk."

The horizontal position of the ith crack in meters is given by the equation

$x i = i + 0.5 sin ( 0.93 i π ) - 0.5$

Your code should generate a sequence of foot positions for the left and right foot that avoids the cracks, and which does not go beyond an allowable max step distance.

Next, you should generate a schedule for the footsteps, along with a ZMP reference trajectory that moves the robot's ZMP above each supporting foot as the robot moves.

Finally, you should generate smooth trajectories for each foot which move them into position, and run comIK with the output of the ZMP controller and the foot positions.

Your code should generate sufficient walking behavior walk from the origin at zero meters, past crack # 20 at approximately 20 meters.

### Troubleshooting/hints

If things aren't working:
• At first don't worry about the cracks -- just try to execute a regular (periodic) gait.
• Visualize everything you can!
• Don't forget lab help hours.
• The cycloid might be a nice primitive to generate trajectories for your swing foot.
• If you need to scroll the display to the left by an amount cx, you can wrap your draw function in this code:
```glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glTranslated(-cx, 0, 0)

##################################################
# insert the rest of your draw function here
##################################################

glPopMatrix()
glutSwapBuffers()
```