IMO, in order to get smooth motion from servos you need to set the position of each servo every 20ms (50Hz).
I posted some joystick servo code here. Reply #23 of the thread has links to videos showing the code in use.
The above joystick/servo project has been my only servo project with the Arduino so far. The code linked above can easily be expanded to multiple servo/joysticks as gyrojeremy demonstrated so nicely with his robot.
I think you’ll want to use a similar approach but rather than using input from joysticks, use your IK calculation results for the servos’ target position.
The joystick code smooths the servo motion by using constant acceleration. Constant acceleration is great for a lot of applications but I’m not sure if you’d want to use this sort of algorithm for your hexapod servos.
In my hexapod, I calculated the position where each foot should be positioned and then calculated the IK positions based on these foot positions. The algorithm determining the foot position moved the foot in a linear manner but in order to produce linear motion at the feet of the hexapod, the various servos in the leg had to move in a sinusoidal manner. Calculating servo positions this way is pretty computationally intensive and I’m not sure if an 8-bit Arduino could make the needed calculations at 50Hz. I think one of the faster Arduinos could do this.
An alternative to calculating the full IK positions at 50Hz is to only calculate the servo positions for the foot’s start and end positions. Rather than having the foot move in a linear manner, you could have the servos move in a linearly between the initial and final positions.
If you move the servos linearly as described, you’ll likely end up with the feet of the hexapod sliding a bit since the linear servo movement wouldn’t produce linear movement at the feet. I doubt this sliding motion would be very significant and it would save a lot of calculations. I’ve only read through a few other hexapod programs other than my own and this computational shortcut appears to be a common method of dealing with moving the servos in a hexapod.
I know there’s a servo library which allows you to set the speed of a servo, but it seems to me you might as well calculate the linear motion yourself and issue servo “writeMicroseconds” commands at 50Hz. Though I’m probably suggesting this since I have used this other servo library myself. It’s likely this other library might work just fine.
As I think about this (using the alternate servo library (I don’t recall the name)) a bit more I realize I have another reason why I want to set the servo positions myself at 50Hz. My setting the servo positions myself, I know exactly where the servos are all the time. I think this would be useful when responding to input either from a remote control or from sensors.