36 std::shared_ptr<ChassisModel> imodel,
37 std::unique_ptr<IterativePosPIDController> idistanceController,
38 std::unique_ptr<IterativePosPIDController> iturnController,
39 std::unique_ptr<IterativePosPIDController> iangleController,
237 std::unique_ptr<IterativePosPIDController>
turnPid;
238 std::unique_ptr<IterativePosPIDController>
anglePid;
@ green
18:1, 200 RPM, Green gear set
void turnRawAsync(double idegTarget) override
Sets the target angle for the robot to turn clockwise in place (using closed-loop control).
void setGains(const IterativePosPIDController::Gains &idistanceGains, const IterativePosPIDController::Gains &iturnGains, const IterativePosPIDController::Gains &iangleGains)
Sets the gains for all controllers.
std::unique_ptr< IterativePosPIDController > distancePid
std::atomic_bool dtorCalled
std::shared_ptr< Logger > logger
void setTurnsMirrored(bool ishouldMirror) override
Sets whether turns should be mirrored.
CrossplatformThread * getThread() const
Returns the underlying thread handle.
ChassisModel & model() override
std::unique_ptr< IterativePosPIDController > anglePid
void setVelocityMode(bool ivelocityMode)
Sets the velocity mode flag.
ChassisControllerPID(const ChassisControllerPID &)=delete
double getMaxVelocity() const override
ChassisControllerPID & operator=(ChassisControllerPID &&other)=delete
void turnAngleAsync(QAngle idegTarget) override
Sets the target angle for the robot to turn clockwise in place (using closed-loop control).
std::shared_ptr< ChassisModel > chassisModel
void setMaxVelocity(double imaxVelocity) override
Sets a new maximum velocity in RPM [0-600].
AbstractMotor::GearsetRatioPair getGearsetRatioPair() const override
Gets the GearsetRatioPair.
bool isSettled() override
Checks whether the internal controllers are currently settled.
void turnAngle(QAngle idegTarget) override
Turns the robot clockwise in place (using closed-loop control).
bool waitForAngleSettled()
Wait for the angle setup (anglePid) to settle.
std::atomic_bool doneLooping
ChassisScales getChassisScales() const override
Gets the ChassisScales.
std::unique_ptr< IterativePosPIDController > turnPid
void stop() override
Interrupts the current movement to stop the robot.
~ChassisControllerPID() override
void waitUntilSettled() override
Delays until the currently executing movement completes.
bool waitForDistanceSettled()
Wait for the distance setup (distancePid and anglePid) to settle.
AbstractMotor::GearsetRatioPair gearsetRatioPair
void startThread()
Starts the internal thread.
ChassisControllerPID(TimeUtil itimeUtil, std::shared_ptr< ChassisModel > imodel, std::unique_ptr< IterativePosPIDController > idistanceController, std::unique_ptr< IterativePosPIDController > iturnController, std::unique_ptr< IterativePosPIDController > iangleController, const AbstractMotor::GearsetRatioPair &igearset=AbstractMotor::gearset::green, const ChassisScales &iscales=ChassisScales({1, 1}, imev5GreenTPR), std::shared_ptr< Logger > ilogger=Logger::getDefaultLogger())
ChassisController using PID control.
void moveDistance(QLength itarget) override
Drives the robot straight for a distance (using closed-loop control).
static void trampoline(void *context)
void stopAfterSettled()
Stops all the controllers and the ChassisModel.
void moveRaw(double itarget) override
Drives the robot straight for a distance (using closed-loop control).
std::atomic_bool newMovement
std::atomic_bool doneLoopingSeen
CrossplatformThread * task
std::shared_ptr< ChassisModel > getModel() override
std::tuple< IterativePosPIDController::Gains, IterativePosPIDController::Gains, IterativePosPIDController::Gains > getGains() const
Gets the current controller gains.
void moveRawAsync(double itarget) override
Sets the target distance for the robot to drive straight (using closed-loop control).
ChassisControllerPID(ChassisControllerPID &&other)=delete
void turnRaw(double idegTarget) override
Turns the robot clockwise in place (using closed-loop control).
ChassisControllerPID & operator=(const ChassisControllerPID &other)=delete
void moveDistanceAsync(QLength itarget) override
Sets the target distance for the robot to drive straight (using closed-loop control).
A version of the ReadOnlyChassisModel that also supports write methods, such as setting motor speed.
static std::shared_ptr< Logger > getDefaultLogger()
Utility class for holding an AbstractTimer, AbstractRate, and SettledUtil together in one class since...
static constexpr std::int32_t imev5GreenTPR
The ticks per rotation of the V5 motor with a green gearset.
A simple structure representing the full ratio between motor and wheel.