Skip to main content
Version: 3.1.0

User Control

Drive Modes

opcontrol_tank()

Sets the drive to the left and right y axis.

void opcontrol_tank();

opcontrol_arcade_standard()

Sets the drive to standard arcade. Left stick is fwd/rev.

stick_type is either ez::SPLIT or ez::SINGLE

void opcontrol_arcade_standard(e_type stick_type);

opcontrol_arcade_flipped()

Sets the drive to flipped arcade. Right stick is fwd/rev.

stick_type is either ez::SPLIT or ez::SINGLE

void opcontrol_arcade_flipped(e_type stick_type);

Joystick Curves

opcontrol_curve_sd_initialize()

Sets the left/right curve constants to what's on the SD card. If the SD card is empty, creates needed files.

void opcontrol_curve_sd_initialize();

opcontrol_curve_default_sets()

Sets the left/right curve defaults and saves new values to the SD card.

left left input curve
right right input curve

void opcontrol_curve_default_set(double left, double right);

opcontrol_curve_buttons_toggle()

Enables/disables buttons used for modifying the controller curve with the joystick.

toggle true enables, false disables

void opcontrol_curve_buttons_toggle(bool toggle);

opcontrol_curve_buttons_toggle_get()

Returns true if modifying the curve with the controller is enabled, and false if it isn't.

bool opcontrol_curve_buttons_toggle_get();

opcontrol_curve_buttons_left_set()

Sets the buttons that are used to modify the left input curve. The example is the default.

decrease a pros button
increase a pros button

void opcontrol_curve_buttons_left_set(pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase);

opcontrol_curve_buttons_right_set()

Sets the buttons that are used to modify the right input curve. The example is the default.

decrease a pros button
increase a pros button

void opcontrol_curve_buttons_right_set(pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase);

opcontrol_curve_left()

Returns the input times the curve here. opcontrol_tank(), opcontrol_arcade_standard(), and opcontrol_arcade_flipped() all handle this for you. When tank is enabled, only this curve is used.

x input value

double opcontrol_curve_left(double x);

opcontrol_curve_right()

Returns the input times the curve here. opcontrol_tank(), opcontrol_arcade_standard(), and opcontrol_arcade_flipped() all handle this for you.

x input value

double opcontrol_curve_right(double x);

opcontrol_curve_buttons_iterate()

Allows the user to modify the curve with the controller.

void opcontrol_curve_buttons_iterate();

Joystick General

opcontrol_joystick_threshold_set()

Threshold the joystick will return 0 within. This is useful because not all joysticks will return perfectly to 0 when let go.

threshold an integer, recommended to be less then 5

void opcontrol_joystick_threshold_set(int threshold);

opcontrol_joystick_threshold_opcontrol()

Runs the joystick control. Sets the left drive to l_stick, and right drive to r_stick. Runs active brake and joystick thresholds.

l_stick left joystick value r_stick right joystick value

void opcontrol_joystick_threshold_opcontrol(int l_stick, int r_stick);

Active Brake

opcontrol_drive_activebrake_set()

Active brake runs a P loop on the drive when joysticks are within their threshold.

kp proportional constant for drive

void opcontrol_drive_activebrake_set(double kp);

opcontrol_drive_activebrake_get()

Returns the kP of active brake.

double opcontrol_drive_activebrake_get();

Reversing Drive

opcontrol_drive_reverse_set()

Setting this to true reverses the drive direction during opcontrol, and false reverts it back to normal.

toggle reverses or reverts drive direction.

void opcontrol_drive_reverse_set(bool toggle);

opcontrol_drive_reverse_get()

Returns true if the drive is currently reversed, and false if it isn't.

bool opcontrol_drive_reverse_get();