# "Motor Hold"

We are a new team moving from VEX IQ to VRC. In VexIQ, we could set the motor to “coast”, “break”, and “hold”.

So if you have a 4 bar lift, and you want the lift to stay where you left it, you would set the motor to “hold” - the motor would do what it could to keep that position.

There doesn’t seem to be anything like that in VRC. How do you keep your lift in place?

Thanks,

Cris

There are a few ways you can do this:

1: Set the motor power between 5-10 in the direction that it needs to hold the arm at acting like a break for the whole arm. These low values will not trip the PTC in the motors.

2: Put a encoder or potentiometer onto the arm and run a PID loop to keep the 4 bar at that height. If you want help on PID there are tons of past posts about it.

@CrisPierry The PID that @Zach929Y is describing is actually what the VEX IQ motor did for you automatically when you selected “Hold”. “Hold” in your programming would tell the motor to hold the position it stopped at.

In VEX EDR, you have to program this yourself. There are plenty of documents that help you with that online and in these forums. There are definitely people in the VEX community that will help you with that.

Paul

@CrisPierry PID is a control algorithm that means Proportional Integral Derivative. As you search through the forum just start with the P portion of PID. It will be an easy start with decent, but not perfect, results.

Honestly don’t even use PID. just set power. This is what I use now:

If (some button){
motor [lift ] = 127;
}else if (some other button){
motor[lift] = -127;}
else{motor[lift] = 10}

Kev has a good point. This will work in a lot of cases depending on what you are trying to do. Sometimes its more effective to flip this around also. You can increase the tension of your life to the point where it can’t fold down all the way naturally (wants to spring up a lot) then use this logic but modify so:

``````
else{motor[lift] = -10} //keep lift down

``````

+1 on this. Last year was my first year with student vrc trans and this worked great for Star stuck. It was very easy to code and it got my teams on the field.

The only caution is that sometimes it takes more than power of 10 to keep a mechanism up. Caution should be taken that the motor is not running too hard or too long or it could overheat. Learned that one the hard way!

I wouldn’t say setting motor power to a low value (or holding power) is the best way to go.
It is definitely easier to implement. But it will only work if the load is fixed (eg. Always the same weight).
If the load is always changing, then PID will work better.

You will need to know what are those situations that you will need to hold your lift, and then decide which approach is more appropriate.

Yep, might as well learn it now. If adding the sensor is not a show stopper, implement at least the P then the I for lifts.

As a last resort, power can be handy. However, as @TriDragon stated, it would arguably be best to take the longer, more effective route and learn along the way.

Thank you all. I will have the kids try this at our next practice!