Closed kallaspriit closed 2 years ago
I tried to implement a safety logic for switching between different modes (e.g., from velocity control to position control). The state should not jump. So the target is set to the current state when mode switch. If you start the node using velocity control, the initial speed will be set to the speed state reading from odrive. I will check this logic again to see if there are any problems.
I guess when the process is killed mid-operation, the input_vel
in ODrive remains whatever the last value was. Using this speed at startup (instead of initializing it to zero) is what's causing the problem because for as long as new requested speed is not received, this old value is used and the robot starts moving for a second or so until it initializes properly.
I made a mistake. There's no need to enter closed loop control state in start process. This is done in command mode switch process. So the correct command is set before entering closed loop control.
When I kill the odrive_ros2_control node while the motor speeds are not zero, the motors nicely stop because of the watchdog. But the next time I start the process again, the motors begin to spin at the last set speed during startup until a new speed command is received (which is not great for safety).
I'm guessing that at startup the library starts to feed the watchdog so last used speed is restored before zero speed is set again?
Could you set the requested speed to zero before starting the watchdog?