LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
light::Drive Class Reference

Tank-drive chassis class. More...

#include <drive.hpp>

Classes

struct  const_and_name
 

Public Member Functions

void friction_constants_set (double kS, double kV=0.0, double kQ=0.0)
 Sets the friction-feedforward coefficients.
 
std::vector< double > friction_constants_get ()
 Returns {kS, kV, kQ}.
 
double friction_ff (double v_target)
 Computes the friction-feedforward term for a target motor-cmd-unit velocity.
 
void slew_swing_constants_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for swing movements.
 
void slew_swing_constants_forward_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for forward swing movements.
 
void slew_swing_constants_backward_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for backward swing movements.
 
void slew_swing_constants_set (okapi::QAngle distance, int min_speed)
 Sets constants for slew for swing movements.
 
void slew_swing_constants_forward_set (okapi::QAngle distance, int min_speed)
 Sets constants for slew for swing forward movements.
 
void slew_swing_constants_backward_set (okapi::QAngle distance, int min_speed)
 Sets constants for slew for swing backward movements.
 
void slew_turn_constants_set (okapi::QAngle distance, int min_speed)
 Sets constants for slew for turns.
 
void slew_drive_constants_forward_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for driving forward.
 
void slew_drive_constants_backward_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for driving backward.
 
void slew_drive_constants_set (okapi::QLength distance, int min_speed)
 Sets constants for slew for driving.
 
void slew_drive_set (bool slew_on)
 Sets the default slew for drive forwards and backwards motions, can be overwritten in movement functions.
 
void slew_drive_forward_set (bool slew_on)
 Sets the default slew for drive forward motions, can be overwritten in movement functions.
 
bool slew_drive_forward_get ()
 Returns true if slew is enabled for all drive forward movements, false otherwise.
 
void slew_drive_backward_set (bool slew_on)
 Sets the default slew for drive backward motions, can be overwritten in movement functions.
 
bool slew_drive_backward_get ()
 Returns true if slew is enabled for all drive backward movements, false otherwise.
 
void slew_swing_set (bool slew_on)
 Sets the default slew for swing forward and backward motions, can be overwritten in movement functions.
 
void slew_swing_forward_set (bool slew_on)
 Sets the default slew for swing forward motions, can be overwritten in movement functions.
 
bool slew_swing_forward_get ()
 Returns true if slew is enabled for all swing forward motions, false otherwise.
 
void slew_swing_backward_set (bool slew_on)
 Sets the default slew for swing backward motions, can be overwritten in movement functions.
 
bool slew_swing_backward_get ()
 Returns true if slew is enabled for all swing backward motions, false otherwise.
 
void slew_turn_set (bool slew_on)
 Sets the default slew for turn motions, can be overwritten in movement functions.
 
bool slew_turn_get ()
 Returns true if slew is enabled for all turn motions, false otherwise.
 
void slew_odom_reenable (bool reenable)
 Allows slew to reenable when the new input speed is larger than the current speed during pure pursuits.
 
bool slew_odom_reenabled ()
 Returns if slew will reenable when the new input speed is larger than the current speed during pure pursuits.
 
void drive_mode_set (e_mode p_mode, bool stop_drive=true)
 Sets current mode of drive.
 
e_mode drive_mode_get ()
 Returns current mode of drive.
 
void initialize ()
 Calibrates imu and initializes sd card to curve.
 
 Drive (std::vector< int > left_motor_ports, std::vector< int > right_motor_ports, int imu_port, double wheel_diameter, double ticks, double ratio=1.0)
 Creates a Drive Controller using internal encoders.
 
 Drive (std::vector< int > left_motor_ports, std::vector< int > right_motor_ports, int imu_port, double wheel_diameter, double ticks, double ratio, std::vector< int > left_tracker_ports, std::vector< int > right_tracker_ports) __attribute__((deprecated("Use the integrated encoder const ructor with odom_tracker_left_set() and odom_tracker_right_set() instead!")))
 Creates a Drive Controller using encoders plugged into the brain.
 
 Drive (std::vector< int > left_motor_ports, std::vector< int > right_motor_ports, int imu_port, double wheel_diameter, double ticks, double ratio, std::vector< int > left_tracker_ports, std::vector< int > right_tracker_ports, int expander_smart_port) __attribute__((deprecated("Use the integrated encoder const ructor with odom_tracker_left_set() and odom_tracker_right_set() instead!")))
 Creates a Drive Controller using encoders plugged into a 3 wire expander.
 
 Drive (std::vector< int > left_motor_ports, std::vector< int > right_motor_ports, int imu_port, double wheel_diameter, double ratio, int left_rotation_port, int right_rotation_port) __attribute__((deprecated("Use the integrated encoder const ructor with odom_tracker_left_set() and odom_tracker_right_set() instead!")))
 Creates a Drive Controller using rotation sensors.
 
void drive_defaults_set ()
 Sets drive defaults.
 
void ez_tracking_task ()
 Tasks for tracking.
 
void odom_enable (bool input)
 Enables / disables tracking.
 
bool odom_enabled ()
 Returns whether the bot is tracking with odometry.
 
void drive_width_set (double input)
 Sets the width of the drive.
 
void drive_width_set (okapi::QLength p_input)
 Sets the width of the drive.
 
double drive_width_get ()
 Returns the width of the drive.
 
void odom_x_set (double x)
 Sets the current X coordinate of the robot.
 
void odom_x_set (okapi::QLength p_x)
 Sets the current X coordinate of the robot.
 
double odom_x_get ()
 Returns the current X coordinate of the robot in inches.
 
void odom_y_set (double y)
 Sets the current Y coordinate of the robot.
 
void odom_y_set (okapi::QLength p_y)
 Sets the current Y coordinate of the robot.
 
double odom_y_get ()
 Returns the current Y coordinate of the robot in inches.
 
void odom_theta_set (double a)
 Sets the current angle of the robot.
 
void odom_theta_set (okapi::QAngle p_a)
 Sets the current Theta of the robot.
 
double odom_theta_get ()
 Returns the current Theta of the robot in degrees.
 
void odom_pose_set (pose itarget)
 Sets the current pose of the robot.
 
void odom_pose_set (united_pose itarget)
 Sets the current pose of the robot.
 
void odom_xy_set (double x, double y)
 Sets the current X and Y coordinate for the robot.
 
void odom_xy_set (okapi::QLength p_x, okapi::QLength p_y)
 Sets the current X and Y coordinate for the robot.
 
void odom_xyt_set (double x, double y, double t)
 Sets the current X, Y, and Theta values for the robot.
 
void odom_xyt_set (okapi::QLength p_x, okapi::QLength p_y, okapi::QAngle p_t)
 Sets the current X, Y, and Theta values for the robot.
 
pose odom_pose_get ()
 Returns the current pose of the robot.
 
void odom_reset ()
 Resets xyt to 0.
 
void odom_x_flip (bool flip=true)
 Flips the X axis.
 
bool odom_x_direction_get ()
 Checks if X axis is flipped.
 
void odom_y_flip (bool flip=true)
 Flips the Y axis.
 
bool odom_y_direction_get ()
 Checks if Y axis is flipped.
 
void odom_theta_flip (bool flip=true)
 Flips the rotation axis.
 
bool odom_theta_direction_get ()
 Checks if the rotation axis is flipped.
 
void odom_boomerang_dlead_set (double input)
 Sets a new dlead.
 
double odom_boomerang_dlead_get ()
 Returns the current dlead.
 
void odom_boomerang_distance_set (double distance)
 Sets how far away the carrot point can be from the target point.
 
void odom_boomerang_distance_set (okapi::QLength p_distance)
 Sets how far away the carrot point can be from the target point.
 
double odom_boomerang_distance_get ()
 Returns how far away the carrot point can be from target.
 
void odom_turn_bias_set (double bias)
 A proportion of how prioritized turning is during odometry motions.
 
double odom_turn_bias_get ()
 Returns the proportion of how prioritized turning is during odometry motions.
 
void odom_path_spacing_set (double spacing)
 Sets the spacing between points when points get injected into the path.
 
void odom_path_spacing_set (okapi::QLength p_spacing)
 Sets the spacing between points when points get injected into the path.
 
double odom_path_spacing_get ()
 Returns the spacing between points when points get injected into the path.
 
void odom_path_smooth_constants_set (double weight_smooth, double weight_data, double tolerance)
 Sets the constants for smoothing out a path.
 
std::vector< double > odom_path_smooth_constants_get ()
 Returns the constants for smoothing out a path.
 
void odom_path_print ()
 Prints the current path the robot is following.
 
void odom_look_ahead_set (double distance)
 Sets how far away the robot looks in the path during pure pursuits.
 
void odom_look_ahead_set (okapi::QLength p_distance)
 Sets how far away the robot looks in the path during pure pursuits.
 
double odom_look_ahead_get ()
 Returns how far away the robot looks in the path during pure pursuits.
 
void odom_tracker_left_set (tracking_wheel *input)
 Sets the parallel left tracking wheel for odometry.
 
void odom_tracker_right_set (tracking_wheel *input)
 Sets the parallel right tracking wheel for odometry.
 
void odom_tracker_front_set (tracking_wheel *input)
 Sets the perpendicular front tracking wheel for odometry.
 
void odom_tracker_back_set (tracking_wheel *input)
 Sets the perpendicular back tracking wheel for odometry.
 
void pid_angle_behavior_set (e_angle_behavior behavior)
 Sets the default behavior for turns in odom, swinging, and turning.
 
void pid_turn_behavior_set (e_angle_behavior behavior)
 Sets the default behavior for turns in turning movements.
 
void pid_swing_behavior_set (e_angle_behavior behavior)
 Sets the default behavior for turns in swinging movements.
 
void pid_odom_behavior_set (e_angle_behavior behavior)
 Sets the default behavior for turns in odom turning movements.
 
e_angle_behavior pid_turn_behavior_get ()
 Returns the turn behavior for turns.
 
e_angle_behavior pid_swing_behavior_get ()
 Returns the turn behavior for swings.
 
e_angle_behavior pid_odom_behavior_get ()
 Returns the turn behavior for odom turns.
 
void pid_angle_behavior_tolerance_set (okapi::QAngle p_tolerance)
 Gives some wiggle room in shortest vs longest, so a 180.1 and 179.9 degree turns have consistent behavior.
 
void pid_angle_behavior_tolerance_set (double tolerance)
 Gives some wiggle room in shortest vs longest, so a 180.1 and 179.9 degree turns have consistent behavior.
 
double 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.
 
void pid_angle_behavior_bias_set (e_angle_behavior behavior)
 When a turn is within its tolerance, you can have it bias left or right.
 
e_angle_behavior pid_angle_behavior_bias_get ()
 Returns the behavior when a turn is within its tolerance, you can have it bias left or right.
 
void opcontrol_tank ()
 Sets the chassis to controller joysticks using tank control.
 
void opcontrol_arcade_standard (e_type stick_type)
 Sets the chassis to controller joysticks using standard arcade control, where left stick is fwd/rev.
 
void opcontrol_arcade_flipped (e_type stick_type)
 Sets the chassis to controller joysticks using flipped arcade control, where right stick is fwd/rev.
 
void opcontrol_curve_sd_initialize ()
 Initializes left and right curves with the SD card, recommended to run in initialize().
 
void opcontrol_curve_default_set (double left, double right=0)
 Sets the default joystick curves.
 
std::vector< double > opcontrol_curve_default_get ()
 Gets the default joystick curves, in {left, right}.
 
void opcontrol_drive_activebrake_set (double kp, double ki=0.0, double kd=0.0, double start_i=0.0)
 Runs a PID loop on the drive when the joysticks are released.
 
double opcontrol_drive_activebrake_get ()
 Returns kP for active brake.
 
PID::Constants opcontrol_drive_activebrake_constants_get ()
 Returns all PID constants for active brake.
 
void opcontrol_curve_buttons_toggle (bool toggle)
 Enables/disables modifying the joystick input curves with the controller.
 
bool opcontrol_curve_buttons_toggle_get ()
 Gets the current state of the toggle.
 
void opcontrol_curve_buttons_left_set (pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase)
 Sets buttons for modifying the left joystick curve.
 
std::vector< pros::controller_digital_e_t > opcontrol_curve_buttons_left_get ()
 Returns a vector of pros controller buttons user for the left joystick curve, in {decrease, increase}.
 
void opcontrol_curve_buttons_right_set (pros::controller_digital_e_t decrease, pros::controller_digital_e_t increase)
 Sets buttons for modifying the right joystick curve.
 
std::vector< pros::controller_digital_e_t > opcontrol_curve_buttons_right_get ()
 Returns a vector of pros controller buttons user for the right joystick curve, in {decrease, increase}.
 
double opcontrol_curve_left (double x)
 Outputs a curve from 5225A In the Zone.
 
double opcontrol_curve_right (double x)
 Outputs a curve from 5225A In the Zone.
 
void opcontrol_joystick_threshold_set (int threshold)
 Sets a new threshold for the joystick.
 
int opcontrol_joystick_threshold_get ()
 Gets the threshold for the joystick.
 
void opcontrol_drive_sensors_reset ()
 Resets drive sensors at the start of opcontrol.
 
void opcontrol_joystick_threshold_iterate (int l_stick, int r_stick)
 Sets minimum value distance constants.
 
