Skip to main content
Version: 3.2.1

Driving

Functions with Okapi Units​

pid_drive_set()​

Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.

p_target target okapi unit speed 0 to 127, max speed during motion

void pid_drive_set(okapi::QLength p_target, int speed);

pid_drive_set()​

Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.

p_target target okapi unit speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed
toggle_heading toggle for heading correction. true enables, false disables

void pid_drive_set(okapi::QLength p_target, int speed, bool slew_on, bool toggle_heading = true);

pid_drive_exit_condition_set()​

Set's constants for drive exit conditions.

p_small_exit_time time to exit when within small_error, okapi unit
p_small_error small timer will start when error is within this, okapi unit
p_big_exit_time time to exit when within big_error, okapi unit
p_big_error big timer will start when error is within this, okapi unit
p_velocity_exit_time time, in okapi units, for velocity to be 0
p_mA_timeout velocity timer will start when velocity is 0, okapi unit
use_imu true adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

void pid_drive_exit_condition_set(okapi::QTime p_small_exit_time, okapi::QLength p_small_error, okapi::QTime p_big_exit_time, okapi::QLength p_big_error, okapi::QTime p_velocity_exit_time, okapi::QTime p_mA_timeout, use_imu = true);

pid_drive_chain_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This sets forward and backwards driving constants.

input okapi length unit

void pid_drive_chain_constant_set(okapi::QLength input);

pid_drive_chain_forward_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This only sets forward driving constants.

input okapi length unit

void pid_drive_chain_forward_constant_set(okapi::QLength input);

pid_drive_chain_backward_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This only sets backward driving constants.

input okapi length unit

void pid_drive_chain_backward_constant_set(okapi::QLength input);

slew_drive_constants_set()​

Sets constants for slew for driving.

Slew ramps up the speed of the robot until the set distance is traveled.

distance the distance the robot travels before reaching max speed, an okapi distance unit
min_speed the starting speed for the movement, 0 - 127

void slew_drive_constants_set(okapi::QLength distance, int min_speed);

slew_drive_constants_forward_set()​

Sets constants for slew for driving forward.

Slew ramps up the speed of the robot until the set distance is traveled.

distance the distance the robot travels before reaching max speed, an okapi distance unit
min_speed the starting speed for the movement, 0 - 127

void slew_drive_constants_forward_set(okapi::QLength distance, int min_speed);

slew_drive_constants_backward_set()​

Sets constants for slew for driving backward.

Slew ramps up the speed of the robot until the set distance is traveled.

distance the distance the robot travels before reaching max speed, an okapi distance unit
min_speed the starting speed for the movement, 0 - 127

void slew_drive_constants_backward_set(okapi::QLength distance, int min_speed);

Functions without Okapi Units​

pid_drive_set()​

Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.

target target in inches speed 0 to 127, max speed during motion

void pid_drive_set(double target, int speed);

pid_drive_set()​

Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.

target target in inches speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed
toggle_heading toggle for heading correction. true enables, false disables

void pid_drive_set(double target, int speed, bool slew_on, bool toggle_heading = true);

pid_drive_exit_condition_set()​

Set's constants for drive exit conditions.

p_small_exit_time time to exit when within small_error, in ms
p_small_error small timer will start when error is within this, in inches
p_big_exit_time time to exit when within big_error, in ms
p_big_error big timer will start when error is within this, in inches
p_velocity_exit_time velocity timer will start when velocity is 0, in ms
p_mA_timeout mA timer will start when the motors are pulling too much current, in ms
use_imu true adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

void pid_drive_exit_condition_set(int p_small_exit_time, double p_small_error, int p_big_exit_time, double p_big_error, int p_velocity_exit_time, int p_mA_timeout, use_imu = true);

pid_drive_constants_set()​

Set PID drive constants for forwards and backwards.

p proportional term
i integral term
d derivative term
p_start_i error threshold to start integral

void pid_drive_constants_set(double p, double i = 0.0, double d = 0.0, double p_start_i = 0.0);

pid_drive_constants_forward_set()​

Set PID drive constants for forwards movements.

p proportional term
i integral term
d derivative term
p_start_i error threshold to start integral

void pid_drive_constants_forward_set(double p, double i = 0.0, double d = 0.0, double p_start_i = 0.0);

pid_drive_constants_backward_set()​

Set PID drive constants for backwards movements.

p proportional term
i integral term
d derivative term
p_start_i error threshold to start integral

void pid_drive_constants_backward_set(double p, double i = 0.0, double d = 0.0, double p_start_i = 0.0);

pid_heading_constants_set()​

Set PID drive constants heading correction during drive motions.

p proportion constant
i integral constant
d derivative constant
p_start_i error needs to be within this for i to start

void pid_heading_constants_set(double p, double i = 0.0, double d = 0.0, double p_start_i = 0.0);

pid_drive_chain_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This sets forward and backwards driving constants.

input length in inches

void pid_drive_chain_constant_set(double input);

pid_drive_chain_forward_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This only sets forward driving constants.

input length in inches

void pid_drive_chain_forward_constant_set(double input);

pid_drive_chain_backward_constant_set()​

Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.

This only sets backward driving constants.

input length in inches

void pid_drive_chain_backward_constant_set(double input);

slew_drive_set()​

Sets the default slew for drive forwards and backwards motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_drive_set(bool slew_on);

slew_drive_forward_set()​

Sets the default slew for drive forwards motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_drive_forward_set(bool slew_on);

slew_drive_backward_set()​

Sets the default slew for drive forwards motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_drive_backward_set(bool slew_on);

Getter​

pid_drive_chain_forward_constant_get()​

Returns the amount that the PID will overshoot target by to maintain momentum into the next motion for driving forward.

double pid_drive_chain_forward_constant_get();

pid_drive_chain_backward_constant_get()​

Returns the amount that the PID will overshoot target by to maintain momentum into the next motion for driving backward.

double pid_drive_chain_backward_constant_get();

slew_drive_forward_get()​

Returns true if slew is enabled for all drive forward movements, false otherwise.

bool slew_drive_forward_get();

slew_drive_backward_get()​

Returns true if slew is enabled for all drive forward movements, false otherwise.

bool slew_drive_backward_get();