L'Hexapod: Almost there....

Previously published

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.

Work on the latest version of the serial servo controller is going well. I’d accumulated a pile of random nice to have ideas, some of which then necessitated some other ideas, and then there was the one must have command (the one which moves several servos to new positions over time and ensures that they all arrive at their final resting places at the same time). Of course I’ve worked on some of the nice to haves rather than dealing with the final ‘must have’ command that I need before I can move on to writing some gait controlling software to move multiple legs in sequence…

The current software includes the ability to turn off the PWM generation completely and to turn it on again; this is needed so that the ‘save settings to eeprom’ code can work as that requires that we don’t have interrupts enabled. I’ve added the ability to set minimum, maximum and initial positions for all servos. These values can be saved to eeprom so the controller remembers them. I’ve also added the ability to adjust the ‘centre’ position for a servo; you can say that a particular servo is centred at 100 for example, rather than 127 and then talk to it as if you’re moving relative to a 127 centre and the controller will adjust accordingly. There are also three controller configuration options that can adjusted via serial commands and saved to eeprom. The first determines if the PWM generation is turned on after a reboot. If not then you have to turn it on yourself with the appropriate command. The next determines if the controller sends out a ‘get info’ response when it starts after a reset (I figure that this will be useful for downstream processors, if the servo controller is reset these other processors might need to know!). Finally there’s a setting which determines what happens if you try and move a servo beyond the min or max position. By default such a command is considered to be in error and you get an error response. You can change this so that such a command is OK but the command echo indicates that although you tried to move to, say, 201 the limit is 200… I’ve also added a command which resets the controller; mainly for testing at the moment. The get info command for this version returns more information so that you can tell what the state of the various programmable options are.

Now, I really should get on with the ‘move multiple and arrive together’ command…