Skip to main content
Version: 3.1.0

Drive and Telemetry

Initialize Drive

initialize()

Runs opcontrol_curve_sd_initialize() and drive_imu_calibrate().

void Drive::initialize();

Set Drive

drive_set()

Sets the drive to voltage. Sets mode to ez::DISABLE.

left an integer between -127 and 127
right an integer between -127 and 127

void drive_set(int left, int right);

drive_brake_set()

Sets brake mode for all drive motors.

brake_type takes either MOTOR_BRAKE_COAST, MOTOR_BRAKE_BRAKE, and MOTOR_BRAKE_HOLD as parameters

void drive_brake_set(pros::motor_brake_mode_e_t brake_type);

drive_current_limit_set()

Sets mA limit to the drive. Default is 2500.

mA input miliamps

void drive_current_limit_set(int mA);

drive_imu_scaler_set()

Sets a scaler for the imu. This number is multiplied by the imu so users can tune what a "degree" is.

scaler a small double

void drive_imu_scaler_set(double scaler);

Telemetry

drive_sensor_right()

Returns right sensor value, either integrated encoder or external encoder.

int drive_sensor_right();

drive_velocity_right()

Returns integrated encoder velocity.

int drive_velocity_right();

drive_mA_right()

Returns current mA being used.

double drive_mA_right();

drive_current_right_over()

Returns true when the motor is pulling too many amps.

bool drive_current_right_over();

drive_sensor_left()

Returns left sensor value, either integrated encoder or external encoder.

int drive_sensor_left();

drive_velocity_left()

Returns integrated encoder velocity.

int drive_velocity_left();

drive_mA_left()

Returns current mA being used.

double drive_mA_left();

drive_current_left_over()

Returns true when the motor is pulling too many amps.

bool drive_current_left_over();

drive_sensor_reset()

Resets integrated encoders and trackers if applicable.

void drive_sensor_reset();

drive_imu_reset()

Sets current gyro position to parameter, defaulted to 0.

void drive_imu_reset(double new_heading = 0);

drive_imu_get()

Gets IMU sensor, value is degrees.

double drive_imu_get();

drive_imu_accel_get()

Gets imu x + y acceleration. This is (optionally) used internally as the secondary sensor for velocity exiting.

double drive_imu_accel_get();

drive_imu_calibrate()

Calibrates IMU, and vibrates the controller after a successful calibration.

bool drive_imu_calibrate();

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()

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

double drive_imu_scaler_get();