Drivetrain goes forward even when clearly told not to

First things first, I have made this line of code:

image

By itself, it works fine, turning left automatically.

However, when applied as a function in this code:


(the reason why it is defined as a “turn right” code is because those values are then reversed by the velocity function)

If tested in this function, the robot simply goes forward but does not turn. What’s going on?

probably because of

setVelocity has different functionality depending on whether the motor is stopped, when it means set the velocity to be used by the next spin command (with no velocity parameter), however, if the motor has already been told to spin then it means change velocity to a new value.

see this

1 Like