Once we can control the position of the foot, we can make it follow a trajectory. One cycle through the trajectory is a simple step.
A step has two distinct phases, a ground and a flight phase. During ground phase the leg push the body forward, during the flight phase the foot is lifted and placed ahead of its previous contact point.
The trajectory is constructed as a list of points in space. So we need to generate points along a straight line for our ground phase, and points along an arc for our flight phase.
The number of points in a given path is specified by a “granularity” variable. With cheap servos, there is no need to generate a lot of points. Same goes for implementing any type of “easing“, so we keep it simple and linear.
The geometry of the trajectory can be edited. This is going to be useful when implementing steering. To turn slightly to one side or another, the two legs on one side can take wider steps than the two other legs.
Once again I use processing to test a simple trajectory implementation.
You can download the sketch from the repository (https://github.com/Traverso/Felix/tree/master/Processing/Trajectory), and play with the step width and height, and the offset of the step in relation to the position of the hip.
I wanted to upload this sketch to jsFiddle as well so you could play with it directly in your browser, but as this sites motto says “in theory there is no difference…”.
I couldn’t get the sketch to work on the browser as it is and I currently don’t have the time to do the necessary tweaks.
Anyway if you haven’t downloaded Processing yet, is about time.