Watchdog Timer Reset after Trigger

Hey guys,
we recently bought two ODrive 3.6. We control them over USB with the python API. I have activated the watchdog timer feature, where I set an timeout to 0.5 seconds. Also I am feeding the watchdog timer over drive.axis0.watchdog_feed(). Everything is working fine, but when I stop my python program, the watchdog timer is triggered and the motors stop spinning. This is also fine, but if I restart my python program, the watchdog timer does not reset, even if I feed it with drive.axis0.watchdog_feed(). So it wont let me control the motors until I reboot the ODrive. Is there a function or something, that I can reset the watchdog timer? I dont want to restart the odrive each time, I restart my python program.
Also it would be great to specify the action, that is executed when the watchdog timer gets triggered. In the moment, the ODrive just disables the motors, but it would be better to stop the motors, so my robot doesnt crash into something.

I hope, someone can help me with this. Thanks in advance!

Marc

You have to reset the errors by writing 0’s to the .error fields. dump_errors(odrv0, True) will do it quickly. Then you have to put the motor back into CLOSED_LOOP_CONTROL mode.

1 Like

Thanks, writing 0’s to the .error field did the job! But I couldnt find the function dump_errors in the python library. Anyway the problem is solved, thanks!

Is there an option to specify the action that is applied when the Watchdog timer gets triggered? For example that the motors break instead of just cut the power off. Our robot weighs around 40kg, so when it is on full speed and the program crashes for some reason, it would be better to stop the robot :smiley:. Otherwise it will crash into something (or someone :confused: ).

Thanks for your help!

Not currently. Good idea, though.

2 Likes

I think you’ll find you can use the function dump_errors() after adding this import:
from odrive.utils import *

as I found in this post

1 Like

Has there been any progress on this? Is there no way for the odrive to automatically detect when it receives watchdog signals again?

Is there any way of keeping the odrive in closed loop control but velocity 0? Would like to avoid having to put the odrive back into closed loop control. Do I do this using axis.requested_state?

That’s dangerous, don’t do this. Imagine you’re streaming velocity commands, the comms drop out for a minute so velocity goes to zero, and then suddenly they start going again and the drive suddenly starts moving. That’s an injury waiting to happen.

Yeah I understand that. In my application when the communication is reestablished the velocity commands would always be 0. But my main problem right now is when I turn on my robot, the odrives turn on immediately and time out before my main computer has booted up and running my scripts (which send the watchdog signal). So I was trying to figure out how to reset the odrives to closed loop control once my script is running? But I’m struggling with that.

I’m trying to set the errors = 0 and the set the request state = 8 when my script starts but it doesn’t seem to do anything. Is there anyway of telling the watchdog to wait until it receives the first signal?

Oh. Setting all the errors = 0 and requested_state = 8 should work fine. I’ll check to see if there’s a separate watchdog reset you need to use

Yeah finally got it working with the above! It wasn’t working before because I was following this sequence:

-> set errors to 0
-> set to closed loop control
-> send watchdog

and maybe the watchdog was timing out again before receiving the first watchdog trigger.

I changed it to this and now it works:
-> send watchdog
-> set errors to 0
-> set to closed loop control (requested sate = 8)
-> send watchdog

1 Like