RAM RAM I need more RAM!!

Jim, when you're making structures, etc, that store and use data.. don't you count the bytes required for the data?

And if there's 18 servo boards then use [18] or a realistic maximum instead of [255] for that array.

All floating point on Arduino is 32-bit no matter float or double. If you can switch the sections that use FP to use 16 or 32-bit integer then you will gain speed and possibly save on ram. A 16-bit integer is good for +/- 4 digits or unsigned, 5 digits. Where the decimal place is makes it flexible; if I want fractions of a kilogram then I weigh -integer- grams, not -fp- .001 kg's. 16 bits for 4 or 5 places is pretty good. Back in the ages BC (Before Calculators), 3 or 4 places was deemed good for most classwork. And I see you use it on robot insect leg joints. How precise do you need?

Tables should be made in PROGMEM to hold pre-calculated values, trig, sqrt, that FP functions supplied except for integers -- table them up in PROGMEM, lookup there will be faster than using FP but slower than ram. But you have no choice unless you go to a bigger MCU.

Man, that 1284 has gotta be looking real good about now.....