Skip to main content
Version: 2.x

User Control

Drive Modes

tank()

Sets the drive to the left and right y axis.

void tank();

arcade_standard()

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

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

void arcade_standard(e_type stick_type);

arcade_flipped()

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

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

void arcade_flipped(e_type stick_type);

Joystick Functions

initialize()

Runs init_curve_sd() and imu_calibrate().

void Drive::initialize();

init_curve_sd()

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

void init_curve_sd();

set_curve_defaults()

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

left left input curve
right right input curve

void set_curve_default(double left, double right);

set_active_brake()

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

kp proportional constant for drive

void set_active_brake(double kp);

toggle_modify_curve_with_controller()

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

toggle true enables, false disables

void toggle_modify_curve_with_controller(bool toggle);

set_left_curve_buttons()

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 set_left_curve_buttons(pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase);

set_right_curve_buttons()

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 set_right_curve_buttons(pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase);

left_curve_function()

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

x input value

double left_curve_function(double x);

right_curve_function()

Returns the input times the curve here. tank(), arcade_standard(), and arcade_flipped() all handle this for you.

x input value

double right_curve_function(double x);

set_joystick_threshold()

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 set_joystick_threshold(int threshold);

joy_thresh_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 joy_thresh_opcontrol(int l_stick, int r_stick);

modify_curve_with_controller()

Allows the user to modify the curve with the controller.

void modify_curve_with_controller();