bool pto_check (pros::Motor check_if_pto)
 Checks if the motor is currently in pto_list.
 
void pto_add (std::vector< pros::Motor > pto_list)
 Adds motors to the pto list, removing them from the drive.
 
void pto_remove (std::vector< pros::Motor > pto_list)
 Removes motors from the pto list, adding them to the drive.
 
void pto_toggle (std::vector< pros::Motor > pto_list, bool toggle)
 Adds/removes motors from drive.
 
void drive_set (int left, int right)
 Sets the chassis to voltage.
 
std::vector< int > drive_get ()
 Gets the chassis to voltage, -127 to 127.
 
void drive_brake_set (pros::motor_brake_mode_e_t brake_type)
 Changes the way the drive behaves when it is not under active user control.
 
pros::motor_brake_mode_e_t drive_brake_get ()
 Returns the brake mode of the drive in pros_brake_mode_e_t_.
 
void drive_current_limit_set (int mA)
 Sets the limit for the current on the drive.
 
int drive_current_limit_get ()
 Gets the limit for the current on the drive.
 
void pid_drive_toggle (bool toggle)
 Toggles set drive in autonomous.
 
bool pid_drive_toggle_get ()
 Gets the current state of the toggle.
 
void pid_print_toggle (bool toggle)
 Toggles printing in autonomous.
 
bool pid_print_toggle_get ()
 Gets the current state of the toggle.
 
double drive_sensor_right ()
 The position of the right sensor in inches.
 
int drive_sensor_right_raw ()
 The position of the right sensor.
 
int drive_velocity_right ()
 The velocity of the right motor.
 
double drive_mA_right ()
 The watts of the right motor.
 
bool drive_current_right_over ()
 Return true when the motor is over current.
 
double drive_sensor_left ()
 The position of the left sensor in inches.
 
int drive_sensor_left_raw ()
 The position of the left sensor.
 
int drive_velocity_left ()
 The velocity of the left motor.
 
double drive_mA_left ()
 The watts of the left motor.
 
bool drive_current_left_over ()
 Return true when the motor is over current.
 
void drive_sensor_reset ()
 Reset all the chassis motors and tracking wheels, recommended to run at the start of your autonomous routine.
 
void drive_imu_reset (double new_heading=0)
 Resets the current imu value.
 
double drive_imu_get ()
 Returns the current imu rotation value in degrees.
 
double drive_imu_accel_get ()
 Returns the current imu accel x + accel y value.
 
void drive_imu_scaler_set (double scaler)
 Sets a new imu scaling factor.
 
double drive_imu_scaler_get ()
 Returns the current imu scaling factor.
 
bool drive_imu_calibrate (bool run_loading_animation=true)
 Calibrates the IMU, recommended to run in initialize().
 
bool drive_imu_calibrated ()
 Checks if the imu calibrated successfully or if it took longer than expected.
 
void drive_imu_display_loading (int iter)
 Loading display while the IMU calibrates.
 
void opcontrol_joystick_practicemode_toggle (bool toggle)
 Practice mode for driver practice that shuts off the drive if you go max speed.
 
bool opcontrol_joystick_practicemode_toggle_get ()
 Gets current state of the toggle.
 
void opcontrol_drive_reverse_set (bool toggle)
 Reversal for drivetrain in opcontrol that flips the left and right side and the direction of the drive.
 
bool opcontrol_drive_reverse_get ()
 Gets current state of the toggle.
 
void pid_odom_set (double target, int speed)
 Sets the robot to move forward using PID without okapi units, only using slew if globally enabled.
 
void pid_odom_set (double target, int speed, bool slew_on)
 Sets the robot to move forward using PID without okapi units, using slew if enabled for this motion.
 
void pid_odom_set (okapi::QLength p_target, int speed)
 Sets the robot to move forward using PID with okapi units, only using slew if globally enabled.
 
void pid_odom_set (okapi::QLength p_target, int speed, bool slew_on)
 Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.
 
void pid_odom_set (odom imovement)
 Takes in an odom movement to go to a single point.
 
void pid_odom_set (odom imovement, bool slew_on)
 Takes in an odom movement to go to a single point.
 
void pid_odom_ptp_set (odom imovement)
 Takes in an odom movement to go to a single point.
 
void pid_odom_ptp_set (odom imovement, bool slew_on)
 Takes in an odom movement to go to a single point.
 
void pid_odom_boomerang_set (odom imovement)
 Takes in an odom movement to go to a single point using boomerang.
 
void pid_odom_boomerang_set (odom imovement, bool slew_on)
 Takes in an odom movement to go to a single point using boomerang.
 
void pid_odom_boomerang_set (united_odom p_imovement)
 Takes in an odom movement to go to a single point using boomerang.
 
void pid_odom_boomerang_set (united_odom p_imovement, bool slew_on)
 Takes in an odom movement to go to a single point using boomerang.
 
void pid_odom_ptp_set (united_odom p_imovement)
 Takes in an odom movement to go to a single point.
 
void pid_odom_ptp_set (united_odom p_imovement, bool slew_on)
 Takes in an odom movement to go to a single point.
 
void pid_odom_set (united_odom p_imovement)
 Takes in an odom movement to go to a single point.
 
void pid_odom_set (united_odom p_imovement, bool slew_on)
 Takes in an odom movement to go to a single point.
 
