Robot stopping at angle while using ChassisControllerBuilder and OdomChassisController

Hi,

My team is trying to move from block program to okapi. They started coding and observing the bot steering to left or right right before it stops, when chassis->moveDistance(1_ft). Below is the code which is being used to test this. can any one please review and let me know what is causing this?

Drive motors are connected to 60 tooth gear and wheels are connected to 84 tooth gear.

IMU is connected to port 6

std::shared_ptrokapi::OdomChassisController chassis =
ChassisControllerBuilder()
.withMotors({-3, -7}, {-9, -14})
.withDimensions({AbstractMotor::gearset::green, (60 / 84.0)}, {{4_in, 15_in}, imev5GreenTPR})
.withGains(
{.00063, 0.00001, 0.000015},
{0.00179, 0,0}, // Turn controller gains
{0.00005, .0005, .00005})
.withOdometry()
.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
)
.withClosedLoopControllerTimeUtil(5, 5, 250_ms)
.withMaxVoltage(12000)
.withLogger(
std::make_shared(
TimeUtilFactory::createDefault().getTimer(), // It needs a Timer
“/ser/sout”, // Output to the PROS terminal
Logger::LogLevel::debug // Most verbose log level
))
.buildOdometry();

auton code:
chassis->moveDistance(1_ft);

Thanks so much.

Just to add to above, it is going straight for 11 inches and stopping at some angle during last inch.

I’m sure you can imagine why “some angle” is not helpful at all for debugging.

1 Like

I notice that your integral gain is higher than your proportional for the third gain set (angle controller) which controls the robot’s angle during linear movements. A high integral term can cause overshoot. I would suggest making the turn and angle controller gains equivalent, if your turns seem good.