Skip to main content
Version: 3.2.1

Swinging

Functions with Okapi Units​

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
p_target target value okapi unit
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on);

pid_swing_exit_condition_set()​

Set's constants for swing 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 degrees 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 degrees 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_swing_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_swing_exit_condition_set()​

Set's constants for swing 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 velocity timer will start when velocity is 0, okapi unit
p_mA_timeout mA timer will start when the motors are pulling too much current, okapi unit
use_imu true adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

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

pid_swing_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 swing constants.

input okapi angle unit

void pid_swing_chain_constant_set(okapi::QAngle input);

pid_swing_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 swing constants.

input okapi angle unit

void pid_swing_chain_forward_constant_set(okapi::QAngle input);

pid_swing_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 swing constants.

input okapi angle unit

void pid_swing_chain_backward_constant_set(okapi::QAngle input);

slew_swing_constants_set()​

Sets constants for slew for swing movements.

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_swing_constants_set(okapi::QLength distance, int min_speed);

slew_swing_constants_forward_set()​

Sets constants for slew for forward swing movements.

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_swing_constants_forward_set(okapi::QLength distance, int min_speed);

slew_swing_constants_backward_set()​

Sets constants for slew for backward swing movements.

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_swing_constants_backward_set(okapi::QLength distance, int min_speed);

slew_swing_constants_set()​

Sets constants for slew for swing movements.

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 angle unit
min_speed the starting speed for the movement, 0 - 127

void slew_swing_constants_set(okapi::QAngle distance, int min_speed);

slew_swing_constants_forward_set()​

Sets constants for slew for forward swing movements.

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 angle unit
min_speed the starting speed for the movement, 0 - 127

void slew_swing_constants_forward_set(okapi::QAngle distance, int min_speed);

slew_swing_constants_backward_set()​

Sets constants for slew for backward swing movements.

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 angle unit
min_speed the starting speed for the movement, 0 - 127

void slew_swing_constants_backward_set(okapi::QAngle distance, int min_speed);

Functions without Okapi Units​

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion

void pid_swing_set(e_swing type, double target, int speed);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_set(e_swing type, double target, int speed, e_angle_behavior behavior);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, double target, int speed, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, double target, int speed, e_angle_behavior behavior, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs

void pid_swing_set(e_swing type, double target, int speed, int opposite_speed);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_set(e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, double target, int speed, int opposite_speed, bool slew_on);

pid_swing_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to initial heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_set(e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion

void pid_swing_relative_set(e_swing type, double target, int speed);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, double target, int speed, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_relative_set(e_swing type, double target, int speed, e_angle_behavior behavior);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, double target, int speed, e_angle_behavior behavior, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs

void pid_swing_relative_set(e_swing type, double target, int speed, int opposite_speed,);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, double target, int speed, int opposite_speed, bool slew_on);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw

void pid_swing_relative_set(e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior);

pid_swing_relative_set()​

Sets the robot to turn using only one side of the drive with PID and the opposite side to a constant speed, relative to the current heading.

type L_SWING or R_SWING
target target value in degrees
speed 0 to 127, max speed during motion
opposite_speed -127 to 127, max speed of the opposite side of the drive during the swing. this is used for arcs
behavior changes what direction the robot will turn. can be left, right, shortest, longest, raw
slew_on ramp up from a lower speed to your target speed

void pid_swing_relative_set(e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on);

pid_swing_constants_set()​

Set PID drive constants for forward and backward swings.

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

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

pid_swing_constants_forward_set()​

Set PID drive constants for forward swings.

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

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

pid_swing_constants_backward_set()​

Set PID drive constants for backward swings.

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

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

pid_swing_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 swing constants.

input angle in degrees

void pid_swing_chain_constant_set(double input);

pid_swing_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 swing constants.

input angle in degrees

void pid_swing_chain_forward_constant_set(double input);

pid_swing_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 swing constants.

input angle in degrees

void pid_swing_chain_backward_constant_set(double input);

slew_swing_set()​

Sets the default slew for swing forward and backward motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_swing_set(bool slew_on);

slew_swing_forward_set()​

Sets the default slew for swing forward motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_swing_forward_set(bool slew_on);

slew_swing_backward_set()​

Sets the default slew for swing backward motions, can be overwritten in movement functions.

slew_on true enables, false disables

void slew_swing_backward_set(bool slew_on);

pid_swing_min_set()​

Sets minimum power for swings when kI and startI are enabled.

min new clipped speed

void pid_swing_min_set(int min);

pid_swing_behavior_set()​

Sets the default behavior for turns in swinging movements.

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

void pid_swing_behavior_set(e_angle_behavior behavior);

Getter​

slew_swing_forward_get()​

Returns true if slew is enabled for all swing forward motions, false otherwise.

bool slew_swing_forward_get();

slew_swing_backward_get()​

Returns true if slew is enabled for all swing backward motions, false otherwise.

bool slew_swing_backward_get();

pid_swing_chain_forward_constant_get()​

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

double pid_swing_chain_forward_constant_get();

pid_swing_chain_backward_constant_get()​

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

double pid_swing_chain_backward_constant_get();

pid_swing_min_get()​

Returns minimum power for swings when kI and startI are enabled.

int pid_swing_min_get();

pid_swing_behavior_get()​

Returns the turn behavior for swings.

e_angle_behavior pid_swing_behavior_get();