void pid_odom_set (std::vector< odom > imovements)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_set (std::vector< odom > imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_pp_set (std::vector< odom > imovements)
 Takes in odom movements to go through multiple points.
 
void pid_odom_pp_set (std::vector< odom > imovements, bool slew_on)
 Takes in odom movements to go through multiple points.
 
void pid_odom_injected_pp_set (std::vector< odom > imovements)
 Takes in odom movements to go through multiple points, will inject into the path.
 
void pid_odom_injected_pp_set (std::vector< odom > imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject into the path.
 
void pid_odom_smooth_pp_set (std::vector< odom > imovements)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_smooth_pp_set (std::vector< odom > imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_smooth_pp_set (std::vector< united_odom > p_imovements)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_smooth_pp_set (std::vector< united_odom > p_imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_injected_pp_set (std::vector< united_odom > p_imovements)
 Takes in odom movements to go through multiple points, will inject into the path.
 
void pid_odom_injected_pp_set (std::vector< united_odom > p_imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject into the path.
 
void pid_odom_pp_set (std::vector< united_odom > p_imovements)
 Takes in odom movements to go through multiple points.
 
void pid_odom_pp_set (std::vector< united_odom > p_imovements, bool slew_on)
 Takes in odom movements to go through multiple points.
 
void pid_odom_set (std::vector< united_odom > p_imovements)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_odom_set (std::vector< united_odom > p_imovements, bool slew_on)
 Takes in odom movements to go through multiple points, will inject and smooth the path.
 
void pid_drive_set (okapi::QLength p_target, int speed)
 Sets the robot to move forward using PID with okapi units, only using slew if globally enabled.
 
void pid_drive_set (okapi::QLength p_target, int speed, bool slew_on, bool toggle_heading=true)
 Sets the robot to move forward using PID with okapi units, using slew if enabled for this motion.
 
void pid_drive_set (double target, int speed)
 Sets the robot to move forward using PID without okapi units, only using slew if globally enabled.
 
void pid_drive_set (double target, int speed, bool slew_on, bool toggle_heading=true)
 Sets the robot to move forward using PID without okapi units, using slew if enabled for this motion.
 
void pid_turn_set (pose itarget, drive_directions dir, int speed)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (pose itarget, drive_directions dir, int speed, bool slew_on)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (pose itarget, drive_directions dir, int speed, e_angle_behavior behavior)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (pose itarget, drive_directions dir, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (united_pose p_itarget, drive_directions dir, int speed)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (united_pose p_itarget, drive_directions dir, int speed, bool slew_on)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (united_pose p_itarget, drive_directions dir, int speed, e_angle_behavior behavior)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (united_pose p_itarget, drive_directions dir, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn face a point using PID and odometry.
 
void pid_turn_set (double target, int speed)
 Sets the robot to turn relative to initial heading using PID.
 
void pid_turn_set (double target, int speed, e_angle_behavior behavior)
 Sets the robot to turn relative to initial heading using PID.
 
void pid_turn_set (double target, int speed, bool slew_on)
 Sets the robot to turn relative to initial heading using PID, using slew if enabled for this motion.
 
void pid_turn_set (double target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn relative to initial heading using PID, using slew if enabled for this motion.
 
void pid_turn_set (okapi::QAngle p_target, int speed)
 Sets the robot to turn relative to initial heading using PID with okapi units.
 
void pid_turn_set (okapi::QAngle p_target, int speed, e_angle_behavior behavior)
 Sets the robot to turn relative to initial heading using PID with okapi units.
 
void pid_turn_set (okapi::QAngle p_target, int speed, bool slew_on)
 Sets the robot to turn relative to initial heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_turn_set (okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn relative to initial heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_turn_relative_set (okapi::QAngle p_target, int speed)
 Sets the robot to turn relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_turn_relative_set (okapi::QAngle p_target, int speed, e_angle_behavior behavior)
 Sets the robot to turn relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_turn_relative_set (okapi::QAngle p_target, int speed, bool slew_on)
 Sets the robot to turn relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_turn_relative_set (okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_turn_relative_set (double target, int speed)
 Sets the robot to turn relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_turn_relative_set (double target, int speed, e_angle_behavior behavior)
 Sets the robot to turn relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_turn_relative_set (double target, int speed, bool slew_on)
 Sets the robot to turn relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_turn_relative_set (double target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, double target, int speed)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, double target, int speed, e_angle_behavior behavior)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, double target, int speed, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, double target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, double target, int speed, int opposite_speed)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, double target, int speed, int opposite_speed, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, bool slew_on)
 Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.
 
void pid_swing_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn only using the left or right side relative to initial heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, okapi::QAngle p_target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, double target, int speed)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, double target, int speed, e_angle_behavior behavior)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, double target, int speed, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, double target, int speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, double target, int speed, int opposite_speed)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.
 
void pid_swing_relative_set (e_swing type, double target, int speed, int opposite_speed, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_swing_relative_set (e_swing type, double target, int speed, int opposite_speed, e_angle_behavior behavior, bool slew_on)
 Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.
 
void pid_targets_reset ()
 Resets all PID targets to 0.
 
void drive_angle_set (okapi::QAngle p_angle)
 Sets heading of imu and target of PID, okapi angle.
 
void drive_angle_set (double angle)
 Sets heading of imu and target of PID, takes double as an angle.
 
void pid_wait ()
 Lock the code in a while loop until the robot has settled.
 
void pid_wait_until (okapi::QAngle target)
 Lock the code in a while loop until this position has passed for turning or swinging with okapi units.
 
void pid_wait_until (okapi::QLength target)
 Lock the code in a while loop until this position has passed for driving with okapi units.
 
void pid_wait_until (double target)
 Lock the code in a while loop until this position has passed for driving without okapi units.
 
void pid_wait_quick ()
 Lock the code in a while loop until the robot has settled.
 
void pid_wait_quick_chain ()
 Lock the code in a while loop until the robot has settled.
 
void pid_wait_until_index (int index)
 Lock the code in a while loop until this point has been passed.
 
void pid_wait_until_index_started (int index)
 Lock the code in a while loop until this point becomes the target.
 
void pid_wait_until_point (pose target)
 Lock the code in a while loop until this point has been passed.
 
void pid_wait_until_point (united_pose target)
 Lock the code in a while loop until this point has been passed, with okapi units.
 
void pid_wait_until (pose target)
 Lock the code in a while loop until this point has been passed.
 
void pid_wait_until (united_pose target)
 Lock the code in a while loop until this point has been passed, with okapi units.
 
void drive_ratio_set (double ratio)
 Set the ratio of the robot.
 
void drive_rpm_set (double rpm)
 Set the cartridge/wheel rpm of the robot.
 
double drive_ratio_get ()
 Returns the ratio of the drive.
 
double drive_rpm_get ()
 Returns the current cartridge / wheel rpm.
 
void pid_speed_max_set (int speed)
 Changes max speed during a drive motion.
 
int pid_speed_max_get ()
 Returns max speed of drive during autonomous.
 
void pid_turn_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the turn pid constants object.
 
PID::Constants pid_turn_constants_get ()
 Returns PID constants with PID::Constants.
 
void pid_turn_chain_constant_set (okapi::QAngle input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_turn_chain_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
double pid_turn_chain_constant_get ()
 Returns the amount that the PID will overshoot target by to maintain momentum into the next motion for turning.
 
void pid_swing_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the swing pid constants object.
 
PID::Constants pid_swing_constants_get ()
 Returns PID constants with PID::Constants.
 
void pid_swing_constants_forward_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the forward swing pid constants object.
 
PID::Constants pid_swing_constants_forward_get ()
 Returns PID constants with PID::Constants.
 
void pid_swing_constants_backward_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the backward swing pid constants object.
 
PID::Constants pid_swing_constants_backward_get ()
 Returns PID constants with PID::Constants.
 
void pid_swing_chain_constant_set (okapi::QAngle input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_swing_chain_forward_constant_set (okapi::QAngle input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_swing_chain_backward_constant_set (okapi::QAngle input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_swing_chain_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_swing_chain_forward_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
double 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.
 
void pid_swing_chain_backward_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
double 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.
 
void pid_heading_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the heading pid constants object.
 
PID::Constants pid_heading_constants_get ()
 Returns PID constants with PID::Constants.
 
void pid_drive_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the drive pid constants object.
 
PID::Constants pid_drive_constants_get ()
 Returns PID constants with PID::Constants.
 
void pid_drive_constants_forward_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the forward pid constants object.
 
PID::Constants pid_drive_constants_forward_get ()
 Returns PID constants with PID::Constants.
 
void pid_drive_constants_backward_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the backwards pid constants object.
 
PID::Constants pid_drive_constants_backward_get ()
 Returns PID constants with PID::Constants.
 
void pid_drive_chain_constant_set (okapi::QLength input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_drive_chain_forward_constant_set (okapi::QLength input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_drive_chain_backward_constant_set (okapi::QLength input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_drive_chain_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
void pid_drive_chain_forward_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
double 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.
 
void pid_drive_chain_backward_constant_set (double input)
 Sets the amount that the PID will overshoot target by to maintain momentum into the next motion.
 
double 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.
 
void pid_swing_min_set (int min)
 Sets minimum power for swings when kI and startI are enabled.
 
void pid_turn_min_set (int min)
 The minimum power for turns when kI and startI are enabled.
 
int pid_swing_min_get ()
 Returns minimum power for swings when kI and startI are enabled.
 
int pid_turn_min_get ()
 Returns minimum power for turns when kI and startI are enabled.
 
void pid_odom_angular_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the odom angular pid constants object.
 
void pid_odom_boomerang_constants_set (double p, double i=0.0, double d=0.0, double p_start_i=0.0)
 Set the odom boomerang pid constants object.
 
void pid_odom_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, bool use_imu=true)
 Set's constants for odom driving exit conditions.
 
void pid_odom_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)
 Set's constants for odom turning exit conditions.
 
void pid_odom_turn_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, bool use_imu=true)
 Set's constants for odom turning exit conditions.
 
void pid_odom_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, bool use_imu=true)
 Set's constants for odom driving exit conditions.
 
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, bool use_imu=true)
 Set's constants for drive exit conditions.
 
void pid_turn_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, bool use_imu=true)
 Set's constants for turn exit conditions.
 
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, bool use_imu=true)
 Set's constants for swing exit conditions.
 
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, bool use_imu=true)
 Set's constants for drive exit conditions.
 
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)
 Set's constants for turn exit conditions.
 
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, bool use_imu=true)
 Set's constants for swing exit conditions.
 
double drive_tick_per_inch ()
 Returns current tick_per_inch.
 
void opcontrol_curve_buttons_iterate ()
 Iterates modifying controller curves with the controller.
 
void pid_tuner_enable ()
 Enables PID Tuner.
 
void pid_tuner_disable ()
 Disables PID Tuner.
 
void pid_tuner_toggle ()
 Toggles PID tuner between enabled and disabled.
 
bool pid_tuner_enabled ()
 Checks if PID Tuner is enabled.
 
void pid_tuner_iterate ()
 Iterates through controller inputs to modify PID constants.
 
void pid_tuner_print_brain_set (bool input)
 Toggle for printing the display of the PID Tuner to the brain.
 
void pid_tuner_print_terminal_set (bool input)
 Toggle for printing the display of the PID Tuner to the terminal.
 
bool pid_tuner_print_terminal_enabled ()
 Returns true if printing to terminal is enabled.
 
bool pid_tuner_print_brain_enabled ()
 Returns true if printing to brain is enabled.
 
void pid_tuner_increment_p_set (double p)
 Sets the value that PID Tuner increments P.
 
void pid_tuner_increment_i_set (double i)
 Sets the value that PID Tuner increments I.
 
void pid_tuner_increment_d_set (double d)
 Sets the value that PID Tuner increments D.
 
void pid_tuner_increment_start_i_set (double start_i)
 Sets the value that PID Tuner increments Start I.
 
double pid_tuner_increment_p_get ()
 Returns the value that PID Tuner increments P.
 
double pid_tuner_increment_i_get ()
 Returns the value that PID Tuner increments I.
 
double pid_tuner_increment_d_get ()
 Returns the value that PID Tuner increments D.
 
double pid_tuner_increment_start_i_get ()
 Returns the value that PID Tuner increments Start I.
 
void pid_tuner_full_enable (bool enable)
 Enables the full PID tuner with unique fwd/rev constants.
 
bool pid_tuner_full_enabled ()
 Returns if the full PID tuner with unique fwd/rev constants is enabled.
 
void opcontrol_speed_max_set (int speed)
 Sets the max speed for user control.
 
int opcontrol_speed_max_get ()
 Returns the max speed for user control.
 
void opcontrol_arcade_scaling (bool enable)
 Toggles vector scaling for arcade control.
 
bool opcontrol_arcade_scaling_enabled ()
 Returns if vector scaling for arcade control is enabled.
 

Public Attributes

int JOYSTICK_THRESHOLD
 Joysticks will return 0 when they are within this number.
 
pros::motor_brake_mode_e_t CURRENT_BRAKE = pros::E_MOTOR_BRAKE_COAST
 Global current brake mode.
 
int CURRENT_MA = 2500
 Global current mA.
 
e_swing current_swing
 Current swing type.
 
std::vector< pros::Motor > left_motors
 Vector of pros motors for the left chassis.
 
std::vector< pros::Motor > right_motors
 Vector of pros motors for the right chassis.
 
std::vector< int > pto_active
 Vector of pros motors that are disconnected from the drive.
 
pros::Imu imu
 Inertial sensor.
 
pros::adi::Encoder left_tracker
 Deprecated left tracking wheel.
 
pros::adi::Encoder right_tracker
 Deprecated right tracking wheel.
 
pros::Rotation left_rotation
 Deprecated left rotation tracker.
 
pros::Rotation right_rotation
 Deprecated right rotation tracker.
 
tracking_wheelodom_tracker_left
 Left vertical tracking wheel.
 
tracking_wheelodom_tracker_right
 Right vertical tracking wheel.
 
tracking_wheelodom_tracker_front
 Front horizontal tracking wheel.
 
tracking_wheelodom_tracker_back
 Back horizontal tracking wheel.
 
PID headingPID
 PID objects.
 
PID turnPID
 
PID leftPID
 
PID rightPID
 
PID forward_drivePID
 
PID backward_drivePID
 
PID fwd_rev_drivePID
 
PID swingPID
 
PID forward_swingPID
 
PID backward_swingPID
 
PID fwd_rev_swingPID
 
PID xyPID
 
PID current_a_odomPID
 
PID boomerangPID
 
PID odom_angularPID
 
PID internal_leftPID
 
PID internal_rightPID
 
PID left_activebrakePID
 
PID right_activebrakePID
 
light::slew slew_left
 Slew objects.
 
light::slew slew_right
 
light::slew slew_forward
 
light::slew slew_backward
 
light::slew slew_turn
 
light::slew slew_swing_forward
 
light::slew slew_swing_backward
 
light::slew slew_swing
 
double friction_kS = 0.0
 Friction-feedforward coefficients in motor-command units (-127..127).
 
double friction_kV = 0.0
 
double friction_kQ = 0.0
 
e_mode mode
 Current mode of the drive.
 
pros::Task ez_auto
 Tasks for autonomous.
 
bool interfered = false
 Autonomous interference detection.
 
std::vector< const_and_namepid_tuner_pids
 Vector used for a simplified PID Tuner.
 
std::vector< const_and_namepid_tuner_full_pids
 Vector used for the full PID Tuner.
 

Detailed Description

Tank-drive chassis class.

Owns the left/right motor groups, IMU, optional tracking wheels, and the full PID/slew tuning surface. After construction, autonomous moves are dispatched via the pid_drive_set / pid_turn_set / pid_swing_set / pid_odom_set family with paired pid_wait* calls, and the opcontrol loop is driven by opcontrol_* helpers.

Lifecycle
  1. Construct in main.cpp.
  2. Call initialize() (or use the LightLib chassis_initialize() wrapper) early in PROS initialize().
  3. Set PID + exit constants (typically in default_constants()).
  4. Call motion primitives from autons; opcontrol helpers from opcontrol.

Definition at line 72 of file drive.hpp.

Constructor & Destructor Documentation

◆ Drive() [1/4]

light::Drive::Drive ( std::vector< int >  left_motor_ports,
std::vector< int >  right_motor_ports,
int  imu_port,
double  wheel_diameter,
double  ticks,
double  ratio = 1.0 
)

Creates a Drive Controller using internal encoders.

Parameters
left_motor_portsinput {1, -2...}. make ports negative if reversed
right_motor_portsinput {-3, 4...}. make ports negative if reversed
imu_portport the IMU is plugged into
wheel_diameterdiameter of your drive wheels
ticksmotor cartridge RPM
ratioexternal gear ratio, wheel gear / motor gear

◆ Drive() [2/4]

light::Drive::Drive ( std::vector< int >  left_motor_ports,
std::vector< int >  right_motor_ports,
int  imu_port,
double  wheel_diameter,
double  ticks,
double  ratio,
std::vector< int >  left_tracker_ports,
std::vector< int >  right_tracker_ports 
) const

Creates a Drive Controller using encoders plugged into the brain.

Parameters
left_motor_portsinput {1, -2...}. make ports negative if reversed
right_motor_portsinput {-3, 4...}. make ports negative if reversed
imu_portport the IMU is plugged into
wheel_diameterdiameter of your sensored wheel
ticksticks per revolution of your encoder
ratioexternal gear ratio, wheel gear / sensor gear
left_tracker_portsinput {1, 2}. make ports negative if reversed
right_tracker_portsinput {3, 4}. make ports negative if reversed

◆ Drive() [3/4]

light::Drive::Drive ( std::vector< int >  left_motor_ports,
std::vector< int >  right_motor_ports,
int  imu_port,
double  wheel_diameter,
double  ticks,
double  ratio,
std::vector< int >  left_tracker_ports,
std::vector< int >  right_tracker_ports,
int  expander_smart_port 
) const

Creates a Drive Controller using encoders plugged into a 3 wire expander.

Parameters
left_motor_portsinput {1, -2...}. make ports negative if reversed
right_motor_portsinput {-3, 4...}. make ports negative if reversed
imu_portport the IMU is plugged into
wheel_diameterdiameter of your sensored wheel
ticksticks per revolution of your encoder
ratioexternal gear ratio, wheel gear / sensor gear
left_tracker_portsinput {1, 2}. make ports negative if reversed
right_tracker_portsinput {3, 4}. make ports negative if reversed
expander_smart_portport the expander is plugged into

◆ Drive() [4/4]

light::Drive::Drive ( std::vector< int >  left_motor_ports,
std::vector< int >  right_motor_ports,
int  imu_port,
double  wheel_diameter,
double  ratio,
int  left_rotation_port,
int  right_rotation_port 
) const

Creates a Drive Controller using rotation sensors.

Parameters
left_motor_portsinput {1, -2...}. make ports negative if reversed
right_motor_portsinput {-3, 4...}. make ports negative if reversed
imu_portport the IMU is plugged into
wheel_diameterdiameter of your sensored wheel
ratioexternal gear ratio, wheel gear / sensor gear
left_tracker_portmake ports negative if reversed
right_tracker_portmake ports negative if reversed

Member Function Documentation

◆ drive_angle_set() [1/2]

void light::Drive::drive_angle_set ( double  angle)

Sets heading of imu and target of PID, takes double as an angle.

◆ drive_angle_set() [2/2]

void light::Drive::drive_angle_set ( okapi::QAngle  p_angle)

Sets heading of imu and target of PID, okapi angle.

◆ drive_brake_get()

pros::motor_brake_mode_e_t light::Drive::drive_brake_get ( )

Returns the brake mode of the drive in pros_brake_mode_e_t_.

◆ drive_brake_set()

void light::Drive::drive_brake_set ( pros::motor_brake_mode_e_t  brake_type)

Changes the way the drive behaves when it is not under active user control.

Parameters
brake_typethe 'brake mode' of the motor e.g. 'pros::E_MOTOR_BRAKE_COAST' 'pros::E_MOTOR_BRAKE_BRAKE' 'pros::E_MOTOR_BRAKE_HOLD'

◆ drive_current_left_over()

bool light::Drive::drive_current_left_over ( )

Return true when the motor is over current.

◆ drive_current_limit_get()

int light::Drive::drive_current_limit_get ( )

Gets the limit for the current on the drive.

◆ drive_current_limit_set()

void light::Drive::drive_current_limit_set ( int  mA)

Sets the limit for the current on the drive.

Parameters
mAinput in milliamps

◆ drive_current_right_over()

bool light::Drive::drive_current_right_over ( )

Return true when the motor is over current.

◆ drive_defaults_set()

void light::Drive::drive_defaults_set ( )

Sets drive defaults.

◆ drive_get()

std::vector< int > light::Drive::drive_get ( )

Gets the chassis to voltage, -127 to 127.

Returns {left, right}.

◆ drive_imu_accel_get()

double light::Drive::drive_imu_accel_get ( )

Returns the current imu accel x + accel y value.

◆ drive_imu_calibrate()

bool light::Drive::drive_imu_calibrate ( bool  run_loading_animation = true)

Calibrates the IMU, recommended to run in initialize().

Parameters
run_loading_animationtrue runs the animation, false doesn't

◆ drive_imu_calibrated()

bool light::Drive::drive_imu_calibrated ( )

Checks if the imu calibrated successfully or if it took longer than expected.

Returns true if calibrated successfully, and false if unsuccessful.

◆ drive_imu_display_loading()

void light::Drive::drive_imu_display_loading ( int  iter)

Loading display while the IMU calibrates.

◆ drive_imu_get()

double light::Drive::drive_imu_get ( )

Returns the current imu rotation value in degrees.

◆ drive_imu_reset()

void light::Drive::drive_imu_reset ( double  new_heading = 0)

Resets the current imu value.

Defaults to 0, recommended to run at the start of your autonomous routine.

Parameters
new_headingnew heading value

◆ drive_imu_scaler_get()

double light::Drive::drive_imu_scaler_get ( )

Returns the current imu scaling factor.

◆ drive_imu_scaler_set()

void light::Drive::drive_imu_scaler_set ( double  scaler)

Sets a new imu scaling factor.

This value is multiplied by the imu to change its output.

Parameters
scalerfactor to scale the imu by

◆ drive_mA_left()

double light::Drive::drive_mA_left ( )

The watts of the left motor.

◆ drive_mA_right()

double light::Drive::drive_mA_right ( )

The watts of the right motor.

◆ drive_mode_get()

e_mode light::Drive::drive_mode_get ( )

Returns current mode of drive.

◆ drive_mode_set()

void light::Drive::drive_mode_set ( e_mode  p_mode,
bool  stop_drive = true 
)

Sets current mode of drive.

Parameters
p_modethe new drive mode
stop_driveif the drive will stop when p_mode is DISABLED

◆ drive_ratio_get()

double light::Drive::drive_ratio_get ( )

Returns the ratio of the drive.

◆ drive_ratio_set()

void light::Drive::drive_ratio_set ( double  ratio)

Set the ratio of the robot.

Parameters
ratioratio of the gears

◆ drive_rpm_get()

double light::Drive::drive_rpm_get ( )

Returns the current cartridge / wheel rpm.

◆ drive_rpm_set()

void light::Drive::drive_rpm_set ( double  rpm)

Set the cartridge/wheel rpm of the robot.

Parameters
rpmrpm of the cartridge or wheel

◆ drive_sensor_left()

double light::Drive::drive_sensor_left ( )

The position of the left sensor in inches.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

◆ drive_sensor_left_raw()

int light::Drive::drive_sensor_left_raw ( )

The position of the left sensor.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

◆ drive_sensor_reset()

void light::Drive::drive_sensor_reset ( )

Reset all the chassis motors and tracking wheels, recommended to run at the start of your autonomous routine.

◆ drive_sensor_right()

double light::Drive::drive_sensor_right ( )

The position of the right sensor in inches.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

◆ drive_sensor_right_raw()

int light::Drive::drive_sensor_right_raw ( )

The position of the right sensor.

If you have two parallel tracking wheels, this will return tracking wheel position. Otherwise this returns motor position.

◆ drive_set()

void light::Drive::drive_set ( int  left,
int  right 
)

Sets the chassis to voltage.

Disables PID when called.

Parameters
leftvoltage for left side, -127 to 127
rightvoltage for right side, -127 to 127

◆ drive_tick_per_inch()

double light::Drive::drive_tick_per_inch ( )

Returns current tick_per_inch.

◆ drive_velocity_left()

int light::Drive::drive_velocity_left ( )

The velocity of the left motor.

◆ drive_velocity_right()

int light::Drive::drive_velocity_right ( )

The velocity of the right motor.

◆ drive_width_get()

double light::Drive::drive_width_get ( )

Returns the width of the drive.

◆ drive_width_set() [1/2]

void light::Drive::drive_width_set ( double  input)

Sets the width of the drive.

This is used for tracking.

Parameters
inputa unit in inches, from center of the wheel to center of the wheel

◆ drive_width_set() [2/2]

void light::Drive::drive_width_set ( okapi::QLength  p_input)

Sets the width of the drive.

This is used for tracking.

Parameters
inputan okapi unit, from center of the wheel to center of the wheel

◆ ez_tracking_task()

void light::Drive::ez_tracking_task ( )

Tasks for tracking.

◆ friction_constants_get()

std::vector< double > light::Drive::friction_constants_get ( )

Returns {kS, kV, kQ}.

◆ friction_constants_set()

void light::Drive::friction_constants_set ( double  kS,
double  kV = 0.0,
double  kQ = 0.0 
)

Sets the friction-feedforward coefficients.

Pass all zeros to disable.

Parameters
kSstatic break-away (motor-cmd units, -127..127)
kVviscous coefficient
kQquadratic-drag coefficient

◆ friction_ff()

double light::Drive::friction_ff ( double  v_target)

Computes the friction-feedforward term for a target motor-cmd-unit velocity.

Returns 0 when all coefficients are 0.

◆ initialize()

void light::Drive::initialize ( )

Calibrates imu and initializes sd card to curve.

◆ odom_boomerang_distance_get()

double light::Drive::odom_boomerang_distance_get ( )

Returns how far away the carrot point can be from target.

◆ odom_boomerang_distance_set() [1/2]

void light::Drive::odom_boomerang_distance_set ( double  distance)

Sets how far away the carrot point can be from the target point.

Parameters
distancedistance in inches

◆ odom_boomerang_distance_set() [2/2]

void light::Drive::odom_boomerang_distance_set ( okapi::QLength  p_distance)

Sets how far away the carrot point can be from the target point.

Parameters
distancedistance as an okapi unit

◆ odom_boomerang_dlead_get()

double light::Drive::odom_boomerang_dlead_get ( )

Returns the current dlead.

◆ odom_boomerang_dlead_set()

void light::Drive::odom_boomerang_dlead_set ( double  input)

Sets a new dlead.

Dlead is a proportional value of how much to make the robot curve during boomerang motions.

Parameters
inputa value between 0 and 1

◆ odom_enable()

void light::Drive::odom_enable ( bool  input)

Enables / disables tracking.

Parameters
inputtrue enables tracking, false disables tracking

◆ odom_enabled()

bool light::Drive::odom_enabled ( )

Returns whether the bot is tracking with odometry.

True means tracking is enabled, false means tracking is disabled.

◆ odom_look_ahead_get()

double light::Drive::odom_look_ahead_get ( )

Returns how far away the robot looks in the path during pure pursuits.

◆ odom_look_ahead_set() [1/2]

void light::Drive::odom_look_ahead_set ( double  distance)

Sets how far away the robot looks in the path during pure pursuits.

Parameters
distancehow long the "carrot on a stick" is, in inches

◆ odom_look_ahead_set() [2/2]

void light::Drive::odom_look_ahead_set ( okapi::QLength  p_distance)

Sets how far away the robot looks in the path during pure pursuits.

Parameters
distancehow long the "carrot on a stick" is, in okapi units

◆ odom_path_print()

void light::Drive::odom_path_print ( )

Prints the current path the robot is following.

◆ odom_path_smooth_constants_get()

std::vector< double > light::Drive::odom_path_smooth_constants_get ( )

Returns the constants for smoothing out a path.

In order of:

  • weight_smooth
  • weight_data
  • tolerance

◆ odom_path_smooth_constants_set()

void light::Drive::odom_path_smooth_constants_set ( double  weight_smooth,
double  weight_data,
double  tolerance 
)

Sets the constants for smoothing out a path.

Path smoothing based on https://medium.com/@jaems33/understanding-robot-motion-path-smoothing-5970c8363bc4

Parameters
weight_smoothhow much weight to update the data
weight_datahow much weight to smooth the coordinates
tolerancehow much change per iteration is necessary to keep iterating

◆ odom_path_spacing_get()

double light::Drive::odom_path_spacing_get ( )

Returns the spacing between points when points get injected into the path.

◆ odom_path_spacing_set() [1/2]

void light::Drive::odom_path_spacing_set ( double  spacing)

Sets the spacing between points when points get injected into the path.

Parameters
spacinga small number in inches

◆ odom_path_spacing_set() [2/2]

void light::Drive::odom_path_spacing_set ( okapi::QLength  p_spacing)

Sets the spacing between points when points get injected into the path.

Parameters
spacinga small number in okapi units

◆ odom_pose_get()

pose light::Drive::odom_pose_get ( )

Returns the current pose of the robot.

◆ odom_pose_set() [1/2]

void light::Drive::odom_pose_set ( pose  itarget)

Sets the current pose of the robot.

Parameters
itarget{x, y, t} units in inches and degrees

◆ odom_pose_set() [2/2]

void light::Drive::odom_pose_set ( united_pose  itarget)

Sets the current pose of the robot.

Parameters
itarget{x, y, t} as an okapi unit

◆ odom_reset()

void light::Drive::odom_reset ( )

Resets xyt to 0.

◆ odom_theta_direction_get()

bool light::Drive::odom_theta_direction_get ( )

Checks if the rotation axis is flipped.

True means counterclockwise is positive, false means clockwise is positive.

◆ odom_theta_flip()

void light::Drive::odom_theta_flip ( bool  flip = true)

Flips the rotation axis.

Parameters
fliptrue means counterclockwise is positive, false means clockwise is positive

◆ odom_theta_get()

double light::Drive::odom_theta_get ( )

Returns the current Theta of the robot in degrees.

◆ odom_theta_set() [1/2]

void light::Drive::odom_theta_set ( double  a)

Sets the current angle of the robot.

Parameters
anew angle in degrees

◆ odom_theta_set() [2/2]

void light::Drive::odom_theta_set ( okapi::QAngle  p_a)

Sets the current Theta of the robot.

Parameters
p_anew angle as an okapi unit

◆ odom_tracker_back_set()

void light::Drive::odom_tracker_back_set ( tracking_wheel input)

Sets the perpendicular back tracking wheel for odometry.

Parameters
inputan light::tracking_wheel

◆ odom_tracker_front_set()

void light::Drive::odom_tracker_front_set ( tracking_wheel input)

Sets the perpendicular front tracking wheel for odometry.

Parameters
inputan light::tracking_wheel

◆ odom_tracker_left_set()

void light::Drive::odom_tracker_left_set ( tracking_wheel input)

Sets the parallel left tracking wheel for odometry.

Parameters
inputan light::tracking_wheel

◆ odom_tracker_right_set()

void light::Drive::odom_tracker_right_set ( tracking_wheel input)

Sets the parallel right tracking wheel for odometry.

Parameters
inputan light::tracking_wheel

◆ odom_turn_bias_get()

double light::Drive::odom_turn_bias_get ( )

Returns the proportion of how prioritized turning is during odometry motions.

◆ odom_turn_bias_set()

void light::Drive::odom_turn_bias_set ( double  bias)

A proportion of how prioritized turning is during odometry motions.

Turning is prioritized so the robot "applies brakes" while turning. Lower number means more braking.

Parameters
biasa number between 0 and 1

◆ odom_x_direction_get()

bool light::Drive::odom_x_direction_get ( )

Checks if X axis is flipped.

True means left is positive X, false means right is positive X.

◆ odom_x_flip()

void light::Drive::odom_x_flip ( bool  flip = true)

Flips the X axis.

Parameters
fliptrue means left is positive x, false means right is positive x

◆ odom_x_get()

double light::Drive::odom_x_get ( )

Returns the current X coordinate of the robot in inches.

◆ odom_x_set() [1/2]

void light::Drive::odom_x_set ( double  x)

Sets the current X coordinate of the robot.

Parameters
xnew x coordinate in inches

◆ odom_x_set() [2/2]

void light::Drive::odom_x_set ( okapi::QLength  p_x)

Sets the current X coordinate of the robot.

Parameters
p_xnew x coordinate as an okapi unit

◆ odom_xy_set() [1/2]

void light::Drive::odom_xy_set ( double  x,
double  y 
)

Sets the current X and Y coordinate for the robot.

Parameters
xnew x value, in inches
ynew y value, in inches

◆ odom_xy_set() [2/2]

void light::Drive::odom_xy_set ( okapi::QLength  p_x,
okapi::QLength  p_y 
)

Sets the current X and Y coordinate for the robot.

Parameters
p_xnew x value, okapi unit
p_ynew y value, okapi unit

◆ odom_xyt_set() [1/2]

void light::Drive::odom_xyt_set ( double  x,
double  y,
double  t 
)

Sets the current X, Y, and Theta values for the robot.

Parameters
xnew x value, in inches
ynew y value, in inches
tnew theta value, in degrees

◆ odom_xyt_set() [2/2]

void light::Drive::odom_xyt_set ( okapi::QLength  p_x,
okapi::QLength  p_y,
okapi::QAngle  p_t 
)

Sets the current X, Y, and Theta values for the robot.

Parameters
p_xnew x value, okapi unit
p_ynew y value, okapi unit
p_tnew theta value, okapi unit

◆ odom_y_direction_get()

bool light::Drive::odom_y_direction_get ( )

Checks if Y axis is flipped.

True means down is positive Y, false means up is positive Y.

◆ odom_y_flip()

void light::Drive::odom_y_flip ( bool  flip = true)

Flips the Y axis.

Parameters
fliptrue means down is positive y, false means up is positive y

◆ odom_y_get()

double light::Drive::odom_y_get ( )

Returns the current Y coordinate of the robot in inches.

◆ odom_y_set() [1/2]

void light::Drive::odom_y_set ( double  y)

Sets the current Y coordinate of the robot.

Parameters
ynew y coordinate in inches

◆ odom_y_set() [2/2]

void light::Drive::odom_y_set ( okapi::QLength  p_y)

Sets the current Y coordinate of the robot.

Parameters
p_ynew y coordinate as an okapi unit

◆ opcontrol_arcade_flipped()

void light::Drive::opcontrol_arcade_flipped ( e_type  stick_type)

Sets the chassis to controller joysticks using flipped arcade control, where right stick is fwd/rev.

Run in usercontrol.

This passes the controller through the curve functions, but is disabled by default. Use opcontrol_curve_buttons_toggle() to enable it.

Parameters
stick_typelight::SINGLE or light::SPLIT control

◆ opcontrol_arcade_scaling()

void light::Drive::opcontrol_arcade_scaling ( bool  enable)

Toggles vector scaling for arcade control.

True enables, false disables.

Parameters
booltrue enables, false disables

◆ opcontrol_arcade_scaling_enabled()

bool light::Drive::opcontrol_arcade_scaling_enabled ( )

Returns if vector scaling for arcade control is enabled.

True enables, false disables.

◆ opcontrol_arcade_standard()

void light::Drive::opcontrol_arcade_standard ( e_type  stick_type)

Sets the chassis to controller joysticks using standard arcade control, where left stick is fwd/rev.

Run in usercontrol.

This passes the controller through the curve functions, but is disabled by default. Use opcontrol_curve_buttons_toggle() to enable it.

Parameters
stick_typelight::SINGLE or light::SPLIT control

◆ opcontrol_curve_buttons_iterate()

void light::Drive::opcontrol_curve_buttons_iterate ( )

Iterates modifying controller curves with the controller.

◆ opcontrol_curve_buttons_left_get()

std::vector< pros::controller_digital_e_t > light::Drive::opcontrol_curve_buttons_left_get ( )

Returns a vector of pros controller buttons user for the left joystick curve, in {decrease, increase}.

◆ opcontrol_curve_buttons_left_set()

void light::Drive::opcontrol_curve_buttons_left_set ( pros::controller_digital_e_t  decrease,
pros::controller_digital_e_t  increase 
)

Sets buttons for modifying the left joystick curve.

Parameters
decreasea pros button enumerator
increasea pros button enumerator

◆ opcontrol_curve_buttons_right_get()

std::vector< pros::controller_digital_e_t > light::Drive::opcontrol_curve_buttons_right_get ( )

Returns a vector of pros controller buttons user for the right joystick curve, in {decrease, increase}.

◆ opcontrol_curve_buttons_right_set()

void light::Drive::opcontrol_curve_buttons_right_set ( pros::controller_digital_e_t  decrease,
pros::controller_digital_e_t  increase 
)

Sets buttons for modifying the right joystick curve.

Parameters
decreasea pros button enumerator
increasea pros button enumerator

◆ opcontrol_curve_buttons_toggle()

void light::Drive::opcontrol_curve_buttons_toggle ( bool  toggle)

Enables/disables modifying the joystick input curves with the controller.

Parameters
inputtrue enables, false disables

◆ opcontrol_curve_buttons_toggle_get()

bool light::Drive::opcontrol_curve_buttons_toggle_get ( )

Gets the current state of the toggle.

Enables/disables modifying the joystick input curves with the controller.

True enabled, false disabled.

◆ opcontrol_curve_default_get()

std::vector< double > light::Drive::opcontrol_curve_default_get ( )

Gets the default joystick curves, in {left, right}.

◆ opcontrol_curve_default_set()

void light::Drive::opcontrol_curve_default_set ( double  left,
double  right = 0 
)

Sets the default joystick curves.

Parameters
leftleft default curve
rightright default curve

◆ opcontrol_curve_left()

double light::Drive::opcontrol_curve_left ( double  x)

Outputs a curve from 5225A In the Zone.

This gives more control over the robot at lower speeds.

Parameters
xjoystick input

◆ opcontrol_curve_right()

double light::Drive::opcontrol_curve_right ( double  x)

Outputs a curve from 5225A In the Zone.

This gives more control over the robot at lower speeds.

Parameters
xjoystick input

◆ opcontrol_curve_sd_initialize()

void light::Drive::opcontrol_curve_sd_initialize ( )

Initializes left and right curves with the SD card, recommended to run in initialize().

◆ opcontrol_drive_activebrake_constants_get()

PID::Constants light::Drive::opcontrol_drive_activebrake_constants_get ( )

Returns all PID constants for active brake.

◆ opcontrol_drive_activebrake_get()

double light::Drive::opcontrol_drive_activebrake_get ( )

Returns kP for active brake.

◆ opcontrol_drive_activebrake_set()

void light::Drive::opcontrol_drive_activebrake_set ( double  kp,
double  ki = 0.0,
double  kd = 0.0,
double  start_i = 0.0 
)

Runs a PID loop on the drive when the joysticks are released.

Parameters
kpproportional term
kiintegral term
kdderivative term
start_ierror threshold to start integral

◆ opcontrol_drive_reverse_get()

bool light::Drive::opcontrol_drive_reverse_get ( )

Gets current state of the toggle.

Reversal for drivetrain in opcontrol that flips the left and right side and the direction of the drive.

◆ opcontrol_drive_reverse_set()

void light::Drive::opcontrol_drive_reverse_set ( bool  toggle)

Reversal for drivetrain in opcontrol that flips the left and right side and the direction of the drive.

Parameters
toggletrue if you want your drivetrain reversed and false if you do not

◆ opcontrol_drive_sensors_reset()

void light::Drive::opcontrol_drive_sensors_reset ( )

Resets drive sensors at the start of opcontrol.

◆ opcontrol_joystick_practicemode_toggle()

void light::Drive::opcontrol_joystick_practicemode_toggle ( bool  toggle)

Practice mode for driver practice that shuts off the drive if you go max speed.

Parameters
toggletrue enables, false disables

◆ opcontrol_joystick_practicemode_toggle_get()

bool light::Drive::opcontrol_joystick_practicemode_toggle_get ( )

Gets current state of the toggle.

True is enabled, false is disabled.

◆ opcontrol_joystick_threshold_get()

int light::Drive::opcontrol_joystick_threshold_get ( )

Gets the threshold for the joystick.

◆ opcontrol_joystick_threshold_iterate()

void light::Drive::opcontrol_joystick_threshold_iterate ( int  l_stick,
int  r_stick 
)

Sets minimum value distance constants.

Parameters
l_stickinput for left joystick
r_stickinput for right joystick

◆ opcontrol_joystick_threshold_set()

void light::Drive::opcontrol_joystick_threshold_set ( int  threshold)

Sets a new threshold for the joystick.

The joysticks wil not return a value if they are within this.

Parameters
thresholdnew threshold

◆ opcontrol_speed_max_get()

int light::Drive::opcontrol_speed_max_get ( )

Returns the max speed for user control.

◆ opcontrol_speed_max_set()

void light::Drive::opcontrol_speed_max_set ( int  speed)

Sets the max speed for user control.

Parameters
intthe speed limit

◆ opcontrol_tank()

void light::Drive::opcontrol_tank ( )

Sets the chassis to controller joysticks using tank control.

Run in usercontrol.

This passes the controller through the curve functions, but is disabled by default. Use opcontrol_curve_buttons_toggle() to enable it.

◆ pid_angle_behavior_bias_get()

e_angle_behavior light::Drive::pid_angle_behavior_bias_get ( )

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

◆ pid_angle_behavior_bias_set()

void light::Drive::pid_angle_behavior_bias_set ( e_angle_behavior  behavior)

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

Parameters
behaviorlight::left or light::right

◆ pid_angle_behavior_set()

void light::Drive::pid_angle_behavior_set ( e_angle_behavior  behavior)

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

Parameters
behaviorlight::shortest, light::longest, light::left, light::right, light::raw

◆ pid_angle_behavior_tolerance_get()

double light::Drive::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.

◆ pid_angle_behavior_tolerance_set() [1/2]

void light::Drive::pid_angle_behavior_tolerance_set ( double  tolerance)

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

Parameters
p_toleranceangle wiggle room, in degrees

◆ pid_angle_behavior_tolerance_set() [2/2]

void light::Drive::pid_angle_behavior_tolerance_set ( okapi::QAngle  p_tolerance)

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

Parameters
p_toleranceangle wiggle room, an okapi unit

◆ pid_drive_chain_backward_constant_get()

double light::Drive::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.

◆ pid_drive_chain_backward_constant_set() [1/2]

void light::Drive::pid_drive_chain_backward_constant_set ( double  input)

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

This only sets backward driving constants.

Parameters
inputdistance in inches

◆ pid_drive_chain_backward_constant_set() [2/2]

void light::Drive::pid_drive_chain_backward_constant_set ( okapi::QLength  input)

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

This only sets backward driving constants.

Parameters
inputokapi length unit

◆ pid_drive_chain_constant_set() [1/2]

void light::Drive::pid_drive_chain_constant_set ( double  input)

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

This sets forward and backwards driving constants.

Parameters
inputdistance in inches

◆ pid_drive_chain_constant_set() [2/2]

void light::Drive::pid_drive_chain_constant_set ( okapi::QLength  input)

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

This sets forward and backwards driving constants.

Parameters
inputokapi length unit

◆ pid_drive_chain_forward_constant_get()

double light::Drive::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.

◆ pid_drive_chain_forward_constant_set() [1/2]

void light::Drive::pid_drive_chain_forward_constant_set ( double  input)

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

This only sets forward driving constants.

Parameters
inputdistance in inches

◆ pid_drive_chain_forward_constant_set() [2/2]

void light::Drive::pid_drive_chain_forward_constant_set ( okapi::QLength  input)

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

This only sets forward driving constants.

Parameters
inputokapi length unit

◆ pid_drive_constants_backward_get()

PID::Constants light::Drive::pid_drive_constants_backward_get ( )

Returns PID constants with PID::Constants.

◆ pid_drive_constants_backward_set()

void light::Drive::pid_drive_constants_backward_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the backwards pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_drive_constants_forward_get()

PID::Constants light::Drive::pid_drive_constants_forward_get ( )

Returns PID constants with PID::Constants.

◆ pid_drive_constants_forward_set()

void light::Drive::pid_drive_constants_forward_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the forward pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_drive_constants_get()

PID::Constants light::Drive::pid_drive_constants_get ( )

Returns PID constants with PID::Constants.

Returns -1 if fwd and rev constants aren't the same!

◆ pid_drive_constants_set()

void light::Drive::pid_drive_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the drive pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_drive_exit_condition_set() [1/2]

void light::Drive::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,
bool  use_imu = true 
)

Set's constants for drive exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, in ms
p_small_errorsmall timer will start when error is within this, in inches
p_big_exit_timetime to exit when within big_error, in ms
p_big_errorbig timer will start when error is within this, in inches
p_velocity_exit_timevelocity timer will start when velocity is 0, in ms
p_mA_timeoutmA timer will start when the motors are pulling too much current, in ms
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_drive_exit_condition_set() [2/2]

void light::Drive::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,
bool  use_imu = true 
)

