okapi::AsyncMotionProfileControllerBuilder class

Constructors, destructors, conversion operators

AsyncMotionProfileControllerBuilder(const std::shared_ptr<Logger>& ilogger = Logger::getDefaultLogger()) explicit
A builder that creates async motion profile controllers.

Public functions

auto withOutput(const Motor& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withOutput(const MotorGroup& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withOutput(const std::shared_ptr<ControllerOutput<double>>& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withOutput(ChassisController& icontroller) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withOutput(const std::shared_ptr<ChassisController>& icontroller) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withOutput(const std::shared_ptr<ChassisModel>& imodel, const ChassisScales& iscales, const AbstractMotor::GearsetRatioPair& ipair) -> AsyncMotionProfileControllerBuilder&
Sets the output.
auto withLimits(const PathfinderLimits& ilimits) -> AsyncMotionProfileControllerBuilder&
Sets the limits.
auto withTimeUtilFactory(const TimeUtilFactory& itimeUtilFactory) -> AsyncMotionProfileControllerBuilder&
Sets the TimeUtilFactory used when building the controller.
auto withLogger(const std::shared_ptr<Logger>& ilogger) -> AsyncMotionProfileControllerBuilder&
Sets the logger.
auto parentedToCurrentTask() -> AsyncMotionProfileControllerBuilder&
Parents the internal tasks started by this builder to the current task, meaning they will be deleted once the current task is deleted.
auto notParentedToCurrentTask() -> AsyncMotionProfileControllerBuilder&
Prevents parenting the internal tasks started by this builder to the current task, meaning they will not be deleted once the current task is deleted.
auto buildLinearMotionProfileController() -> std::shared_ptr<AsyncLinearMotionProfileController>
Builds the AsyncLinearMotionProfileController.
auto buildMotionProfileController() -> std::shared_ptr<AsyncMotionProfileController>
Builds the AsyncMotionProfileController.

Function documentation

okapi::AsyncMotionProfileControllerBuilder::AsyncMotionProfileControllerBuilder(const std::shared_ptr<Logger>& ilogger = Logger::getDefaultLogger()) explicit

A builder that creates async motion profile controllers.

Parameters
ilogger The logger this instance will log to.

Use this to build an AsyncMotionProfileController or an AsyncLinearMotionProfileController.

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(const Motor& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair)

Sets the output.

Parameters
ioutput The output.
idiameter The diameter of the mechanical part the motor spins.
ipair The gearset.
Returns An ongoing builder.

This must be used with buildLinearMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(const MotorGroup& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair)

Sets the output.

Parameters
ioutput The output.
idiameter The diameter of the mechanical part the motor spins.
ipair The gearset.
Returns An ongoing builder.

This must be used with buildLinearMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(const std::shared_ptr<ControllerOutput<double>>& ioutput, const QLength& idiameter, const AbstractMotor::GearsetRatioPair& ipair)

Sets the output.

Parameters
ioutput The output.
idiameter The diameter of the mechanical part the motor spins.
ipair The gearset.
Returns An ongoing builder.

This must be used with buildLinearMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(ChassisController& icontroller)

Sets the output.

Parameters
icontroller The chassis controller to use.
Returns An ongoing builder.

This must be used with buildMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(const std::shared_ptr<ChassisController>& icontroller)

Sets the output.

Parameters
icontroller The chassis controller to use.
Returns An ongoing builder.

This must be used with buildMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withOutput(const std::shared_ptr<ChassisModel>& imodel, const ChassisScales& iscales, const AbstractMotor::GearsetRatioPair& ipair)

Sets the output.

Parameters
imodel The chassis model to use.
iscales The chassis dimensions.
ipair The gearset.
Returns An ongoing builder.

This must be used with buildMotionProfileController().

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withLimits(const PathfinderLimits& ilimits)

Sets the limits.

Parameters
ilimits The limits.
Returns An ongoing builder.

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withTimeUtilFactory(const TimeUtilFactory& itimeUtilFactory)

Sets the TimeUtilFactory used when building the controller.

Parameters
itimeUtilFactory The TimeUtilFactory.
Returns An ongoing builder.

The default is the static TimeUtilFactory.

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::withLogger(const std::shared_ptr<Logger>& ilogger)

Sets the logger.

Parameters
ilogger The logger.
Returns An ongoing builder.

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::parentedToCurrentTask()

Parents the internal tasks started by this builder to the current task, meaning they will be deleted once the current task is deleted.

Returns An ongoing builder.

The initialize and competition_initialize tasks are never parented to. This is the default behavior.

Read more about this in the builders and tasks tutorial.

AsyncMotionProfileControllerBuilder& okapi::AsyncMotionProfileControllerBuilder::notParentedToCurrentTask()

Prevents parenting the internal tasks started by this builder to the current task, meaning they will not be deleted once the current task is deleted.

Returns An ongoing builder.

This can cause runaway tasks, but is sometimes the desired behavior (e.x., if you want to use this builder once in autonomous and then again in opcontrol).

Read more about this in the builders and tasks tutorial.

std::shared_ptr<AsyncLinearMotionProfileController> okapi::AsyncMotionProfileControllerBuilder::buildLinearMotionProfileController()

Builds the AsyncLinearMotionProfileController.

Returns A fully built AsyncLinearMotionProfileController.

std::shared_ptr<AsyncMotionProfileController> okapi::AsyncMotionProfileControllerBuilder::buildMotionProfileController()

Builds the AsyncMotionProfileController.

Returns A fully built AsyncMotionProfileController.