VCS C++ Robot Creeping


#1

Hello. I am team Caption for team 77000X. We are curranty using V5 and C++ in VCS. We are having problems with our robot creeping forward when we are not touching the joystick. We have a Arcade Controlled Chassis with 4 V5 200rpm motors.


#2

Re calibrate the controller joysticks. if they are getting a value, may need to set a threshold value to set for a dead band.


#3

here is a helpful lke to a deadzone fi calibration of your controller does not work. https://vexforum.com/t/vcs-v5-deadzone/50719/1


#4

Thank you meepmeepme. We did what you stated and it worked! Thank you!


#5

We recently found out how to fix the creeping but every time you shut off the robot, it stops working the chassis. Also, it starts creeping but we have to tap the joystick to fix it. Can anyone send a sample code for C++. Thanks and any help will be nice


#6

Like what @dcjrracing11 said, you can calibrate your controller’s joysticks using the built-in calibrator.

Here’s my fix for the creeping motors. I haven’t seen any problems with it ever since I put it in our bot.


//Joystick jitter fix defined
#define deadSpace 10 //Stop controller jitter!

/*------------------------------------------------------------------------------------------------------
[STABLE] tankDrive > Tank drive control system
------------------------------------------------------------------------------------------------------*/
void tankDrive()
{
	//Tank Drive v2018.11.27.21.20
	//Set the left and right motors to spin forward using the controller Axis values as the velocity value.
	//These two if statements check if the joysticks are pushed past the deadSpace (prevent jittering sticks)

	//Left side control
	if (abs(Controller.Axis3.value()) >= deadSpace)
	{
		LeftMotor1.spin(vex::directionType::fwd, Controller.Axis3.value(), vex::velocityUnits::pct);
		LeftMotor2.spin(vex::directionType::fwd, Controller.Axis3.value(), vex::velocityUnits::pct);
	}
	else
	{
		LeftMotor1.stop(vex::brakeType::coast);
		LeftMotor2.stop(vex::brakeType::coast);
	}
	//Right side control
	if (abs(Controller.Axis2.value()) >= deadSpace)
	{
		RightMotor1.spin(vex::directionType::fwd, Controller.Axis2.value(), vex::velocityUnits::pct);
		RightMotor2.spin(vex::directionType::fwd, Controller.Axis2.value(), vex::velocityUnits::pct);
	}
	else
	{
		RightMotor1.stop(vex::brakeType::coast);
		RightMotor2.stop(vex::brakeType::coast);
	}
}

Hope this helps!


#7

Is there a reason you use coast on your drive motors? I found hold very convenient, active brake on drive trains have been used on VEX robots for years and they dont usually cauce undue burden on the motors.


#8

Does going from moving straight into a hold not damage the motors? I thought that wouldn’t be good for them to abruptly stop like that.


#9

@tabor473 I set my motors to coast since my driver preferred the coast.
@JuiceBox setting it to coast should let the motor stop gracefully. I did that to my driver’s preference


#10

int L_LIFTPCT=100;
int R_LIFTPCT=100;
int SLIP_GEARPCT=100;
int CONVEYOR_BELTPCT=100;
const int deadZone = 15;
int joystickAxis2 = 0;
int joystickAxis1 = 0;
joystickAxis2 = Controller1.Axis2.value();
joystickAxis1 = Controller1.Axis1.value();
while(true) {

//CHASSI

                FL_C.spin(directionType::fwd, (Controller1.Axis2.value() + Controller1.Axis1.value()), velocityUnits::pct); //(Axis2+Axis1);
                 BL_C.spin(directionType::fwd, (Controller1.Axis2.value() + Controller1.Axis1.value()), velocityUnits::pct);//(Axis2+Axis1);
            
                 FR_C.spin(directionType::fwd, (Controller1.Axis2.value() - Controller1.Axis1.value()), velocityUnits::pct); //(Axis2-Axis1);
                 BR_C.spin(directionType::fwd, (Controller1.Axis2.value() - Controller1.Axis1.value()), velocityUnits::pct); //(Axis2-Axis1);

             
joystickAxis2 = (joystickAxis2) > deadZone ? joystickAxis2 : 0;
joystickAxis1 = (joystickAxis1) > deadZone ? joystickAxis1 : 0;<br>![Capture.JPG|690x500](upload://irUEtMctVs1Mv4cbdzpd1OUHTkj.jpeg)

#11

We are still having problems with creeping. It creeps forward but not backwards. Any help will be appreciated
Capture.JPG


#12

The problem is that your program only pretends to set a dead zone. It doesn’t really set one, though. You just plug the joystick values directly into the motor.spin commands, regardless of them exceeding the dead zone.

As for actually dealing with the dead zone, there are several other problems. First, you only set joystickAxis1 and joystickAxis2 a single time since it was done prior to the while loop. Then you compare them to the dead zone, but you do so without an absolute value. Of course, since you don’t do anything with these it doesn’t really matter. What you want is roughly the following:

while(true) {
   joystickAxis2 = Controller1.Axis2.value();
   joystickAxis1 = Controller1.Axis1.value();
   now check their absolute values against the dead zone size and set them to 0 or not.
   FL_C.spin(directionType::fwd,joystickAxis1+joystickAxis2, velocityUnits::pct);
   repeat for the other motor.spin commands
}