Skip to main content
Version: 3.2.2

Drive and Telemetry

Initialize Drive

initialize()

Runs opcontrol_curve_sd_initialize() and drive_imu_calibrate().

void Drive::initialize();

Set Drive

drive_set()

Sets the chassis to voltage.

Disables PID when called.

left voltage for left side, -127 to 127
right voltage for right side, -127 to 127

void drive_set(int left, int right);

drive_brake_set()

Changes the way the drive behaves when it is not under active user control.

brake_type the 'brake mode' of the motor e.g. 'pros::E_MOTOR_BRAKE_COAST' 'pros::E_MOTOR_BRAKE_BRAKE' 'pros::E_MOTOR_BRAKE_HOLD'

void drive_brake_set(pros::motor_brake_mode_e_t brake_type);

drive_current_limit_set()

Sets the limit for the current on the drive.

mA input in miliamps

void drive_current_limit_set(int mA);

drive_imu_scaler_set()

Sets a new imu scaling factor.

This value is multiplied by the imu to change its output.

scaler factor to scale the imu by

void drive_imu_scaler_set(double scaler);

Telemetry

drive_sensor_right()

The position of the right sensor in inches.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

int drive_sensor_right();

drive_velocity_right()

The velocity of the right motor.

int drive_velocity_right();

drive_mA_right()

The watts of the right motor.

double drive_mA_right();

drive_current_right_over()

Return true when the motor is over current.

bool drive_current_right_over();

drive_sensor_left()

The position of the left sensor in inches.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

int drive_sensor_left();

drive_velocity_left()

The velocity of the left motor.

int drive_velocity_left();

drive_mA_left()

The watts of the left motor.

double drive_mA_left();

drive_current_left_over()

Return true when the motor is over current.

bool drive_current_left_over();

drive_sensor_reset()

Reset all the chassis motors and tracking wheels, recommended to run at the start of your autonomous routine.

void drive_sensor_reset();

drive_imu_reset()

Resets the current imu value. Defaults to 0, recommended to run at the start of your autonomous routine.

new_heading_value new heading value

void drive_imu_reset(double new_heading = 0);

drive_imu_get()

Returns the current imu heading rotation value in degrees.

double drive_imu_get();

drive_imu_accel_get()

Returns the current imu accel x + accel y value.

double drive_imu_accel_get();

drive_imu_calibrate()

Calibrates the IMU, recommended to run in initialize().

run_loading_animation true runs the animation, false doesn't

bool drive_imu_calibrate(bool run_loading_animation = true);

drive_imu_get()

Gets IMU sensor scaler. This number is multiplied by the imu so users can tune what a "degree" means.

double drive_imu_scaler_get();

drive_imu_scaler_get()

Returns the current imu scaling factor.

double drive_imu_scaler_get();

drive_imu_scaler_get()

Checks if the imu calibrated successfully or if it took longer than expected.

Returns true if calibrated successfully, and false if unsuccessful.

bool drive_imu_calibrated();