Set's constants for drive exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, okapi unit
p_small_errorsmall timer will start when error is within this, okapi unit
p_big_exit_timetime to exit when within big_error, okapi unit
p_big_errorbig timer will start when error is within this, okapi unit
p_velocity_exit_timevelocity timer will start when velocity is 0, okapi unit
p_mA_timeoutmA timer will start when the motors are pulling too much current, okapi unit
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_drive_set() [1/4]

void light::Drive::pid_drive_set ( double  target,
int  speed 
)

Sets the robot to move forward using PID without okapi units, only using slew if globally enabled.

Parameters
targettarget value in inches
speed0 to 127, max speed during motion

◆ pid_drive_set() [2/4]

void light::Drive::pid_drive_set ( double  target,
int  speed,
bool  slew_on,
bool  toggle_heading = true 
)

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

Parameters
targettarget value in inches
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed
toggle_headingtoggle for heading correction. true enables, false disables

◆ pid_drive_set() [3/4]

void light::Drive::pid_drive_set ( okapi::QLength  p_target,
int  speed 
)

Sets the robot to move forward using PID with okapi units, only using slew if globally enabled.

Parameters
p_targettarget okapi unit
speed0 to 127, max speed during motion

◆ pid_drive_set() [4/4]

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

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

Parameters
p_targettarget okapi unit
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed
toggle_headingtoggle for heading correction. true enables, false disables

