Braking and holding

Are you using Cortex or V5? V5 has a “hold” function in its brakeType commands with built-in PID.
As for Cortex, there are most definitely PID tutorials out there that are really helpful. I don’t have any off the top of my head, but I know I’ve seen them.

But holding the wheels still isn’t the only way to brake a robot. You could also theoretically have a deployable pad that presses against the platform that acts as a brake.

Im using V5 and PROS. I couldn’t modify anything with the robot. How to i use the hold function in pros?

As stated, V5 has built in PID to control the hold function. I’m not exactly sure how to call it, as I don’t use PROS. We’d have to get a PROfessional in here to help with that much. (Edit: Yes, I stole that pun.)


ok i will search the pros documentation… Thanks

so i use this code and it actually works.

holdMove = master.get_digital(DIGITAL_Y);
if (holdMove ==true){

(this is in a the infinite loop of the op control)
The problem now is that the force is not strong enough or i don’t know what.
it successfully brakes the wheels after it is stopped.
But, when i turn the wheels, it gives me some resistant force but it doesn’t practically move back to the original position.
What is happening? do i have to edit the pid parameters and how do i do that?

Once again, I don’t use PROS, nor do I know as much about coding as others, but I have another idea.
What if you set up a function ot take the current built-in encoder value, and then have a loop telling the motor to go to that value? It might register any change, and fight against it. (?)
But there’s probably an easier way to do that. Maybe it’s built in and I just don’t know about it.

Sorry I couldn’t be of more help.

@Eden Check out This thread and maybe it’ll help. It seems to be exactly what you’re looking for. If not, maybe @sazrocks can help here.

Thanks alot@Got_a_Screw_Loose

1 Like

This is exactly what setting the brake type to HOLD does when the motor is commanded to stop.

Yes. I knew htat. But what I didn’t know was why it might not have been working, so I decided to come up with a workaround to do it manually. Of course, it’s not needed because the issue was resolved.

Perhaps this thread could help:

1 Like

What if I want to achieve open-loop control and closed-loop control switching?

1 Like

now i tried adding


it stills stays the same.
the proble is still that it will only supply a low resistant when i push it and is not capable to move back to its original positition.
also, it(the small resistant force) cannot be activated when the motor are not moving

for your information, the small resistant disappears after i release the button

It disappears because the code no longer reads the button as pressed, and sets the brake type back to normal. There are ways to make a toggle button, though. I’m not sure what the best way to go about doing it in PROS would be.
Personally, I would be fine with just holding the button. But I can see the superiority of the toggle button.

yes of course i know how to toggle a bool value with a button
that is not the problem

Sorry, I read this as a secondary problem. I don’t really think I’ll be much help on the bigger problem, though. I tried. Sorry I don’t know absolutely everything.

1 Like

Ok guys i actually worked out way to do it.
here is the code:

void holdService(void* param){
if (holdMove){
short absLF = leftFront.get_position();
short absLR = leftRear.get_position();
short absRF = rightFront.get_position();
short absRR = rightRear.get_position();
leftFront = absLF - leftFront.get_position();
leftRear = absLR - leftRear.get_position();
rightFront = absRF - rightFront.get_position();
rightRear = absRR - rightRear.get_position();

(this is a task, it continues running in parallel of other infinite loops)

void opcontrol() {
pros::Task holdservice (holdService, (void*)“PROS”);
bla bla bla code
if(abs(master.get_analog(ANALOG_LEFT_Y))<2 &&abs(master.get_analog(ANALOG_LEFT_X))<2 &&abs(master.get_analog(ANALOG_RIGHT_X))<2){
holdMove = master.get_digital(DIGITAL_Y);
holdMove = false;

this is to help other people on holding the robot. if you have any questions, you could ask me

1 Like

btw this is using only p (proportional) in PID

1 Like