jcchurch13 / Mechaduino-Firmware

Hardware available here:
http://tropical-labs.com
Other
389 stars 232 forks source link

Hold current position when closed loop is engaged. #32

Closed osresearch closed 6 years ago

osresearch commented 6 years ago

This also correctly computes the current angle using the lookup table, rather than having an approximation of the encoder value.

osresearch commented 6 years ago

I realized belatedly that this should probably use the wrapped y position; if the motor has been turned more than 360 degrees when closed loop is enabled it will unwind to the single-turn position.

I'm working on a patch that has the timer interrupt running constantly so that the yw value is always valid. This will prevent this unexpected behaviour.