open-dynamic-robot-initiative / udriver_firmware

Firmware of the ODRI udriver for either SPI or CAN control.
https://open-dynamic-robot-initiative.github.io/udriver_firmware
7 stars 3 forks source link

Improve the calibration procedure #5

Closed jviereck closed 3 years ago

jviereck commented 3 years ago

This PR replace #4 with a better implementation.

Right now, when the motors get enabled, we calibrate the motors. This takes 5 seconds. This is quite long. It turns out 0.5 seconds is good enough (we might be able to do even less, but I haven't tried). Also, with the old implementation we apply the calibration torque right away at full strength. This causes the joints to shake when they get pulled into the zero position. With this new implementation the calibration current gets linearly interpolated from zero to the full calibration torque over a duration of 0.5 second.

This means, there is 0.5 s of current wramp up and 0.5 second of joint calibration time. Overall, this brings the time needed for the motor calibration from 5 seconds down to 1 second.

In addition, this PR adds code for running a PD controller on the card at startup. This is disabled by default but can be activated by toggling a new #define DEBUG_PD_AT_STARTUP.

jviereck commented 3 years ago

I've tested this on the NYU_Finger robot and it works like a charm.

@luator If you want I can port similar code to the TI firmware as well, once we agree on this code and landed it.

luator commented 3 years ago

Yes, would be great to have this in the CAN version as well (I'm afraid the chance that we will ever manage to merge the two firmware versions back into a common base are rather low :/ )

jviereck commented 3 years ago

@luator do you want to have a second look after the corrected version or can I just merge?

jviereck commented 3 years ago

Yes, would be great to have this in the CAN version as well (I'm afraid the chance that we will ever manage to merge the two firmware versions back into a common base are rather low :/ )

I port it to the CAN version now.