Following from the previous post, the Inverse Kinematics (IK) have been calculated, just in time for the test rig hardware, which is arriving this week.
I found a geometrical solution to the IK by breaking the 3D problem down into two 2D problems:
Looking at the leg from the back/front, only joints 1 & 5 determine the offset along the world Y axis. The joints are equalised so that the foot is always facing perpendicular to the ground.
Looking at the leg sideways, the rest of the joints 2, 3 & 4 are calculated using mostly acos/atan2 functions. Note that the leg link lengths need to be projected onto the z-plane, which is why the a2p, a3p etc. notation is used.
The test program now has controls for positioning a target for the foot to follow, based on the IK. This was very helpful for testing and debugging. A test function was also added which simply moves the target in an elliptical motion for the foot to follow. It is a very simple way of making the leg walk, but could be used as the foundation for a simply four-legged walking gait.
The next tasks are to build the physical test rig, learn how to use the Arbotix controller and port the IK code to Arduino.
The kinematics are written in Python/TKInter, and code can be found on GitHub.
The geometrical drawings were made using the browser-based GeoGebra app.