ncl-ROVers / arduino

Arduino code 2020-21
MIT License
1 stars 0 forks source link

Fix thrusters spinning randomly when stopped #29

Open antoinepetty opened 3 years ago

antoinepetty commented 3 years ago

I think it's a problem with the timing of the Servo library on the Nano 33. Using its native mbed pwm control may solve the problem

example: https://forum.arduino.cc/t/interrupt-latency-problems/656255/4

This would need to be done in the outputs/esc class

antoinepetty commented 3 years ago

Code for reference:

Example using the normal Servo library (current implementation) https://github.com/ncl-ROVers/arduino/blob/master/arduino-main/src/equipment/output/genericEscMotor.cpp (Those constants at the top are dead code and should be removed oops)

Example using the separate servo control board https://github.com/ncl-ROVers/arduino-2019-20/blob/master/arduino-main/src/equipment/output/genericEscMotor.cpp

antoinepetty commented 3 years ago

related pull request: https://github.com/ncl-ROVers/arduino/pull/30

antoinepetty commented 3 years ago

Best solution would be to get the Adafruit Servo Driver as proposed for 2020