Not Enough Processing Power?

Hello all,

I wrote my own inverse kinematics controller for Hexy in C++, but I just can’t seem to get it to run faster than 120 ms per frame. I doubt it is the program itself, it won’t get much faster (and I based it on a Python example, the author of which got their Hexy running super smoothly). What could I be missing?

Thank you for any help you can offer!

I narrowed it down, most processing time is spent on Servotor32::changeServo(…). Why is this function only slow in my program, but not when it is used by PoMoCo?

Can’t help much without the code.

Here you go: https://sourceforge.net/projects/hexyik/?source=navbar

Damn, someone got fancy. Quaternions and everything! I’m guessing using 32-bit floats all over the place on an 8-bit processor with no hardware float isn’t helping.

The time spent in changeServo is probably it pausing while it waits for the servo signals to stop updating before updating the servo signal registers. The processor is busy something like 3/5ths of the time just sending all the signals all the servos need.

So, is there no solution? Spending over 100ms just to update the servos just seems nuts to me. So, even if I have a Raspberry Pi do the processing, it still will be too slow. The inverse kinematics take around 30ms, which isn’t quite as ridiculous but still quite a lot.

Edit: I want to try to modify Servotor32 to update all servos at once, interleaving all the delays. Perhaps this can help.
Edit2: Barely helped :frowning:

I 3D printed a quadruped and ran it off an Arduino Nano, it runs much much more smoothly than Servotor. Sure, it has two legs less, but still it is so incredible smooth. Is the processor of the Nano that much faster, or is there something in the Servotor code that is slowing down my Hexy?