JAR PID help

I am trying to use the JAR template to code autonomous, but the PID does not seem to work. I used the chassis.drive_distance(400, 0, 10, 10, 10, 3, 4000, 0.4, 0, 0, 0, 0, 0, 0, 0); function to go forward a bit. The robot goes forward at the same speed and does not slow down. I just inputed the P in the PID constants and have tried to lower and raise them, but the drivetrain still goes the same speed. Does anybody know how to solve this issue? Thanks.

Drive chassis(

//Specify your drive setup below. There are seven options:

//ZERO_TRACKER_NO_ODOM, ZERO_TRACKER_ODOM, TANK_ONE_ENCODER, TANK_ONE_ROTATION, TANK_TWO_ENCODER, TANK_TWO_ROTATION, HOLONOMIC_TWO_ENCODER, and HOLONOMIC_TWO_ROTATION

//For example, if you are not using odometry, put ZERO_TRACKER_NO_ODOM below:

ZERO_TRACKER_NO_ODOM,

//Add the names of your Drive motors into the motor groups below, separated by commas, i.e. motor_group(Motor1,Motor2,Motor3).

//You will input whatever motor names you chose when you configured your robot using the sidebar configurer, they don't have to be "Motor1" and "Motor2".

//Left Motors:

motor_group(RA, RB, RC),

//Right Motors:

motor_group(LA, LB, LC),

//Specify the PORT NUMBER of your inertial sensor, in PORT format (i.e. "PORT1", not simply "1"):

PORT5,

//Input your wheel diameter. (4" omnis are actually closer to 4.125"):

2.75,

//External ratio, must be in decimal, in the format of input teeth/output teeth.

//If your motor has an 84-tooth gear and your wheel has a 60-tooth gear, this value will be 1.4.

//If the motor drives the wheel directly, this value is 1:

1,

//Gyro scale, this is what your gyro reads when you spin the robot 360 degrees.

//For most cases 360 will do fine here, but this scale factor can be very helpful when precision is necessary.

360,

Auton(just the P):
void drive_test(){

 chassis.drive_distance(400, 0, 10, 10, 10, 3, 4000, 0.4, 0, 0, 0, 0, 0, 0, 0); 

}

video of drivetrain:
IMG_6912.zip (18.0 MB)
Does anyone also know what all the parameters mean? I have checked the official documentation site for JAR but I still don’t understand some of the constants. If anyone could help that would be greatly appreiciated.

You can use drive_distance() with the only parameter being the distance to drive (in inches). Also, you can look in drive.cpp and see all of the parameters for drive_distance() if you want to make it more complicated.

1 Like

I think 400 inches might be a bit much, since the vex field is only 144.

I checked that out and that helps, thanks,

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.