Setting Motor Timeout

I saw there is a function for setting motor timeout, it sounds rather useful since a couple of times in competitions the robot moves forward, then backups the “same amount” but ends up hitting the wall and the encoders still have not reached the correct position and the programs gets “stuck” since it can’t go more backward. I imagine that this functions interrupts the motor after the setup amount of time if the motor has not reached the “proper position” and the program just continues with the next instruction.

The question would be, if you set the motor timeout to 1 second, will it apply the timeout to all movement functions on that motor? If yes, how to I unset the timeout when we don’t want to use it anymore?

1 Like

Here’s the function in case anyone’s wondering. I can’t believe I missed this, it seems really useful for some scenarios if something goes wrong.

1 Like

Hello - I was wondering if either had come to a conclusion re:motor timeouts

Reason being we, by default, set all of our motor timeouts to 3 seconds. In a match last Sat the robot was stalled during a blocking movement at the beginning of usercontrol.

The robot just stayed there for the whole match and ended up burning-out the Brain’s motor port.

Like the OP, I was under the impression once a timeout is met the blocking command is terminated. The API simply says the motor will ‘stop’ - like it wasn’t already :slight_smile:

If this isn’t the case is there a generic code we can use to ‘break’ a locked-up blocking command?

1 Like

You could make it not blocking and then break a while loop that was preventing the command from being overridden