How to Hold a Game Object without Stalling Motors

Dear VEX Forum, our team recently attended a competition, and for most of this year, we’ve had a fork made out of standoffs. It’s been good, and we’ve won a competition and been a competition finalist with it. However, we have state coming up in a few weeks, and nationals in April. We decided that in order to keep up with the toughest competition, we would have to switch from a fork to a pincher. Just this week, we modified a pincher that we had built in the past to be more like some of the best pinchers, however one thing we don’t understand is how robots keep their pinchers held together. There was one robot we observed that had no rubber bands to pull them together, no encoders/servos, or anything. How do teams hold a cube in their pinchers without them pulling apart and releasing the fork, and without stalling the motors (tripping the breakers) from using the motors to provide pressure on the cube? Please any input would be greatly appreciated. If you have any questions about my question, let me know and I’ll try to respond ASAP. Thank you!

PID. PM me if you need help.

You might try sending a holding value of only about 10-20 to the motors when your “pinchers” close. Most Vex 393 motors can withstand values of approximately that much for a long time. See if that is enough to hold the stars in your “pinchers”.

I doubt it; many times holding several game objects at once (more than 1 cube) requires PID to really work well. Give it a shot though, it might work.

I guess I don’t understand why PID is needed at all in this case. Once the claw/pinchers have closed upon the game object, what role does PID perform?


PID can be used to fold the the claw at a constant distance apart, Running the motors a a constant value is tricky because at a value that will hold 5 or more star the claw may burn out and when no game objects are in the intake the claw may close up at a slow rate. PID will ensure (if tuned properly) that no matter what you are holding whether it is nothing or 7 or 8 stars that the claw will stay a certain distance apart and will limit the burn out.

I understand how PID might be used to hold a lift in place, but it seems to me that the original poster is asking about how to keep the claw/pincher closed, not about maintaining a lift position. Maybe I’m not interpreting this statement correctly:

We’re talking about the claw, not the lift. I’ve just finished up the mechanical changes I was making to my claw (a complete rebuild to that section, for a marginal upgrade, but oh well, it was worth it), and now I’m going to be working on more advanced code. I’m going to measure the claw position with a potentiometer. When it is closed a certain amount, which indicates that I want it to stay closed, it will apply a passive power of 10 or so. And I also automatically open the claw when I lift past a certain point, but that’s not relevant.

What I’ve noticed is that VEX motors (and probably electric motors in general, but I don’t know) resist movement when they have a VERY small power applied. You can test this; drive your robot in one direction with a TINY amount of power, so little that it doesn’t even move, it just whines. Then try to push against it. It won’t move if the wheels stay on the ground or you push with a lot of force. Sure, a claw won’t really close with tiny power, but it won’t open either. There’s no need for PID, and I’m going a little crazy on the code this year. Well, I guess basic use of sensors isn’t crazy, but it was more than our 0 sensors last year. :wink:

I don’t really know, my only real experience with motor claws is helping @Sebastian Melendez with his. However, the reason why PID is useful here is that it applies the correct amount of holding power regardless of what you are picking up. So while a holding power of 10 might work for a couple of stars, it might be too little for a cube and a couple stars. PID regulates it so that as soon as you start pushing the claw open, the motors kick in and hold it close. @Sebastian Melendez was taking about a claw in his post; it’s the same concept as holding the lift up. A holding power of 10 will keep an unloaded lift up, but as soon as you pick up a cube it sinks back down.

Run motors at half speed or use rubber bands to force your claw closed.

You don’t even need full PID. We implemented a super simple P loop a couple months ago and it’s drastically improved our performance and ease of driving. Now we can just close the claw around a bunch of stars and let go of the controls, the P loop does the rest. No more ‘tapping’ the close button to balance holding the stars and not stalling.

And @Aponthis , I know what you’re talking about. We’ve done it by accident before, and we call it “sticky motors”. The problem with just using “sticky motors” is that sure, they hold, but minor things like swinging your robot creating some momentum in the stars, hitting against a fence, or just even lifting stars is still enough to cause the claw to loosen up. This recreates the problem of you having to ‘tap’ the close button every once in a while.

A P loop, however, feels a lot more like a lock. It’s much more difficult to open, not just sticky. And even if it does come loose, it’ll automatically right itself. I highly recommend anyone having trouble holding stars to invest some time with a good control loop.

Would you be willing to share that, or at least point me in the right direction? We have a decent robot, but we are having code problems. What you are talking about is exactly what we need.

Here’s a task I wrote just now using a PID controller; this way no matter what kind of load you pick up the claw will stay at the same position.

task clawControl(){
     int PIDTargetValue;
     //PID constants. Do research if you don't know what these are
     float kp = 0.5;
     float ki = 0.01;
     float kd = 0.00001;
     int error;
     int integral = 0;
     int derivative;
     int lastError;
     int PIDDrive;
          if(vexRT[Btn[6U] == 1{
               //open claw
               motor[clawRight] = 127;
               motor[clawLeft] = 127;
               PIDTargetValue = (SensorValue[leftPot] + SensorValue[rightPot])/2;
          else if{vexRT[Btn[6D] == 1){
               //close claw
               motor[clawRight] = -127;
               motor[clawLeft] = -127;
               PIDTargetValue = (SensorValue[leftPot] + SensorValue[rightPot])/2;
               //PID to hold
               error = PIDTargetValue - (SensorValue[leftPot] + SensorValue[rightPot])/2;
               integral += error;
               derivative = error - lastError;
               PIDDrive = kp*error + ki*integral + kd*derivative;
               motor[clawRight] = PIDDrive;
               motor[clawLeft] = PIDDrive;               
               lastError = error;
          wait1msec(15);//don't hog cpu

Just put standoffs underneath your claw, like the one in this video:

Similar to the standoffs, we went with plastic hooks that slide underneath the scoring objects, this allows us to hold 4 stars or a cube without motor power. Volumes greater than 4 requires a little bit of power (we had it set for 25)

Of course anyone who was at our most recent tournament will know we actually dropped a lot of stars, but that was just because the prongs at the end of the claw were too flexible.

Here’s a very simple claw PID that I wrote. clawangleleft and clawangleright are the potentiometers on each side of the claw. The code is such that the further away a claw arm is from its desired position, the more power it sends to the motor.

int clawset = 0

if(VexRT[Btn5U] == 1)
clawset = (clawset + 2)

if(VexRT[Btn5D] ==1)
clawset = (clawset - 2)

if((VexRT[Btn5U] == 0) && (VexRT[Btn5D] == 0)

motor[clawArmReft] = ((0.3)*((clawset) - (sensorValue[clawangleleft])));
motor[clawArmRight] = ((0.3)*((clawset) - (sensorValue[clawangleright])));

Just something I’d like to mention - anti-slip mat on the tip of your claw can help tremendously with grip. When you’re talking about holding on to objects, it’s about frictional forces. Sure, you can increase normal force (force of the claw), but increasing the coefficient of friction improves the frictional force as well.