Claw Programming Help?

I tried making a program to keep the two sides of my claw in sync with potentiometers but unfortunately it never really worked well. It simply added power or subtracted power from one of the claws if it was ahead or behind. Could someone show me how they did it with more advanced pid or explain it to me with a bit of detail. I don’t want a mechanical link because our claw design has a tendency to bind up with that. There’s one motor on each side of the claw. I want it to be controlled by a joystick and It needs to have a certain amount of give for if something was stuck on one side of the claw the other side would still come over to meet it.

Hardware chain them together… maybe with some fancy code it will work but you’ll save a lot of trouble if you just use hardware to fix the problem… I tried coding them together and it didn’t work so well and a better solution would take far longer than just gearing them together. My code looked something like:

int PID(int current,int target)
	float error=target-current;
	else if(integral<-MAX_INTEGRAL)
	return round(Kp*error+integral);
//later on in usercontrol....
if(vexRT[Btn5D]==1) motor[clawLeft]=motor[clawRight]=-127;
else if(vexRT[Btn5U]==1) motor[clawLeft]=motor[clawRight]=127;

If I’m seeing this right you used buttons to actuate the claw, have you thought about joystick control and pid?