Skip to content

Commit 824e7e2

Browse files
committed
chore(PID Values): Update PID values of the robot
Updates the PID values of the robot Smaller fixes: - Lemlib's tracking wheel size was incorrect, so we measured and input it ourselves. - The horizontal sensor was reversed in order to go the right way.
1 parent 5992828 commit 824e7e2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/globals.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pros::adi::Pneumatics HangControl('C', false);
3737
pros::adi::Pneumatics SweeperControl('B', false);
3838

3939
pros::Rotation lateral_sensor(16);
40-
pros::Rotation horizontal_sensor(-17);
40+
pros::Rotation horizontal_sensor(17);
4141

4242
pros::Imu inertial_sensor(14);
4343

@@ -59,8 +59,8 @@ pros::MotorGroup drive_({LeftFront.get_port(), RightFront.get_port(), LeftMid.ge
5959
LeftBack.get_port(), RightBack.get_port()});
6060

6161
// Lemlib objects - Used by lemlib drive and odometry functions
62-
lemlib::TrackingWheel horizontal_tracking_wheel(&horizontal_sensor, lemlib::Omniwheel::NEW_2, -5);
63-
lemlib::TrackingWheel vertical_tracking_wheel(&lateral_sensor, lemlib::Omniwheel::NEW_2, -1.45);
62+
lemlib::TrackingWheel horizontal_tracking_wheel(&horizontal_sensor, 2, -2.75);
63+
lemlib::TrackingWheel vertical_tracking_wheel(&lateral_sensor, 2, -1);
6464

6565
// Describes the lemlib objects that are used to control the autonomous
6666
// functions of the robot.
@@ -83,21 +83,21 @@ lemlib::OdomSensors sensors{
8383

8484
// forward/backward PID
8585
// lateral PID controller
86-
lemlib::ControllerSettings lateral_controller(10, // proportional gain (kP)
87-
0, // integral gain (kI)
88-
4.5, // derivative gain (kD)
89-
3, // anti windup
90-
1, // small error range, in inches
86+
lemlib::ControllerSettings lateral_controller(5.25, // proportional gain (kP)
87+
0, // integral gain (kI)
88+
13, // derivative gain (kD)
89+
3, // anti windup
90+
1, // small error range, in inches
9191
100, // small error range timeout, in milliseconds
92-
3, // large error range, in inches
92+
3, // large error range, in inches
9393
500, // large error range timeout, in milliseconds
94-
25 // maximum acceleration (slew)
94+
20 // maximum acceleration (slew)
9595
);
9696

9797
// angular PID controller
98-
lemlib::ControllerSettings angular_controller(2, // proportional gain (kP)
98+
lemlib::ControllerSettings angular_controller(1.73, // proportional gain (kP)
9999
0, // integral gain (kI)
100-
10.5, // derivative gain (kD)
100+
9, // derivative gain (kD)
101101
3, // anti windup
102102
1, // small error range, in degrees
103103
100, // small error range timeout, in milliseconds

0 commit comments

Comments
 (0)