Skip to main content
Version: 3.2.1

General

Functions with Okapi Units​

drive_angle_set()​

Sets the angle of the robot. This is useful when your robot is setup in at an unconventional angle and you want 0 to be when you're square with the field.

p_angle an okapi angle unit, angle that the robot will think it's now facing.

void drive_angle_set(okapi::QAngle p_angle);

drive_angle_set()​

Sets the angle of the robot. This is useful when your robot is setup in at an unconventional angle and you want 0 to be when you're square with the field.

angle is in degrees, angle that the robot will think it's now facing.

void drive_angle_set(double angle);

pid_wait_until()​

Lock the code in a while loop until this position has passed for driving with okapi units.

target for driving and swings, using okapi units

void pid_wait_until(okapi::QLength target);

pid_wait_until()​

Lock the code in a while loop until this position has passed for turning or swinging with okapi units.

target for turning, using okapi units

void pid_wait_until(okapi::QAngle target);

pid_speed_max_set()​

Changes max speed during a drive motion.

speed new clipped speed, between 0 and 127

void pid_speed_max_set(int speed);

Functions without Okapi Units​

drive_mode_set()​

Sets the current mode of the drive.

p_mode the current task running for the drive. accepts ez::DISABLE, ez::SWING, ez::TURN, ez::DRIVE

void drive_mode_set(e_mode p_mode);

drive_rpm_set()​

Set the cartridge/wheel rpm of the robot.

rpm rpm of the cartridge or wheel

void drive_rpm_set(double rpm);

drive_ratio_set()​

Set the ratio of the robot.

ratio ratio of the gears

void drive_ratio_set(double ratio);

pid_drive_toggle()​

Toggles set drive in autonomous.

toggle true enables, false disables

void pid_drive_toggle(bool toggle);

pid_print_toggle()​

Toggles printing in autonomous.

toggle true enables, false disables

void pid_print_toggle(bool toggle);

pid_wait_until()​

Lock the code in a while loop until this position has passed for driving without okapi units.

target for driving or turning, using a double. degrees for turns/swings, inches for driving

void pid_wait_until(double target);

pid_angle_behavior_set()​

Sets the default behavior for turns in odom, swinging, and turning.

behavior ez::shortest, ez::longest, ez::left, ez::right, ez::raw

void pid_angle_behavior_set(e_angle_behavior behavior);

pid_angle_behavior_tolerance_set()​

Gives some wiggle room in shortest vs longest, so a 180.1 and 179.9 degree turns have consistent behavior.

p_tolerance angle wiggle room, an okapi unit

void pid_angle_behavior_tolerance_set(okapi::QAngle p_tolerance);

pid_angle_behavior_tolerance_set()​

Gives some wiggle room in shortest vs longest, so a 180.1 and 179.9 degree turns have consistent behavior.

tolerance angle wiggle room, in degrees

void pid_angle_behavior_tolerance_set(double tolerance);

pid_angle_behavior_bias_set()​

When a turn is within its tolerance, you can have it bias left or right.

behavior ez::left or ez::right

void pid_angle_behavior_bias_set(e_angle_behavior behavior);

Getter​

drive_mode_get()​

Returns the current drive mode that the task is running.

Returns ez::DISABLE, ez::SWING, ez::TURN, ez::DRIVE.

e_mode drive_mode_get();

drive_tick_per_inch()​

Returns the conversion between raw sensor value and inches.

double drive_tick_per_inch();

drive_rpm_get()​

Returns the current cartridge / wheel rpm.

double drive_rpm_get();

drive_ratio_get()​

Returns the ratio of the drive.

double drive_ratio_get();

pid_angle_behavior_tolerance_get()​

Returns the wiggle room in shortest vs longest, so a 180.1 and 179.9 degree turns have consistent behavior.

double pid_angle_behavior_tolerance_get();

pid_angle_behavior_bias_get()​

Returns the behavior when a turn is within its tolerance, you can have it bias left or right.

e_angle_behavior pid_angle_behavior_bias_get(e_angle_behavior);

Misc.​

pid_wait()​

Lock the code in a while loop until the robot has settled.

void pid_wait();

pid_wait_quick()​

Lock the code in a while loop until the robot has settled.

Wrapper for pid_wait_until(target), target is your previously input target.

void pid_wait_quick();

pid_wait_quick_chain()​

Lock the code in a while loop until the robot has settled.

This also adds distance to target, and then exits with pid_wait_quick.

This will exit the motion while carrying momentum into the next motion.

void pid_wait_quick_chain();

pid_targets_reset()​

Resets all drive PID targets to 0.

void pid_targets_reset();

interfered​

Boolean that returns true when pid_wait() or pid_wait_until() exit with velocity or is_over_current. This can be used to detect unwanted motion and stop the drive motors from overheating during autonomous.

bool interfered = false;