Claw Is Jittery On Code That Should Work

My code worked on my last bot, but now on my new bot the claw is super jittery and old moving halfway up and down. It is the exact same code, I checked.

#pragma config(Motor,  motor1,          lDrive,        tmotorVexIQ, PIDControl, driveLeft, encoder)
#pragma config(Motor,  motor4,          claw,          tmotorVexIQ, PIDControl, reversed, encoder)
#pragma config(Motor,  motor5,          hDrive,        tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor,  motor6,          rDrive,        tmotorVexIQ, PIDControl, reversed, driveRight, encoder)
#pragma config(Motor,  motor10,         arm,           tmotorVexIQ, PIDControl, encoder)

//                               VARIABLES
bool clawpos = false;

//                                 TASKS
task claws()
{
	while(true)
	{
		if(vexRT(BtnEUp)==1)
		{
			if(clawpos==false)
			{
				clawpos = true;
				setMotorTarget(claw,80,127);
				sleep(250);
			}
			else
			{
				clawpos = false;
				setMotorTarget(claw,0,100);
				sleep(250);
			}
		}
	}
}

//                               TASK MAIN
task main()
{
	while(true)
	{
		//starttasks
		startTask(claws);
		//drivetrain
		setMotor(lDrive,(vexRT(ChA) + vexRT(ChC))*1.27);
		setMotor(rDrive,(vexRT(ChA) - vexRT(ChC))*1.27);
		setMotor(hDrive,vexRT(ChB) * 1.27);
		//armcontrol
		if(vexRT(BtnRUp)==1)
		{
			if(getMotorEncoder(arm)<380)
			{
				setMotor(arm,127);
			}
		}
		else
		{
			if(vexRT(BtnRDown)==1)
			{
				if(getMotorEncoder(arm)>0)
				{
					setMotor(arm,-127);
				}
			}
			else
			{
				setMotor(arm,0);
			}
		}
		//claws
	}
}

Thank you!

Nevermind, I just saw the issue. I started the task inside the while(true) loop.

3 Likes