How does braketype::hold work? and thoughts about it

In each vex v5 programming software (pros, vcs, vexcode, rms, etc) there is a way to stop the motors with a brake type. This brake type can be coast, hold, or brake.

Now there is code between each one of these brake types. For coast I believe that it acts just like a regular DC motor where it doesn’t stop when it doesn’t get power sent to it.

However, I am curious as to how the brake and hold braketype work. So what I’ve been noticing is that when you set the motor to braketype hold is that it doesn’t move (clearly) despite the fact that there is a variable amount of load (say a lift vs a drive). Now I would imagine that it might work like a servo where it slowly adjusts the power to get to the desired position. This wouldn’t work very well though for precise movements that robots have to make. So I thought of another alternative. Using something like PID but clearly you would have to adjust those variables based on the load of the output of the motor.

And like even if there is a good system for stopping the motors accurately, efficiently, and reliable then how do you make sure that your motor encoders don’t have any error (which im sure they do).

So I’m finally I guess my question is: Is the built in brake type accurate and reliable enough to trust 100% of the time?

hold does active PID to try to maintain the position: the higher the error the more power it tries to apply to counter the error. “Hold” means exactly that, it will try to hold the motor there. It uses the built-in PID that has been tuned to work for as many different outputs as possible. If it does not work for you, you need to use a custom PID.

brake is passive. It actually shorts the leads of the motor causing it to generate it’s own power making it slow down. However, if you try to turn it, it will (with friction) turn and not try to come back (passive). It is a mechanical brake, slowing down the motor without applying extra power.

coast is passive with no shorting, making it smooth.