Hi,
I’m currently using the following code to create an OkapiLib Chassis with PID
std::shared_ptr<ChassisController> chassisAuton = ChassisControllerBuilder()
.withMotors(
{1, 12}, //left motors are ports 1 and 2
{-10, -19}
) //right motors are ports 10 and 20
.withGains( //initializing integrated PID system
{0.001, 0, 0.0001}, // Distance controller gains
{0.001, 0, 0.0001}, // Turn controller gains
{0.001, 0, 0.0001} // Angle controller gains (helps drive straight)
)
.withDerivativeFilters(
std::make_unique<AverageFilter<3>>(), // Distance controller filter
std::make_unique<AverageFilter<3>>(), // Turn controller filter
std::make_unique<AverageFilter<3>>() // Angle controller filter
)
// green gearset, 4 inch wheel diameter, 11.5 inch wheelbase
.withDimensions(AbstractMotor::gearset::green, {{3.25_in, 12.5_in}, imev5GreenTPR})
.build(); // build a chassis
The PID doesn’t seem to be working as intended, as the robot lurches forward and halts very quickly to a stop. Additionally, calling turnAngle on the chassis overshoots the intended angle by quite a bit. I was wondering if I do need to tune the PID, but I wanted to ask here first as to what is causing these issue. Thanks!