PROS opcontrol Turning Sensitivity and Axis Scaling

I’m currently using the ChassisControllerIntegrated class in the okapi lilbrary to set up the user control for our robot. However when I test it, it seems like the robot is moving at full power no matter how little or far the axis is being pushed. The sensitivity is also way too high because of this, so I was wondering if there’s any way for me to change it? Or if there’s a better class to use for this.

Here’s my current code:

void opcontrol() {

	//constructs 
	        std::shared_ptr<okapi::ChassisController> drive =
        ChassisControllerBuilder()
            .withMotors({-11, -19}, {12,13}) //homebase -11, -19, 12, 13 //schoolBot 1, 11, 10, 20
            // Green gearset, 4 in wheel diam, 11.5 in wheel track  //UPDATE THIS IN A BIT
            .withSensors(
        RotationSensor{14}, // Left encoder in V5 port 1
        RotationSensor{17, true}  // Right encoder in V5 port 2 (reversed)
            )
            .withDimensions(AbstractMotor::gearset::green, {{4_in, 16.25_in}, imev5GreenTPR})
            .build();

	ControllerButton intakeButton(ControllerDigital::L1);
    ControllerButton revIntakeButton(ControllerDigital::L2);
    Motor intakeMotor(3);

	fleft.set_brake_mode(pros::E_MOTOR_BRAKE_COAST);
	fright.set_brake_mode(pros::E_MOTOR_BRAKE_COAST);
	bleft.set_brake_mode(pros::E_MOTOR_BRAKE_COAST);
	bright.set_brake_mode(pros::E_MOTOR_BRAKE_COAST);
	controller.clear();

	while(true) {
		drive->getModel()->arcade(controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y),
                                  controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X));
		
			if (intakeButton.isPressed()) {
                intakeMotor.moveVoltage(12000);
            } else if (revIntakeButton.isPressed()) {
                intakeMotor.moveVoltage(-12000);
            } else {
                intakeMotor.moveVoltage(0);
            }

		pros::delay(10);
}

Thanks for the help

This is a little late, but I believe the problem is you’re getting the analog data from the PROS controller, which returns a value in the range of [-127,127] (Controller — PROS for V5 3.7.1 documentation). What you should be doing is using the Okapi controller, which will return a value in the range of [-1, 1] (okapi::Controller class | OkapiLib A PROS library for programming VEX robots). So,

drive->getModel()->arcade(controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y),
                                  controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_X));
// should be
drive->getModel()->arcade(controller.getAnalog(ControllerAnalog::leftY),
controller.getAnalog(ControllerAnalog::leftX));
4 Likes