LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
chassisControllerIntegrated.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
12
13namespace okapi {
15 public:
30 const TimeUtil &itimeUtil,
31 std::shared_ptr<ChassisModel> imodel,
32 std::unique_ptr<AsyncPosIntegratedController> ileftController,
33 std::unique_ptr<AsyncPosIntegratedController> irightController,
35 const ChassisScales &iscales = ChassisScales({1, 1}, imev5GreenTPR),
36 std::shared_ptr<Logger> ilogger = Logger::getDefaultLogger());
37
51 void moveDistance(QLength itarget) override;
52
63 void moveRaw(double itarget) override;
64
70 void moveDistanceAsync(QLength itarget) override;
71
77 void moveRawAsync(double itarget) override;
78
89 void turnAngle(QAngle idegTarget) override;
90
101 void turnRaw(double idegTarget) override;
102
108 void turnAngleAsync(QAngle idegTarget) override;
109
115 void turnRawAsync(double idegTarget) override;
116
122 void setTurnsMirrored(bool ishouldMirror) override;
123
129 bool isSettled() override;
130
134 void waitUntilSettled() override;
135
139 void stop() override;
140
145
150
154 std::shared_ptr<ChassisModel> getModel() override;
155
159 ChassisModel &model() override;
160
166 void setMaxVelocity(double imaxVelocity) override;
167
171 double getMaxVelocity() const override;
172
173 protected:
174 std::shared_ptr<Logger> logger;
175 bool normalTurns{true};
176 std::shared_ptr<ChassisModel> chassisModel;
178 std::unique_ptr<AsyncPosIntegratedController> leftController;
179 std::unique_ptr<AsyncPosIntegratedController> rightController;
183};
184} // namespace okapi
@ green
18:1, 200 RPM, Green gear set
AbstractMotor::GearsetRatioPair gearsetRatioPair
void waitUntilSettled() override
Delays until the currently executing movement completes.
void setTurnsMirrored(bool ishouldMirror) override
Sets whether turns should be mirrored.
void turnAngle(QAngle idegTarget) override
Turns the robot clockwise in place (using closed-loop control).
void turnRaw(double idegTarget) override
Turns the robot clockwise in place (using closed-loop control).
AbstractMotor::GearsetRatioPair getGearsetRatioPair() const override
Get the GearsetRatioPair.
void moveRaw(double itarget) override
Drives the robot straight for a distance (using closed-loop control).
std::shared_ptr< ChassisModel > getModel() override
void moveRawAsync(double itarget) override
Sets the target distance for the robot to drive straight (using closed-loop control).
ChassisScales getChassisScales() const override
Get the ChassisScales.
ChassisModel & model() override
void turnRawAsync(double idegTarget) override
Sets the target angle for the robot to turn clockwise in place (using closed-loop control).
void turnAngleAsync(QAngle idegTarget) override
Sets the target angle for the robot to turn clockwise in place (using closed-loop control).
std::unique_ptr< AsyncPosIntegratedController > rightController
std::unique_ptr< AsyncPosIntegratedController > leftController
void setMaxVelocity(double imaxVelocity) override
Sets a new maximum velocity in RPM [0-600].
double getMaxVelocity() const override
bool isSettled() override
Checks whether the internal controllers are currently settled.
void moveDistance(QLength itarget) override
Drives the robot straight for a distance (using closed-loop control).
void stop() override
Interrupts the current movement to stop the robot.
ChassisControllerIntegrated(const TimeUtil &itimeUtil, std::shared_ptr< ChassisModel > imodel, std::unique_ptr< AsyncPosIntegratedController > ileftController, std::unique_ptr< AsyncPosIntegratedController > irightController, const AbstractMotor::GearsetRatioPair &igearset=AbstractMotor::gearset::green, const ChassisScales &iscales=ChassisScales({1, 1}, imev5GreenTPR), std::shared_ptr< Logger > ilogger=Logger::getDefaultLogger())
ChassisController using the V5 motor's integrated control.
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...
Definition timeUtil.hpp:18
static constexpr std::int32_t imev5GreenTPR
The ticks per rotation of the V5 motor with a green gearset.
Definition mathUtil.hpp:63
A simple structure representing the full ratio between motor and wheel.