Generic_Timer_method

Is there a generic timer on Odrive or a method to set up the watchdog timer as a generic timer.

I have a TOF (time of flight) sensor on my robot and have set it up to stop with a certain distance of objects. I now want it to back up for a duration, do a pivot away from the object and then continue it’s travel to it’s next obstacle. I would like to keep the robot in the velocity mode for simplicity.

Right now I have Forward, Reverse,Left, Right, Pivot Left, Pivot Right all in velocity mode. I can vary my speed. I also have a constant speed til a tap on Forward or Reverse causes a stop. Hope to set it up similar to a Roomba ; bump turn and go.

Thanks for any ideas.

Hmm, depends how precise you need it to be.

You can use HAL_GetTick at any time to return a value in milliseconds, but that might be too slow for you.

You could instead read the value of the PWM timer from inside a pin-change ISR, but that’s a bit more complicated (setting up a pin-change ISR, and dealing with the fact that the PWM timer resets at a certain value)

Obviously all of the above involves hacking the firmware - there is no way to do this with the stock commands

1 Like