6#include "pros/motors.hpp"
8#define chassisAsync(f) hololib::motion_handler::move([&] { f; });
15 pros::Motor& frontRight,
16 pros::Motor& backLeft,
17 pros::Motor& backRight,
22 headingInitialized(false), receivedRotateInput(false), MAX_DRIVE_INPUT(127.0f),
23 SETTLE_DELAY_MS(150), MAX_CORRECTION(40.0f) {};
55 void drive(
float vx,
float vy,
float omega,
float theta);
70 pros::Motor& frontLeft;
71 pros::Motor& frontRight;
72 pros::Motor& backLeft;
73 pros::Motor& backRight;
79 const float MAX_DRIVE_INPUT;
80 const uint32_t SETTLE_DELAY_MS;
81 const float MAX_CORRECTION;
82 static constexpr float JOYSTICK_SCALING_FACTOR = 12000.0f / 127.0f;
86 bool headingInitialized;
87 bool receivedRotateInput;
90 uint32_t last_collision_check_time = 0;
91 uint32_t stall_accumulator_ms = 0;
A standard PID controller with advanced features.
void drive(float vx, float vy, float omega, float theta)
Chassis(pros::Motor &frontLeft, pros::Motor &frontRight, pros::Motor &backLeft, pros::Motor &backRight, pros::IMU &imu, EncoderEKFOdometry &odom)
void driveControl(float forward, float sideways, float rotation, DriveCurves drivecurves, bool fieldCentric, float headingOffset, DriveCorrection correction)
hololib::EncoderEKFOdometry odom
Configuration for active heading correction during driver control.
float kD
Derivative gain for heading hold.
float kI
Integral gain for heading hold.
float kP
Proportional gain for heading hold.
bool correctionOn
True to actively maintain heading when rotation joystick is released.
Represents a simple deadzone-minimum output exponential or linear drive curve.
float minimum_output
Minimum voltage output once deadzone is surpassed.
float curve_multipler
Curvature scale.
float deadzone
Deadzone before response begins.
Holds the drive curves for movement and rotation inputs.
DriveCurve rotation
Curve mapping for rotational input.
DriveCurve movement
Curve mapping for forward/sideways translation.