Skip to main content
Version: 4.0.0-beta.3

Turning

Functions with Units​

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

p_target target value in angle units
speed 0 to 127, max speed during motion

void pid_turn_set(ez::QAngle p_target, int speed);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw

void pid_turn_set(ez::QAngle p_target, int speed, e_angle_behavior behavior);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_turn_set(ez::QAngle p_target, int speed, bool slew_on);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw
slew_on ramp up from a lower speed to your target speed

void pid_turn_set(ez::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

p_target target value in angle units
speed 0 to 127, max speed during motion

void pid_turn_relative_set(ez::QAngle p_target, int speed);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
slew_on ramp up from a lower speed to your target speed

void pid_turn_relative_set(ez::QAngle p_target, int speed, bool slew_on);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw

void pid_turn_relative_set(ez::QAngle p_target, int speed, e_angle_behavior behavior);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

p_target target value in angle units
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw
slew_on ramp up from a lower speed to your target speed

void pid_turn_relative_set(ez::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on);

pid_turn_exit_condition_set()​

Set's constants for turn exit conditions.

p_small_exit_time time to exit when within small_error, in units
p_small_error small timer will start when error is within this, in units
p_big_exit_time time to exit when within big_error, in units
p_big_error big timer will start when error is within this, in units
p_velocity_exit_time velocity timer will start when velocity is 0 after the robot has moved (or after 1 second if it never moves), in units
p_mA_timeout mA timer will start when the first motor on the side(s) being driven is over its current limit, in units
use_imu true adds a second velocity exit timer based on the imu's acceleration (exits if either the main sensor or the imu reports no movement for p_velocity_exit_time), false uses only the main sensor

void pid_turn_exit_condition_set(ez::QTime p_small_exit_time, ez::QAngle p_small_error, ez::QTime p_big_exit_time, ez::QAngle p_big_error, ez::QTime p_velocity_exit_time, ez::QTime p_mA_timeout, bool use_imu = true);

pid_turn_chain_constant_set()​

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

This sets turning constants.

input angle unit

void pid_turn_chain_constant_set(ez::QAngle input);

slew_turn_constants_set()​

Sets constants for slew for turns.

Slew ramps up the speed of the robot from min_speed to full speed (127) over the set distance. A motion with a lower max speed is capped at that speed, so it stops ramping sooner.

distance the distance the robot travels to ramp up to full speed (127), an angle unit
min_speed the starting speed for the movement, 0 - 127

void slew_turn_constants_set(ez::QAngle distance, int min_speed);

Functions without Units​

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

target target value in degrees
speed 0 to 127, max speed during motion

void pid_turn_set(double target, int speed);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw

void pid_turn_set(double target, int speed, e_angle_behavior behavior);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

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_turn_set(double target, int speed, bool slew_on);

pid_turn_set()​

Sets the robot to turn using PID relative to initial heading.

target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw
slew_on ramp up from a lower speed to your target speed

void pid_turn_set(double target, int speed, e_angle_behavior behavior, bool slew_on);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

target target value in degrees
speed 0 to 127, max speed during motion

void pid_turn_relative_set(double target, int speed);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

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_turn_relative_set(double target, int speed, bool slew_on);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw

void pid_turn_relative_set(double target, int speed, e_angle_behavior behavior);

pid_turn_relative_set()​

Sets the robot to turn using PID relative to the last heading target, not the robot's measured heading.

target target value in degrees
speed 0 to 127, max speed during motion
behavior changes what direction the robot will turn. can be ez::ccw, ez::cw, ez::shortest, ez::longest, ez::raw
slew_on ramp up from a lower speed to your target speed

void pid_turn_relative_set(double target, int speed, e_angle_behavior behavior, bool slew_on);

pid_turn_exit_condition_set()​

Set's constants for turn 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 after the robot has moved (or after 1 second if it never moves), in ms p_mA_timeout mA timer will start when the first motor on the side(s) being driven is over its current limit, in ms
use_imu true adds a second velocity exit timer based on the imu's acceleration (exits if either the main sensor or the imu reports no movement for p_velocity_exit_time), false uses only the main sensor

void pid_turn_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, bool use_imu = true);

pid_turn_constants_set()​

Set PID constants for turns.

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

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

pid_turn_chain_constant_set()​

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

This sets turning constants.

input angle in degrees

void pid_turn_chain_constant_set(double input);

slew_turn_set()​

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

slew_on true enables, false disables

void slew_turn_set(bool slew_on);

pid_turn_min_set()​

When kI and startI are enabled, sets the maximum output allowed while error is inside startI, for turns larger than startI. This lets I accumulate without overshoot. Despite the name this is a cap on the output, not a floor.

min new clipped speed

void pid_turn_min_set(int min);

pid_turn_behavior_set()​

Sets the default behavior for turns in turning movements.

behavior ez::shortest, ez::longest, ez::ccw, ez::cw, ez::raw

void pid_turn_behavior_set(e_angle_behavior behavior);

Getter​

pid_turn_constants_get()​

Returns the PID constants for turns, as a PID::Constants with kp, ki, kd and start_i.

PID::Constants pid_turn_constants_get();

pid_turn_chain_constant_get()​

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

double pid_turn_chain_constant_get();

slew_turn_get()​

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

bool slew_turn_get();

pid_turn_min_get()​

Returns the maximum output allowed while error is inside startI, for turns larger than startI, when kI and startI are enabled.

int pid_turn_min_get();

pid_turn_behavior_get()​

Returns the turn behavior for turns.

e_angle_behavior pid_turn_behavior_get();