Stop a smart motor quickly

There are three stop modes: COAST, BRAKE, and HOLD. Which one should be used in order to stop a motor quickly? So far it seems that none of them works. Thanks.

Coast well allow the motor to continue spinning slowly until it reaches a stop. Brake and hold both actively try to stop the motor. In the case of hold, the motor will try to restore the position to where it was stopped if it encounters a force acting against it, while brake will only try to prevent movement.
To make the brake mode work, the motor should also have its velocity set to zero in addition to the brake mode being set.

Thanks for your reply. Using BRAKE and setting velocity to 0% does not work well. It takes more than 3 seconds to stop completely.

What are you expecting ? motors take time to stop, especially if used on a drivetrain with a heavy robot.


Good question, Certainly I would like it to stop within a second, which may not be realistic though.

If the velocity is set to be negative, will that help it stop? Thanks

If you just say motor.stop(brake) (or just motor.stop() if you have it already set to brake before) then it should just stop in that place. This is what I always use and it works perfectly. There is no need to set the velocity to 0 if the stop command occurs after a motor move command stops. Example:

// motor setups
motor.setVelocity(100, rpm);
// spin the motor 10 turns forward
motor.spinFor(forward, 10, turns);
// once the motor is done doing its task it will continue

(This is written in C++, but can easily be translated to blocks or python…)

Hope this helps!

- Henry 344E

Thanks for sharing the example. I guess it depends on the actual velocity. Like a car, it cannot stop all of sudden.

1 Like

if you want to stop very fast, you may need a counter spin on the motors. the way I would set up a drivetrain is to have the motors on coast (this is a matter of personal driving preference, you could set it to brake or hold) and have a button that acts as a brake. when this button is pressed, the motors would turn in the opposite direction (say, half of a rotation) to try to counteract the momentum of your bot. or another thing I have seen that you could try is a pneumatic braking system.

1 Like

They are two good ideas. If we apply counter spins too often, will that damage the motor?

it depends, if it is a lower gear ratio (red cartridge) it should be fine, a higher gear ratio (blue cartridge) could damage the motor. I believe the motors should be fine because you have the combined stopping power of all of your drive motors. I do not know how much aggressive switching a motor can take, but there is only really one way to find out