I am trying to run a periodic stress test by cycling an ESC on and off every 20 min. I also need throttle (ideally current control) and I wrote a script. I am not great at coding and I can’t figure out why the entire gui tool crashes. Also I don’t know how to run a certain number of times without using a blocking call.
# length of test and time between tests in minutes length = 20 wait = 20 no_runs = 10 throttle = 64 def run_once(): print('Starting run') # warning beep broadcast(uavcan.equipment.indication.BeepCommand(frequency=500, duration=0.1), interval=0.5, duration=1) node.defer(5, spin) def spin(): node.spin(length*60) def run_test(): print('Starting test') message = uavcan.equipment.esc.RawCommand(cmd=[int(82*throttle), 0, 0, 0]) node.broadcast(message) run_once() periodic((length+wait)*60, run_once)
It crashes when it tries to run node.spin. Any help is appreciated.