◆ pid_drive_toggle()

void light::Drive::pid_drive_toggle ( bool  toggle)

Toggles set drive in autonomous.

Parameters
toggletrue enables, false disables

◆ pid_drive_toggle_get()

bool light::Drive::pid_drive_toggle_get ( )

Gets the current state of the toggle.

This toggles set drive in autonomous.

True enabled, false disabled.

◆ pid_heading_constants_get()

PID::Constants light::Drive::pid_heading_constants_get ( )

Returns PID constants with PID::Constants.

◆ pid_heading_constants_set()

void light::Drive::pid_heading_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the heading pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_odom_angular_constants_set()

void light::Drive::pid_odom_angular_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the odom angular pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_odom_behavior_get()

e_angle_behavior light::Drive::pid_odom_behavior_get ( )

Returns the turn behavior for odom turns.

◆ pid_odom_behavior_set()

void light::Drive::pid_odom_behavior_set ( e_angle_behavior  behavior)

Sets the default behavior for turns in odom turning movements.

Parameters
behaviorlight::shortest, light::longest, light::left, light::right, light::raw

◆ pid_odom_boomerang_constants_set()

void light::Drive::pid_odom_boomerang_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the odom boomerang pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_odom_boomerang_set() [1/4]

void light::Drive::pid_odom_boomerang_set ( odom  imovement)

