This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here.
Having decided that the graduated servo positioning method was the way to go to allow for leg sensors to work correctly I started thinking about leg sensors.
Here’s a new lower leg with three switches, one on the foot, one to the inside of the leg and one to the outside of the leg.
Ideally the front and back switches would be extended with thin metal bars running the length of the leg and fixed just above the ankle. There should also be two more switches to spot obstructions to the left and right. This would give feedback on the full range of motion of the lower leg.
For now, three switches are enough. The foot switch can detect if we’re touching the ground and the other two can be used to ensure that we cater for multiple switches per leg (I can see we’ll need to multiplex these into whatever chip we have dealing with the sensors or we’ll need 30 inputs just for a set of 5 switch legs).
The next thing to do is to move the ‘fine control of movement’ code out of the Windows Leg Controller app and into the Arduino. The Windows app will then send the required end servo positions to the Arduino which will deal with breaking this down into a sequence of moves and send those to the servo controller whilst monitoring the switches. If a switch triggers then we can stop straight away. If we get to the end and the foot switch hasn’t triggered then we know that the leg isn’t grounded…
Meanwhile the Leg Controller can be adjusted to deal with the inverse kinematics issues so that we can initially feed into the GUI to move the foot to X,Y,Z and have it calculate the appropriate servo angles required.