Okapi chassis won't change speed

When coding my autons using okapi chassis builder. I couldn’t get the chassis to change speed when using. chassis->getModel()->setMaxVelocity(100); I’m using okapi V4 and pros V3.2.0.

Motor leftMotor(7, false, AbstractMotor::gearset::red, AbstractMotor::encoderUnits::degrees);
Motor rightMotor(5, true, AbstractMotor::gearset::red, AbstractMotor::encoderUnits::degrees);
Motor middleMotor(6, false, AbstractMotor::gearset::red, AbstractMotor::encoderUnits::degrees);
std::shared_ptr<ChassisController> chassis = ChassisControllerBuilder()
  .withMotors(leftMotor, rightMotor, middleMotor)
  .withSensors(leftEncoder, rightEncoder)
  .withDimensions(AbstractMotor::gearset::red, {{4_in, 10_in}, imev5RedTPR})
  .withMaxVelocity(60)
  .withLogger(
      std::make_shared<Logger>(
          TimeUtilFactory::createDefault().getTimer(), // It needs a Timer
          "/usd/Chassis_Diagnostics", // Output to the SDCard
          Logger::LogLevel::info // Most verbose log level
      )
  )
  .build();

void autonomous() {
  chassis->moveDistance(1_ft);
  chassis->getModel()->setMaxVelocity(100);
  chassis->moveDistance(1_ft);
}
1 Like

Please upgrade to v4.0.1 and use this method instead https://okapilib.github.io/OkapiLib/classokapi_1_1ChassisController.html#a973c79ed60f4b0a25fe5273ba4146427

1 Like