Takes in an odom movement to go to a single point using boomerang.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement

◆ pid_odom_boomerang_set() [2/4]

void light::Drive::pid_odom_boomerang_set ( odom  imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point using boomerang.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement
slew_onramp up from a lower speed to your target speed

◆ pid_odom_boomerang_set() [3/4]

void light::Drive::pid_odom_boomerang_set ( united_odom  p_imovement)

Takes in an odom movement to go to a single point using boomerang.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units

◆ pid_odom_boomerang_set() [4/4]

void light::Drive::pid_odom_boomerang_set ( united_odom  p_imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point using boomerang.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_drive_exit_condition_set() [1/2]

void light::Drive::pid_odom_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,
bool  use_imu = true 
)

Set's constants for odom driving exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, in ms
p_small_errorsmall timer will start when error is within this, in inches
p_big_exit_timetime to exit when within big_error, in ms
p_big_errorbig timer will start when error is within this, in inches
p_velocity_exit_timevelocity timer will start when velocity is 0, in ms
p_mA_timeoutmA timer will start when the motors are pulling too much current, in ms
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_odom_drive_exit_condition_set() [2/2]

void light::Drive::pid_odom_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,
bool  use_imu = true 
)

Set's constants for odom driving exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, okapi unit
p_small_errorsmall timer will start when error is within this, okapi unit
p_big_exit_timetime to exit when within big_error, okapi unit
p_big_errorbig timer will start when error is within this, okapi unit
p_velocity_exit_timevelocity timer will start when velocity is 0, okapi unit
p_mA_timeoutmA timer will start when the motors are pulling too much current, okapi unit
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_odom_injected_pp_set() [1/4]

void light::Drive::pid_odom_injected_pp_set ( std::vector< odom imovements)

Takes in odom movements to go through multiple points, will inject into the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements

◆ pid_odom_injected_pp_set() [2/4]

