LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
asyncMotionProfileControllerBuilder.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
15
16namespace okapi {
18 public:
26 const std::shared_ptr<Logger> &ilogger = Logger::getDefaultLogger());
27
37 const QLength &idiameter,
39
49 const QLength &idiameter,
51
61 withOutput(const std::shared_ptr<ControllerOutput<double>> &ioutput,
62 const QLength &idiameter,
64
72
80 withOutput(const std::shared_ptr<ChassisController> &icontroller);
81
90 AsyncMotionProfileControllerBuilder &withOutput(const std::shared_ptr<ChassisModel> &imodel,
91 const ChassisScales &iscales,
93
101
110
117 AsyncMotionProfileControllerBuilder &withLogger(const std::shared_ptr<Logger> &ilogger);
118
130
143
149 std::shared_ptr<AsyncLinearMotionProfileController> buildLinearMotionProfileController();
150
156 std::shared_ptr<AsyncMotionProfileController> buildMotionProfileController();
157
158 private:
159 std::shared_ptr<Logger> logger;
160
161 bool hasLimits{false};
162 PathfinderLimits limits;
163
164 bool hasOutput{false};
165 std::shared_ptr<ControllerOutput<double>> output;
166 QLength diameter;
167
168 bool hasModel{false};
169 std::shared_ptr<ChassisModel> model;
170 ChassisScales scales{{1, 1}, imev5GreenTPR};
171 AbstractMotor::GearsetRatioPair pair{AbstractMotor::gearset::invalid};
172 TimeUtilFactory timeUtilFactory = TimeUtilFactory();
173 std::shared_ptr<Logger> controllerLogger = Logger::getDefaultLogger();
174
175 bool isParentedToCurrentTask{true};
176};
177} // namespace okapi
AsyncMotionProfileControllerBuilder & withOutput(const std::shared_ptr< ControllerOutput< double > > &ioutput, const QLength &idiameter, const AbstractMotor::GearsetRatioPair &ipair)
Sets the output.
AsyncMotionProfileControllerBuilder & withOutput(const std::shared_ptr< ChassisController > &icontroller)
Sets the output.
AsyncMotionProfileControllerBuilder & withOutput(const std::shared_ptr< ChassisModel > &imodel, const ChassisScales &iscales, const AbstractMotor::GearsetRatioPair &ipair)
Sets the output.
std::shared_ptr< AsyncMotionProfileController > buildMotionProfileController()
Builds the AsyncMotionProfileController.
AsyncMotionProfileControllerBuilder & withLimits(const PathfinderLimits &ilimits)
Sets the limits.
AsyncMotionProfileControllerBuilder & withOutput(const MotorGroup &ioutput, const QLength &idiameter, const AbstractMotor::GearsetRatioPair &ipair)
Sets the output.
AsyncMotionProfileControllerBuilder & withOutput(ChassisController &icontroller)
Sets the output.
AsyncMotionProfileControllerBuilder & withOutput(const Motor &ioutput, const QLength &idiameter, const AbstractMotor::GearsetRatioPair &ipair)
Sets the output.
std::shared_ptr< AsyncLinearMotionProfileController > buildLinearMotionProfileController()
Builds the AsyncLinearMotionProfileController.
AsyncMotionProfileControllerBuilder(const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger())
A builder that creates async motion profile controllers.
AsyncMotionProfileControllerBuilder & notParentedToCurrentTask()
Prevents parenting the internal tasks started by this builder to the current task,...
AsyncMotionProfileControllerBuilder & withLogger(const std::shared_ptr< Logger > &ilogger)
Sets the logger.
AsyncMotionProfileControllerBuilder & parentedToCurrentTask()
Parents the internal tasks started by this builder to the current task, meaning they will be deleted ...
AsyncMotionProfileControllerBuilder & withTimeUtilFactory(const TimeUtilFactory &itimeUtilFactory)
Sets the TimeUtilFactory used when building the controller.
static std::shared_ptr< Logger > getDefaultLogger()
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.