37 const QLength &idiameter,
59 void generatePath(std::initializer_list<QLength> iwaypoints,
const std::string &ipathId);
74 const std::string &ipathId,
154 void moveTo(
const QLength &iposition,
const QLength &itarget,
bool ibackwards =
false);
166 const QLength &itarget,
168 bool ibackwards =
false);
252 std::map<std::string, std::vector<squiggles::ProfilePoint>>
paths{};
254 std::shared_ptr<ControllerOutput<double>>
output;
277 std::unique_ptr<AbstractRate> rate);
288 const std::string &ipathId,
virtual std::string getTarget() const
Gets the last set target, or the default target if none was set.
void setTarget(std::string ipathId) override
Executes a path with the given ID.
std::string getProcessValue() const override
This is overridden to return the current path.
AsyncLinearMotionProfileController(const TimeUtil &itimeUtil, const PathfinderLimits &ilimits, const std::shared_ptr< ControllerOutput< double > > &ioutput, const QLength &idiameter, const AbstractMotor::GearsetRatioPair &ipair, const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger())
An Async Controller which generates and follows 1D motion profiles.
void flipDisable(bool iisDisabled) override
Sets whether the controller is off or on.
double getError() const override
Returns the last error of the controller.
std::string getPathErrorMessage(const std::vector< PathfinderPoint > &points, const std::string &ipathId, int length)
AbstractMotor::GearsetRatioPair pair
static void trampoline(void *context)
QAngularSpeed convertLinearToRotational(QSpeed linear) const
Converts linear "chassis" speed to rotational motor speed.
void controllerSet(std::string ivalue) override
Writes the value of the controller output.
AsyncLinearMotionProfileController & operator=(AsyncLinearMotionProfileController &&other)=delete
std::map< std::string, std::vector< squiggles::ProfilePoint > > paths
CrossplatformMutex currentPathMutex
void flipDisable() override
Changes whether the controller is off or on.
std::atomic_bool isRunning
void forceRemovePath(const std::string &ipathId)
Attempts to remove a path without stopping execution, then if that fails, disables the controller and...
std::shared_ptr< ControllerOutput< double > > output
void startThread()
Starts the internal thread.
void tarePosition() override
This implementation does nothing because the API always requires the starting position to be specifie...
std::atomic_bool disabled
void setTarget(std::string ipathId, bool ibackwards)
Executes a path with the given ID.
void reset() override
Resets the controller's internal state so it is similar to when it was first initialized,...
CrossplatformThread * getThread() const
Returns the underlying thread handle.
double currentProfilePosition
bool isDisabled() const override
Returns whether the controller is currently disabled.
AsyncLinearMotionProfileController(AsyncLinearMotionProfileController &&other)=delete
CrossplatformThread * task
std::atomic_bool dtorCalled
void setMaxVelocity(std::int32_t imaxVelocity) override
This implementation does nothing because the maximum velocity is configured using PathfinderLimits el...
~AsyncLinearMotionProfileController() override
void moveTo(const QLength &iposition, const QLength &itarget, bool ibackwards=false)
Generates a new path from the position (typically the current position) to the target and blocks unti...
std::shared_ptr< Logger > logger
std::vector< std::string > getPaths()
Gets the identifiers of all paths saved in this AsyncMotionProfileController.
bool removePath(const std::string &ipathId)
Removes a path and frees the memory it used.
void waitUntilSettled() override
Blocks the current task until the controller has settled.
virtual void executeSinglePath(const std::vector< squiggles::ProfilePoint > &path, std::unique_ptr< AbstractRate > rate)
Follow the supplied path.
void generatePath(std::initializer_list< QLength > iwaypoints, const std::string &ipathId, const PathfinderLimits &ilimits)
Generates a path which intersects the given waypoints and saves it internally with a key of pathId.
bool isSettled() override
Returns whether the controller has settled at the target.
void generatePath(std::initializer_list< QLength > iwaypoints, const std::string &ipathId)
Generates a path which intersects the given waypoints and saves it internally with a key of pathId.
std::atomic_int direction
std::string getTarget() override
Gets the last set target, or the default target if none was set.
void moveTo(const QLength &iposition, const QLength &itarget, const PathfinderLimits &ilimits, bool ibackwards=false)
Generates a new path from the position (typically the current position) to the target and blocks unti...
static std::shared_ptr< Logger > getDefaultLogger()
Utility class for holding an AbstractTimer, AbstractRate, and SettledUtil together in one class since...
A simple structure representing the full ratio between motor and wheel.