void light::Drive::pid_odom_injected_pp_set ( std::vector< odom imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject into the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements
slew_onramp up from a lower speed to your target speed

◆ pid_odom_injected_pp_set() [3/4]

void light::Drive::pid_odom_injected_pp_set ( std::vector< united_odom p_imovements)

Takes in odom movements to go through multiple points, will inject into the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units

◆ pid_odom_injected_pp_set() [4/4]

void light::Drive::pid_odom_injected_pp_set ( std::vector< united_odom p_imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject into the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_pp_set() [1/4]

void light::Drive::pid_odom_pp_set ( std::vector< odom imovements)

Takes in odom movements to go through multiple points.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements

◆ pid_odom_pp_set() [2/4]

void light::Drive::pid_odom_pp_set ( std::vector< odom imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements
slew_onramp up from a lower speed to your target speed

◆ pid_odom_pp_set() [3/4]

void light::Drive::pid_odom_pp_set ( std::vector< united_odom p_imovements)

Takes in odom movements to go through multiple points.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units

◆ pid_odom_pp_set() [4/4]

void light::Drive::pid_odom_pp_set ( std::vector< united_odom p_imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_ptp_set() [1/4]

void light::Drive::pid_odom_ptp_set ( odom  imovement)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement

◆ pid_odom_ptp_set() [2/4]

void light::Drive::pid_odom_ptp_set ( odom  imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement
slew_onramp up from a lower speed to your target speed

◆ pid_odom_ptp_set() [3/4]

void light::Drive::pid_odom_ptp_set ( united_odom  p_imovement)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units

◆ pid_odom_ptp_set() [4/4]

void light::Drive::pid_odom_ptp_set ( united_odom  p_imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_set() [1/12]

void light::Drive::pid_odom_set ( double  target,
int  speed 
)

Sets the robot to move forward using PID without okapi units, only using slew if globally enabled.

This function is actually odom.

Parameters
targettarget value as a double, unit is inches
speed0 to 127, max speed during motion

◆ pid_odom_set() [2/12]

void light::Drive::pid_odom_set ( double  target,
int  speed,
bool  slew_on 
)

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

This function is actually odom

Parameters
targettarget value as a double, unit is inches
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_odom_set() [3/12]

void light::Drive::pid_odom_set ( odom  imovement)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement

◆ pid_odom_set() [4/12]

void light::Drive::pid_odom_set ( odom  imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement
slew_onramp up from a lower speed to your target speed

◆ pid_odom_set() [5/12]

void light::Drive::pid_odom_set ( okapi::QLength  p_target,
int  speed 
)

Sets the robot to move forward using PID with okapi units, only using slew if globally enabled.

This function is actually odom

Parameters
targettarget value in inches
speed0 to 127, max speed during motion

◆ pid_odom_set() [6/12]

void light::Drive::pid_odom_set ( okapi::QLength  p_target,
int  speed,
bool  slew_on 
)

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

This function is actually odom

Parameters
targettarget value in inches
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed
toggle_headingtoggle for heading correction. true enables, false disables

◆ pid_odom_set() [7/12]

void light::Drive::pid_odom_set ( std::vector< odom imovements)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements

◆ pid_odom_set() [8/12]

void light::Drive::pid_odom_set ( std::vector< odom imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements
slew_onramp up from a lower speed to your target speed

◆ pid_odom_set() [9/12]

void light::Drive::pid_odom_set ( std::vector< united_odom p_imovements)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units

◆ pid_odom_set() [10/12]

void light::Drive::pid_odom_set ( std::vector< united_odom p_imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_set() [11/12]

void light::Drive::pid_odom_set ( united_odom  p_imovement)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if globally enabled.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units

◆ pid_odom_set() [12/12]

void light::Drive::pid_odom_set ( united_odom  p_imovement,
bool  slew_on 
)

Takes in an odom movement to go to a single point.

If an angle is set, this will run boomerang. Uses slew if enabled for this motion.

Parameters
imovement{{x, y, t}, fwd/rev, 1-127} an odom movement. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_smooth_pp_set() [1/4]

void light::Drive::pid_odom_smooth_pp_set ( std::vector< odom imovements)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements

◆ pid_odom_smooth_pp_set() [2/4]

void light::Drive::pid_odom_smooth_pp_set ( std::vector< odom imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements
slew_onramp up from a lower speed to your target speed

◆ pid_odom_smooth_pp_set() [3/4]

void light::Drive::pid_odom_smooth_pp_set ( std::vector< united_odom p_imovements)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if globally enabled.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units

◆ pid_odom_smooth_pp_set() [4/4]

void light::Drive::pid_odom_smooth_pp_set ( std::vector< united_odom p_imovements,
bool  slew_on 
)

Takes in odom movements to go through multiple points, will inject and smooth the path.

If an angle is set, this will run boomerang for that point. Uses slew if enabled for this motion.

Parameters
imovements{{{x, y, t}, fwd/rev, 1-127}, {{x, y, t}, fwd/rev, 1-127}} odom movements. values are united here with okapi units
slew_onramp up from a lower speed to your target speed

◆ pid_odom_turn_exit_condition_set() [1/2]

void light::Drive::pid_odom_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 
)

Set's constants for odom turning exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, in ms
p_small_errorsmall timer will start when error is within this, in degrees
p_big_exit_timetime to exit when within big_error, in ms
p_big_errorbig timer will start when error is within this, in degrees
p_velocity_exit_timevelocity timer will start when velocity is 0, in ms
p_mA_timeoutmA timer will start when the motors are pulling too much current, in ms
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_odom_turn_exit_condition_set() [2/2]

void light::Drive::pid_odom_turn_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,
bool  use_imu = true 
)

Set's constants for odom turning exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, okapi unit
p_small_errorsmall timer will start when error is within this, okapi unit
p_big_exit_timetime to exit when within big_error, okapi unit
p_big_errorbig timer will start when error is within this, okapi unit
p_velocity_exit_timevelocity timer will start when velocity is 0, okapi unit
p_mA_timeoutmA timer will start when the motors are pulling too much current, okapi unit
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_print_toggle()

void light::Drive::pid_print_toggle ( bool  toggle)

Toggles printing in autonomous.

Parameters
toggletrue enables, false disables

◆ pid_print_toggle_get()

bool light::Drive::pid_print_toggle_get ( )

Gets the current state of the toggle.

This toggles printing in autonomous.

True enabled, false disabled.

◆ pid_speed_max_get()

int light::Drive::pid_speed_max_get ( )

Returns max speed of drive during autonomous.

◆ pid_speed_max_set()

void light::Drive::pid_speed_max_set ( int  speed)

Changes max speed during a drive motion.

Parameters
speednew clipped speed, between 0 and 127

◆ pid_swing_behavior_get()

e_angle_behavior light::Drive::pid_swing_behavior_get ( )

Returns the turn behavior for swings.

◆ pid_swing_behavior_set()

void light::Drive::pid_swing_behavior_set ( e_angle_behavior  behavior)

Sets the default behavior for turns in swinging movements.

Parameters
behaviorlight::shortest, light::longest, light::left, light::right, light::raw

◆ pid_swing_chain_backward_constant_get()

double light::Drive::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.

◆ pid_swing_chain_backward_constant_set() [1/2]

void light::Drive::pid_swing_chain_backward_constant_set ( double  input)

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

This only sets backwards swing constants.

Parameters
inputangle in degrees

◆ pid_swing_chain_backward_constant_set() [2/2]

void light::Drive::pid_swing_chain_backward_constant_set ( okapi::QAngle  input)

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

This only sets backward swing constants.

Parameters
inputokapi angle unit

◆ pid_swing_chain_constant_set() [1/2]

void light::Drive::pid_swing_chain_constant_set ( double  input)

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

This sets forward and backwards swing constants.

Parameters
inputangle in degrees

◆ pid_swing_chain_constant_set() [2/2]

void light::Drive::pid_swing_chain_constant_set ( okapi::QAngle  input)

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

This sets forward and backwards swing constants.

Parameters
inputokapi angle unit

◆ pid_swing_chain_forward_constant_get()

double light::Drive::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.

◆ pid_swing_chain_forward_constant_set() [1/2]

void light::Drive::pid_swing_chain_forward_constant_set ( double  input)

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

This only sets forward constants.

Parameters
inputangle in degrees

◆ pid_swing_chain_forward_constant_set() [2/2]

void light::Drive::pid_swing_chain_forward_constant_set ( okapi::QAngle  input)

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

This only sets forward swing constants.

Parameters
inputokapi angle unit

◆ pid_swing_constants_backward_get()

PID::Constants light::Drive::pid_swing_constants_backward_get ( )

Returns PID constants with PID::Constants.

◆ pid_swing_constants_backward_set()

void light::Drive::pid_swing_constants_backward_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the backward swing pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_swing_constants_forward_get()

PID::Constants light::Drive::pid_swing_constants_forward_get ( )

Returns PID constants with PID::Constants.

◆ pid_swing_constants_forward_set()

void light::Drive::pid_swing_constants_forward_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the forward swing pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_swing_constants_get()

PID::Constants light::Drive::pid_swing_constants_get ( )

Returns PID constants with PID::Constants.

Returns -1 if fwd and rev constants aren't the same!

◆ pid_swing_constants_set()

void light::Drive::pid_swing_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the swing pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_swing_exit_condition_set() [1/2]

void light::Drive::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,
bool  use_imu = true 
)

Set's constants for swing exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, in ms
p_small_errorsmall timer will start when error is within this, in degrees
p_big_exit_timetime to exit when within big_error, in ms
p_big_errorbig timer will start when error is within this, in degrees
p_velocity_exit_timevelocity timer will start when velocity is 0, in ms
p_mA_timeoutmA timer will start when the motors are pulling too much current, in ms
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_swing_exit_condition_set() [2/2]

void light::Drive::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,
bool  use_imu = true 
)

Set's constants for swing exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, okapi unit
p_small_errorsmall timer will start when error is within this, okapi unit
p_big_exit_timetime to exit when within big_error, okapi unit
p_big_errorbig timer will start when error is within this, okapi unit
p_velocity_exit_timevelocity timer will start when velocity is 0, okapi unit
p_mA_timeoutmA timer will start when the motors are pulling too much current, okapi unit
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_swing_min_get()

int light::Drive::pid_swing_min_get ( )

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

◆ pid_swing_min_set()

void light::Drive::pid_swing_min_set ( int  min)

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

Parameters
minnew clipped speed

◆ pid_swing_relative_set() [1/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [2/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
bool  slew_on 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [3/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [4/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [5/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [6/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed,
bool  slew_on 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [7/16]

void light::Drive::pid_swing_relative_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed,
e_angle_behavior  behavior 
)

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [8/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [9/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [10/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [11/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [12/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_swing_relative_set() [13/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [14/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [15/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0

◆ pid_swing_relative_set() [16/16]

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

Sets the robot to turn only using the left or right side relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0

◆ pid_swing_set() [1/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_swing_set() [2/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
bool  slew_on 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [3/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_swing_set() [4/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [5/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_set() [6/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed,
bool  slew_on 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [7/16]

void light::Drive::pid_swing_set ( e_swing  type,
double  target,
int  speed,
int  opposite_speed,
e_angle_behavior  behavior 
)

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0

◆ pid_swing_set() [8/16]

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

Sets the robot to turn using only the left or right side relative to initial heading without okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
targettarget value as a double, unit is degrees
speed0 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, and is defaulted to 0
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [9/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_swing_set() [10/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [11/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_swing_set() [12/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [13/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0

◆ pid_swing_set() [14/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0
slew_onramp up from a lower speed to your target speed

◆ pid_swing_set() [15/16]

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

Sets the robot to turn using only the left or right side relative to initial heading with okapi units, only using slew if globally enabled.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_swing_set() [16/16]

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

Sets the robot to turn only using the left or right side relative to initial heading using PID with okapi units, using slew if enabled for this motion.

Parameters
typeL_SWING or R_SWING
p_targettarget value in okapi angle units
speed0 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, and is defaulted to 0
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_targets_reset()

void light::Drive::pid_targets_reset ( )

Resets all PID targets to 0.

◆ pid_tuner_disable()

void light::Drive::pid_tuner_disable ( )

Disables PID Tuner.

◆ pid_tuner_enable()

void light::Drive::pid_tuner_enable ( )

Enables PID Tuner.

◆ pid_tuner_enabled()

bool light::Drive::pid_tuner_enabled ( )

Checks if PID Tuner is enabled.

True is enabled, false is disabled.

◆ pid_tuner_full_enable()

void light::Drive::pid_tuner_full_enable ( bool  enable)

Enables the full PID tuner with unique fwd/rev constants.

Parameters
enabletrue will enable the full PID tuner, false will use the simplified PID tuner

◆ pid_tuner_full_enabled()

bool light::Drive::pid_tuner_full_enabled ( )

Returns if the full PID tuner with unique fwd/rev constants is enabled.

True means the full PID tuner is enabled, false means the simplified PID tuner is enabled.

◆ pid_tuner_increment_d_get()

double light::Drive::pid_tuner_increment_d_get ( )

Returns the value that PID Tuner increments D.

◆ pid_tuner_increment_d_set()

void light::Drive::pid_tuner_increment_d_set ( double  d)

Sets the value that PID Tuner increments D.

Parameters
pd will increase by this

◆ pid_tuner_increment_i_get()

double light::Drive::pid_tuner_increment_i_get ( )

Returns the value that PID Tuner increments I.

◆ pid_tuner_increment_i_set()

void light::Drive::pid_tuner_increment_i_set ( double  i)

Sets the value that PID Tuner increments I.

Parameters
pi will increase by this

◆ pid_tuner_increment_p_get()

double light::Drive::pid_tuner_increment_p_get ( )

Returns the value that PID Tuner increments P.

◆ pid_tuner_increment_p_set()

void light::Drive::pid_tuner_increment_p_set ( double  p)

Sets the value that PID Tuner increments P.

Parameters
pp will increase by this

◆ pid_tuner_increment_start_i_get()

double light::Drive::pid_tuner_increment_start_i_get ( )

Returns the value that PID Tuner increments Start I.

◆ pid_tuner_increment_start_i_set()

void light::Drive::pid_tuner_increment_start_i_set ( double  start_i)

Sets the value that PID Tuner increments Start I.

Parameters
pstart i will increase by this

◆ pid_tuner_iterate()

void light::Drive::pid_tuner_iterate ( )

Iterates through controller inputs to modify PID constants.

◆ pid_tuner_print_brain_enabled()

bool light::Drive::pid_tuner_print_brain_enabled ( )

Returns true if printing to brain is enabled.

◆ pid_tuner_print_brain_set()

void light::Drive::pid_tuner_print_brain_set ( bool  input)

Toggle for printing the display of the PID Tuner to the brain.

Parameters
inputtrue prints to brain, false doesn't

◆ pid_tuner_print_terminal_enabled()

bool light::Drive::pid_tuner_print_terminal_enabled ( )

Returns true if printing to terminal is enabled.

◆ pid_tuner_print_terminal_set()

void light::Drive::pid_tuner_print_terminal_set ( bool  input)

Toggle for printing the display of the PID Tuner to the terminal.

Parameters
inputtrue prints to terminal, false doesn't

◆ pid_tuner_toggle()

void light::Drive::pid_tuner_toggle ( )

Toggles PID tuner between enabled and disabled.

◆ pid_turn_behavior_get()

e_angle_behavior light::Drive::pid_turn_behavior_get ( )

Returns the turn behavior for turns.

◆ pid_turn_behavior_set()

void light::Drive::pid_turn_behavior_set ( e_angle_behavior  behavior)

Sets the default behavior for turns in turning movements.

Parameters
behaviorlight::shortest, light::longest, light::left, light::right, light::raw

◆ pid_turn_chain_constant_get()

double light::Drive::pid_turn_chain_constant_get ( )

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

◆ pid_turn_chain_constant_set() [1/2]

void light::Drive::pid_turn_chain_constant_set ( double  input)

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

This sets turning constants.

Parameters
inputangle in degrees

◆ pid_turn_chain_constant_set() [2/2]

void light::Drive::pid_turn_chain_constant_set ( okapi::QAngle  input)

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

This sets turning constants.

Parameters
inputokapi angle unit

◆ pid_turn_constants_get()

PID::Constants light::Drive::pid_turn_constants_get ( )

Returns PID constants with PID::Constants.

◆ pid_turn_constants_set()

void light::Drive::pid_turn_constants_set ( double  p,
double  i = 0.0,
double  d = 0.0,
double  p_start_i = 0.0 
)

Set the turn pid constants object.

Parameters
pproportional term
iintegral term
dderivative term
p_start_ierror threshold to start integral

◆ pid_turn_exit_condition_set() [1/2]

void light::Drive::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 
)

Set's constants for turn exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, in ms
p_small_errorsmall timer will start when error is within this, in degrees
p_big_exit_timetime to exit when within big_error, in ms
p_big_errorbig timer will start when error is within this, in degrees
p_velocity_exit_timevelocity timer will start when velocity is 0, in ms
p_mA_timeoutmA timer will start when the motors are pulling too much current, in ms
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_turn_exit_condition_set() [2/2]

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

Set's constants for turn exit conditions.

Parameters
p_small_exit_timetime to exit when within smalL_error, okapi unit
p_small_errorsmall timer will start when error is within this, okapi unit
p_big_exit_timetime to exit when within big_error, okapi unit
p_big_errorbig timer will start when error is within this, okapi unit
p_velocity_exit_timevelocity timer will start when velocity is 0, okapi unit
p_mA_timeoutmA timer will start when the motors are pulling too much current, okapi unit
use_imutrue adds the imu for velocity calculation in conjunction with the main sensor, false doesn't

◆ pid_turn_min_get()

int light::Drive::pid_turn_min_get ( )

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

◆ pid_turn_min_set()

void light::Drive::pid_turn_min_set ( int  min)

The minimum power for turns when kI and startI are enabled.

Parameters
minnew clipped speed

◆ pid_turn_relative_set() [1/8]

void light::Drive::pid_turn_relative_set ( double  target,
int  speed 
)

Sets the robot to turn relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion

◆ pid_turn_relative_set() [2/8]

void light::Drive::pid_turn_relative_set ( double  target,
int  speed,
bool  slew_on 
)

Sets the robot to turn relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_relative_set() [3/8]

void light::Drive::pid_turn_relative_set ( double  target,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn relative to current heading using PID without okapi units, only using slew if globally enabled.

Parameters
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_relative_set() [4/8]

void light::Drive::pid_turn_relative_set ( double  target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn relative to current heading using PID without okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_turn_relative_set() [5/8]

void light::Drive::pid_turn_relative_set ( okapi::QAngle  p_target,
int  speed 
)

Sets the robot to turn relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_turn_relative_set() [6/8]

void light::Drive::pid_turn_relative_set ( okapi::QAngle  p_target,
int  speed,
bool  slew_on 
)

Sets the robot to turn relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_relative_set() [7/8]

void light::Drive::pid_turn_relative_set ( okapi::QAngle  p_target,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn relative to current heading using PID with okapi units, only using slew if globally enabled.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_relative_set() [8/8]

void light::Drive::pid_turn_relative_set ( okapi::QAngle  p_target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn relative to current heading using PID with okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [1/16]

void light::Drive::pid_turn_set ( double  target,
int  speed 
)

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

Parameters
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [2/16]

void light::Drive::pid_turn_set ( double  target,
int  speed,
bool  slew_on 
)

Sets the robot to turn relative to initial heading using PID, using slew if enabled for this motion.

Parameters
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [3/16]

void light::Drive::pid_turn_set ( double  target,
int  speed,
e_angle_behavior  behavior 
)

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

Parameters
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_set() [4/16]

void light::Drive::pid_turn_set ( double  target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn relative to initial heading using PID, using slew if enabled for this motion.

Parameters
targettarget value as a double, unit is degrees
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [5/16]

void light::Drive::pid_turn_set ( okapi::QAngle  p_target,
int  speed 
)

Sets the robot to turn relative to initial heading using PID with okapi units.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion

◆ pid_turn_set() [6/16]

void light::Drive::pid_turn_set ( okapi::QAngle  p_target,
int  speed,
bool  slew_on 
)

Sets the robot to turn relative to initial heading using PID with okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [7/16]

void light::Drive::pid_turn_set ( okapi::QAngle  p_target,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn relative to initial heading using PID with okapi units.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_set() [8/16]

void light::Drive::pid_turn_set ( okapi::QAngle  p_target,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn relative to initial heading using PID with okapi units, using slew if enabled for this motion.

Parameters
p_targettarget value in okapi angle units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [9/16]

void light::Drive::pid_turn_set ( pose  itarget,
drive_directions  dir,
int  speed 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face
speed0 to 127, max speed during motion

◆ pid_turn_set() [10/16]

void light::Drive::pid_turn_set ( pose  itarget,
drive_directions  dir,
int  speed,
bool  slew_on 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [11/16]

void light::Drive::pid_turn_set ( pose  itarget,
drive_directions  dir,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_set() [12/16]

void light::Drive::pid_turn_set ( pose  itarget,
drive_directions  dir,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [13/16]

void light::Drive::pid_turn_set ( united_pose  p_itarget,
drive_directions  dir,
int  speed 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face. this uses okapi units
speed0 to 127, max speed during motion

◆ pid_turn_set() [14/16]

void light::Drive::pid_turn_set ( united_pose  p_itarget,
drive_directions  dir,
int  speed,
bool  slew_on 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face. this uses okapi units
speed0 to 127, max speed during motion
slew_onramp up from a lower speed to your target speed

◆ pid_turn_set() [15/16]

void light::Drive::pid_turn_set ( united_pose  p_itarget,
drive_directions  dir,
int  speed,
e_angle_behavior  behavior 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face. this uses okapi units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw

◆ pid_turn_set() [16/16]

void light::Drive::pid_turn_set ( united_pose  p_itarget,
drive_directions  dir,
int  speed,
e_angle_behavior  behavior,
bool  slew_on 
)

Sets the robot to turn face a point using PID and odometry.

Parameters
target{x, y} a target point to face. this uses okapi units
speed0 to 127, max speed during motion
behaviorchanges what direction the robot will turn. can be left, right, shortest, longest, raw
slew_onramp up from a lower speed to your target speed

◆ pid_wait()

void light::Drive::pid_wait ( )

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

◆ pid_wait_quick()

void light::Drive::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.

◆ pid_wait_quick_chain()

void light::Drive::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.

◆ pid_wait_until() [1/5]

void light::Drive::pid_wait_until ( double  target)

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

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

◆ pid_wait_until() [2/5]

void light::Drive::pid_wait_until ( okapi::QAngle  target)

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

Parameters
targetfor turning, using okapi units

◆ pid_wait_until() [3/5]

void light::Drive::pid_wait_until ( okapi::QLength  target)

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

Parameters
targetfor driving, using okapi units

◆ pid_wait_until() [4/5]

void light::Drive::pid_wait_until ( pose  target)

Lock the code in a while loop until this point has been passed.

Wrapper for pid_wait_until_point.

Parameters
target{x, y} a pose for the robot to pass through before the while loop is released

◆ pid_wait_until() [5/5]

void light::Drive::pid_wait_until ( united_pose  target)

Lock the code in a while loop until this point has been passed, with okapi units.

Wrapper for pid_wait_until_point.

Parameters
target{x, y} a pose with units for the robot to pass through before the while loop is released

◆ pid_wait_until_index()

void light::Drive::pid_wait_until_index ( int  index)

Lock the code in a while loop until this point has been passed.

Parameters
indexindex of your input points, 0 is the first point in the index

◆ pid_wait_until_index_started()

void light::Drive::pid_wait_until_index_started ( int  index)

Lock the code in a while loop until this point becomes the target.

Parameters
indexindex of your input points, 0 is the first point in the index

◆ pid_wait_until_point() [1/2]

void light::Drive::pid_wait_until_point ( pose  target)

Lock the code in a while loop until this point has been passed.

Parameters
target{x, y} pose for the robot to pass through before the while loop is released

◆ pid_wait_until_point() [2/2]

void light::Drive::pid_wait_until_point ( united_pose  target)

Lock the code in a while loop until this point has been passed, with okapi units.

Parameters
target{x, y} pose with units for the robot to pass through before the while loop is released

◆ pto_add()

void light::Drive::pto_add ( std::vector< pros::Motor >  pto_list)

Adds motors to the pto list, removing them from the drive.

You cannot add the first index because it's used for autonomous.

Parameters
pto_listlist of motors to remove from the drive

◆ pto_check()

bool light::Drive::pto_check ( pros::Motor  check_if_pto)

Checks if the motor is currently in pto_list.

Returns true if it's already in pto_list.

Parameters
check_if_ptomotor to check

◆ pto_remove()

void light::Drive::pto_remove ( std::vector< pros::Motor >  pto_list)

Removes motors from the pto list, adding them to the drive.

Parameters
pto_listlist of motors to add to the drive

◆ pto_toggle()

void light::Drive::pto_toggle ( std::vector< pros::Motor >  pto_list,
bool  toggle 
)

Adds/removes motors from drive.

You cannot add the first index because it's used for autonomous.

Parameters
pto_listlist of motors to add/remove from the drive
togglelist of motors to add/remove from the drive

◆ slew_drive_backward_get()

bool light::Drive::slew_drive_backward_get ( )

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

◆ slew_drive_backward_set()

void light::Drive::slew_drive_backward_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_drive_constants_backward_set()

void light::Drive::slew_drive_constants_backward_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for driving backward.

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

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

◆ slew_drive_constants_forward_set()

void light::Drive::slew_drive_constants_forward_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for driving forward.

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

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

◆ slew_drive_constants_set()

void light::Drive::slew_drive_constants_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for driving.

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

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

◆ slew_drive_forward_get()

bool light::Drive::slew_drive_forward_get ( )

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

◆ slew_drive_forward_set()

void light::Drive::slew_drive_forward_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_drive_set()

void light::Drive::slew_drive_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_odom_reenable()

void light::Drive::slew_odom_reenable ( bool  reenable)

Allows slew to reenable when the new input speed is larger than the current speed during pure pursuits.

Parameters
slew_ontrue enables, false disables

◆ slew_odom_reenabled()

bool light::Drive::slew_odom_reenabled ( )

Returns if slew will reenable when the new input speed is larger than the current speed during pure pursuits.

◆ slew_swing_backward_get()

bool light::Drive::slew_swing_backward_get ( )

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

◆ slew_swing_backward_set()

void light::Drive::slew_swing_backward_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_swing_constants_backward_set() [1/2]

void light::Drive::slew_swing_constants_backward_set ( okapi::QAngle  distance,
int  min_speed 
)

Sets constants for slew for swing backward movements.

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

Parameters
distancethe distance the robot travels before reaching max speed, an okapi angle unit
min_speedthe starting speed for the movement, 0 - 127

◆ slew_swing_constants_backward_set() [2/2]

void light::Drive::slew_swing_constants_backward_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for backward swing movements.

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

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

◆ slew_swing_constants_forward_set() [1/2]

void light::Drive::slew_swing_constants_forward_set ( okapi::QAngle  distance,
int  min_speed 
)

Sets constants for slew for swing forward movements.

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

Parameters
distancethe distance the robot travels before reaching max speed, an okapi angle unit
min_speedthe starting speed for the movement, 0 - 127

◆ slew_swing_constants_forward_set() [2/2]

void light::Drive::slew_swing_constants_forward_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for forward swing movements.

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

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

◆ slew_swing_constants_set() [1/2]

void light::Drive::slew_swing_constants_set ( okapi::QAngle  distance,
int  min_speed 
)

Sets constants for slew for swing movements.

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

Parameters
distancethe distance the robot travels before reaching max speed, an okapi angle unit
min_speedthe starting speed for the movement, 0 - 127

◆ slew_swing_constants_set() [2/2]

void light::Drive::slew_swing_constants_set ( okapi::QLength  distance,
int  min_speed 
)

Sets constants for slew for swing movements.

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

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

◆ slew_swing_forward_get()

bool light::Drive::slew_swing_forward_get ( )

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

◆ slew_swing_forward_set()

void light::Drive::slew_swing_forward_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_swing_set()

void light::Drive::slew_swing_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

◆ slew_turn_constants_set()

void light::Drive::slew_turn_constants_set ( okapi::QAngle  distance,
int  min_speed 
)

Sets constants for slew for turns.

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

Parameters
distancethe distance the robot travels before reaching max speed, an okapi angle unit
min_speedthe starting speed for the movement, 0 - 127

◆ slew_turn_get()

bool light::Drive::slew_turn_get ( )

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

◆ slew_turn_set()

void light::Drive::slew_turn_set ( bool  slew_on)

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

Parameters
slew_ontrue enables, false disables

Member Data Documentation

◆ backward_drivePID

PID light::Drive::backward_drivePID

Definition at line 164 of file drive.hpp.

◆ backward_swingPID

PID light::Drive::backward_swingPID

Definition at line 168 of file drive.hpp.

◆ boomerangPID

PID light::Drive::boomerangPID

Definition at line 172 of file drive.hpp.

◆ current_a_odomPID

PID light::Drive::current_a_odomPID

Definition at line 171 of file drive.hpp.

◆ CURRENT_BRAKE

pros::motor_brake_mode_e_t light::Drive::CURRENT_BRAKE = pros::E_MOTOR_BRAKE_COAST

Global current brake mode.

Definition at line 84 of file drive.hpp.

◆ CURRENT_MA

int light::Drive::CURRENT_MA = 2500

Global current mA.

Definition at line 89 of file drive.hpp.

◆ current_swing

e_swing light::Drive::current_swing

Current swing type.

Definition at line 94 of file drive.hpp.

◆ ez_auto

pros::Task light::Drive::ez_auto

Tasks for autonomous.

Definition at line 464 of file drive.hpp.

◆ forward_drivePID

PID light::Drive::forward_drivePID

Definition at line 163 of file drive.hpp.

◆ forward_swingPID

PID light::Drive::forward_swingPID

Definition at line 167 of file drive.hpp.

◆ friction_kQ

double light::Drive::friction_kQ = 0.0

Definition at line 200 of file drive.hpp.

◆ friction_kS

double light::Drive::friction_kS = 0.0

Friction-feedforward coefficients in motor-command units (-127..127).

Default zero — when unset, friction_ff() returns 0 and behavior is unchanged from a pure PID. Identify with the "Char: Friction" auton.

ff(v) = kS * sgn(v) + kV * v + kQ * v * |v|

Definition at line 198 of file drive.hpp.

◆ friction_kV

double light::Drive::friction_kV = 0.0

Definition at line 199 of file drive.hpp.

◆ fwd_rev_drivePID

PID light::Drive::fwd_rev_drivePID

Definition at line 165 of file drive.hpp.

◆ fwd_rev_swingPID

PID light::Drive::fwd_rev_swingPID

Definition at line 169 of file drive.hpp.

◆ headingPID

PID light::Drive::headingPID

PID objects.

Definition at line 159 of file drive.hpp.

◆ imu

pros::Imu light::Drive::imu

Inertial sensor.

Definition at line 114 of file drive.hpp.

◆ interfered

bool light::Drive::interfered = false

Autonomous interference detection.

Returns true when interfered, and false when nothing happened.

Definition at line 2689 of file drive.hpp.

◆ internal_leftPID

PID light::Drive::internal_leftPID

Definition at line 174 of file drive.hpp.

◆ internal_rightPID

PID light::Drive::internal_rightPID

Definition at line 175 of file drive.hpp.

◆ JOYSTICK_THRESHOLD

int light::Drive::JOYSTICK_THRESHOLD

Joysticks will return 0 when they are within this number.

Set with opcontrol_joystick_threshold_set()

Definition at line 79 of file drive.hpp.

◆ left_activebrakePID

PID light::Drive::left_activebrakePID

Definition at line 176 of file drive.hpp.

◆ left_motors

std::vector<pros::Motor> light::Drive::left_motors

Vector of pros motors for the left chassis.

Definition at line 99 of file drive.hpp.

◆ left_rotation

pros::Rotation light::Drive::left_rotation

Deprecated left rotation tracker.

Definition at line 129 of file drive.hpp.

◆ left_tracker

pros::adi::Encoder light::Drive::left_tracker

Deprecated left tracking wheel.

Definition at line 119 of file drive.hpp.

◆ leftPID

PID light::Drive::leftPID

Definition at line 161 of file drive.hpp.

◆ mode

e_mode light::Drive::mode

Current mode of the drive.

Definition at line 439 of file drive.hpp.

◆ odom_angularPID

PID light::Drive::odom_angularPID

Definition at line 173 of file drive.hpp.

◆ odom_tracker_back

tracking_wheel* light::Drive::odom_tracker_back

Back horizontal tracking wheel.

Definition at line 154 of file drive.hpp.

◆ odom_tracker_front

tracking_wheel* light::Drive::odom_tracker_front

Front horizontal tracking wheel.

Definition at line 149 of file drive.hpp.

◆ odom_tracker_left

tracking_wheel* light::Drive::odom_tracker_left

Left vertical tracking wheel.

Definition at line 139 of file drive.hpp.

◆ odom_tracker_right

tracking_wheel* light::Drive::odom_tracker_right

Right vertical tracking wheel.

Definition at line 144 of file drive.hpp.

◆ pid_tuner_full_pids

std::vector<const_and_name> light::Drive::pid_tuner_full_pids
Initial value:
= {
{"Drive Forward PID Constants", &forward_drivePID.constants},
{"Drive Backward PID Constants", &backward_drivePID.constants},
{"Odom Angular PID Constants", &odom_angularPID.constants},
{"Boomerang Angular PID Constants", &boomerangPID.constants},
{"Heading PID Constants", &headingPID.constants},
{"Turn PID Constants", &turnPID.constants},
{"Swing Forward PID Constants", &forward_swingPID.constants},
{"Swing Backward PID Constants", &backward_swingPID.constants}}
PID backward_drivePID
Definition drive.hpp:164
PID odom_angularPID
Definition drive.hpp:173
PID forward_drivePID
Definition drive.hpp:163
PID boomerangPID
Definition drive.hpp:172
PID forward_swingPID
Definition drive.hpp:167
PID headingPID
PID objects.
Definition drive.hpp:159
PID backward_swingPID
Definition drive.hpp:168
Constants constants
Active PID gain constants (read/write).
Definition pid.hpp:154

Vector used for the full PID Tuner.

Definition at line 3454 of file drive.hpp.

◆ pid_tuner_pids

std::vector<const_and_name> light::Drive::pid_tuner_pids
Initial value:
= {
{"Drive PID Constants", &fwd_rev_drivePID.constants},
{"Odom Angular PID Constants", &odom_angularPID.constants},
{"Boomerang Angular PID Constants", &boomerangPID.constants},
{"Heading PID Constants", &headingPID.constants},
{"Turn PID Constants", &turnPID.constants},
{"Swing PID Constants", &fwd_rev_swingPID.constants}}
PID fwd_rev_swingPID
Definition drive.hpp:169
PID fwd_rev_drivePID
Definition drive.hpp:165

Vector used for a simplified PID Tuner.

Definition at line 3443 of file drive.hpp.

◆ pto_active

std::vector<int> light::Drive::pto_active

Vector of pros motors that are disconnected from the drive.

Definition at line 109 of file drive.hpp.

◆ right_activebrakePID

PID light::Drive::right_activebrakePID

Definition at line 177 of file drive.hpp.

◆ right_motors

std::vector<pros::Motor> light::Drive::right_motors

Vector of pros motors for the right chassis.

Definition at line 104 of file drive.hpp.

◆ right_rotation

pros::Rotation light::Drive::right_rotation

Deprecated right rotation tracker.

Definition at line 134 of file drive.hpp.

◆ right_tracker

pros::adi::Encoder light::Drive::right_tracker

Deprecated right tracking wheel.

Definition at line 124 of file drive.hpp.

◆ rightPID

PID light::Drive::rightPID

Definition at line 162 of file drive.hpp.

◆ slew_backward

light::slew light::Drive::slew_backward

Definition at line 185 of file drive.hpp.

◆ slew_forward

light::slew light::Drive::slew_forward

Definition at line 184 of file drive.hpp.

◆ slew_left

light::slew light::Drive::slew_left

Slew objects.

Definition at line 182 of file drive.hpp.

◆ slew_right

light::slew light::Drive::slew_right

Definition at line 183 of file drive.hpp.

◆ slew_swing

light::slew light::Drive::slew_swing

Definition at line 189 of file drive.hpp.

◆ slew_swing_backward

light::slew light::Drive::slew_swing_backward

Definition at line 188 of file drive.hpp.

◆ slew_swing_forward

light::slew light::Drive::slew_swing_forward

Definition at line 187 of file drive.hpp.

◆ slew_turn

light::slew light::Drive::slew_turn

Definition at line 186 of file drive.hpp.

◆ swingPID

PID light::Drive::swingPID

Definition at line 166 of file drive.hpp.

◆ turnPID

PID light::Drive::turnPID

Definition at line 160 of file drive.hpp.

◆ xyPID

PID light::Drive::xyPID

Definition at line 170 of file drive.hpp.


The documentation for this class was generated from the following file: