This is an overview of my approach to implement a static gait for Felix. I’ll be explaining the needed concepts in a series of posts, but if you want to speed things up you can grab all the Arduino sketches from my repo (https://github.com/Traverso/Felix/tree/master/ARDUINO).
Felix is a four legged robot, each leg has two actuators. To control the position of the feet, I need to provide a rotation angle to the servos controlling the hip and the knee of each leg. But thinking in terms of rotation angles is too complicated, it could be much easier if we could set the angles according to where we want to position the feet.
To do that we can use inverse kinematics. Calculating the inverse kinematics for complex systems can be quite daunting, but in our case we have a simple planar two link setup, so we can use basic law of cosines and Pythagoras to calculate the two angles.
Even though Felix legs consists of three links, we can still consider it a two link system, because due to the parallel linkage constraining the pastern, the relation between the endpoint of the shin (the hock in dog anatomy) and the foot is one of relative displacement.
There are a number of references on the web explaining inverse kinematics for this type of systems:
When trying to understand this method I spend some time implementing it in Processing.
Processing is great for this sort of thing because you can quickly “see” if your calculation is working. Processing shares some common ground with Arduino, so it’s relative easy to move code between the two systems. In my repo you can find a simple Processing sketch implementing a simple IK solver for two links (https://github.com/Traverso/Felix/tree/master/Processing/InverseKinematics).
If you prefer to play with the same sketch online, you can do it here: