Howdy, y’all. So my team and I tuned our PID through Lemlib the other day, followed the guide and everything. Now, we’ve moved on to writing autonomous programs, and we’ve been working on one for three days now. We’ll make a change, and it’ll work for a few runs, and then it won’t for some reason. We’ve verified that the odometry pods are okay, and we’ve cleaned the field twice now. So, why are my autos so inconsistient? And, in addendum, how do those of y’all that have super accurate and consistient autos get to that point? do I just need to keep working, should I re-tune PID, or what? Any help would be greatly appreciated. Code for PID Setup is below.
Cheers, y’all!
-Luke
// Sensor Definitions
Rotation lateralTracker(14);
Rotation headingTracker(11);
Imu imu(8);
//LemLib setup
//drivetrain setup
lemlib::Drivetrain drivetrain(&leftMotors, // left motor group
&rightMotors, // right motor group
12.25, // 12.25 inch track width (Distance between centerline of wheels)
lemlib::Omniwheel::NEW_325, // using new 3.25" omnis
450, // drivetrain rpm is 450
2 // horizontal drift is 2 (for now)
);
// horizontal tracking wheel
lemlib::TrackingWheel horizontal_tracking_wheel(&headingTracker, lemlib::Omniwheel::NEW_2, -6.5); //offsets will change later
// vertical tracking wheel
lemlib::TrackingWheel vertical_tracking_wheel(&lateralTracker, lemlib::Omniwheel::NEW_2, -2.5); //offsets will change later
//configure odom sensors
lemlib::OdomSensors sensors(&vertical_tracking_wheel, // vertical tracking wheel 1, set to null
nullptr, // vertical tracking wheel 2, set to nullptr as we are using IMEs
&horizontal_tracking_wheel, // horizontal tracking wheel 1
nullptr, // horizontal tracking wheel 2, set to nullptr as we don't have a second one
&imu // inertial sensor
);
// lateral PID controller (not tuned yet)
lemlib::ControllerSettings lateral_controller(11, // proportional gain (kP)
0, // integral gain (kI)
7, // derivative gain (kD)
1.083, // anti windup
1, // small error range, in inches
200, // small error range timeout, in milliseconds
3, // large error range, in inches
500, // large error range timeout, in milliseconds
70 // maximum acceleration (slew)
);
// angular PID controller (not tuned yet)
lemlib::ControllerSettings angular_controller(2, // proportional gain (kP)
0, // integral gain (kI)
10, // derivative gain (kD)
2.487, // anti windup
5, // small error range, in degrees
200, // small error range timeout, in milliseconds
10, // large error range, in degrees
500, // large error range timeout, in milliseconds
117 // maximum acceleration (slew)
);