PID Settling

I am using the okapilib OdomChassisController for auton, however the PID is not accurate enough, especially on turns, which I believe is to do with false positives with settling. I tried to edit the settledUtil parameters, however the robot does not seem to respond to these changes at all. The following code uses ridiculous values and still has no effect on the PID controller! I am using driveToPoint.

#include "main.h"
#include "okapi/api.hpp"
using namespace okapi;

std::shared_ptr<OdomChassisController> chassis = ChassisControllerBuilder()

.withMotors({1, -2}, {-4, 3})
.withDimensions(AbstractMotor::gearset::green, {{3.25_in, 393_mm}, 540})
.withSensors
(
	ADIEncoder{'A', 'B'},
	ADIEncoder{'E', 'F', true},
	ADIEncoder{'C', 'D', true}
)
.withClosedLoopControllerTimeUtil(10, 1, 5000_ms)
.withOdometry({{2.75_in, 212_mm, 120_mm, 2.75_in}, quadEncoderTPR})
.buildOdometry();

I believe .withClosedLoopControllerTimeUtil is only relevant when you specify withGains. Without specifying withGains you will be using the “Integrated” version of the chassis which relies on the native V5 PID.

2 Likes

What would be a good starting value for each gain?

My turns also appear to be aiming 180 out now that I am using a custom controller!?