MB3hel / AUVControlBoard

Vectored 6-DOF motion controller for AUVs.
https://mb3hel.github.io/AUVControlBoard/
1 stars 2 forks source link

[BUG] Reset with newer firmware #22

Closed MB3hel closed 1 year ago

MB3hel commented 1 year ago

Describe the bug

Tested Versions v1, v2

Impacted Versions v1, v2

To Reproduce

  1. Build release for v1 or v2
  2. Run the sensordata.py script
  3. Run the sassist.py script
  4. Wait a few seconds
  5. Hit enter to end sassist.py
  6. Repeat steps 2-5 until the system resets (indicated by LED going back to yellow = RAW mode)

Expected behavior No system reset; deadlock does not occur.

MB3hel commented 1 year ago

Deadlocks due to mval being nan causing this to be an infinite loop. Not sure why this becomes nan. Located in motor_control.c in mc_set_local image

MB3hel commented 1 year ago

Caused by check failure in cmdctrl.c's cmdctrl_apply_saved_speed. If the IMU data returns zero (as it does after axis configure), this is passed to mc_set_global. The newer implementation of mc_set_global will result in nans being passed to mc_set_local in this scenario due to the invalid quaternion.

This is fixed by checking valid sensor data in cmdctrl_apply_saved_speed before calling mc_set_global, mc_set_sassist, or mc_set_dhold