I’m writing to see if anyone has experience/thoughts on whether you can safely issues software commands (“Sets”) to the Odrive from one thread while querying variables (“Gets”) from a second thread. I’ve been tracking down a watchdog_expired error that I keep getting, and I’m now 99% certain that it’s because I was simultaneously issuing torque-setting commands in one thread while reading the position and velocity in a second thread. The moment that I consolidated all Sets and Gets into a single thread, the error went away. I’ll give some background on my setup:
ODrive v3.6 (56V) running firmware fw-v0.5.1
Communicating over USB to a Raspberry Pi 4B which is running a Python 2.7 program with module version 0.5.1.post0
Two Segway Ninebot motors with Hall Effect sensors
I took most/all noise suppression measures mentioned in the various forums, including adding ferrite torroids on the motor wires, doing twisted-pair Hall Effect wires with caps across their lines on the Odrive board, connecting all GNDs together in a star-pattern per other forums (all GNDs meet at a single point that’s bolted to the metal chassis, including batteries’ GNDs, Odrive’s GND, and RaspberryPi’s GND).
None of these measures helped the watchdog_expired issue. That’s why I started digging to see if maybe I was doing something bad in software.
I’m setting torque like this, “self.OdriveBoardObject.axis0.controller.input_torque = DesiredTorque_NM”
and reading variables like this, “self.Position_Rev_Motor0 = self.OdriveBoardObject.axis0.encoder.pos_estimate”
The reason that I split my Sets from Gets between two threads is that I was displeased at how slowly my loop was running with everything all together (I read other forum posts like this in which they branched to improve that, but it wasn’t tested on Python yet). In did, indeed, speed up my loop a LOT, but it also caused watchdog_expired errors every 10 seconds or so. Here’s my theory: one thread is expecting a certain response from the Odrive and hearing the response meant for the second thread.
p.s. If anyone has updated information on Python-tested branches that increase loop-speed for sending commands/querying variables, that’d be a huge help!