LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::AsyncPosControllerBuilder Class Reference

#include <asyncPosControllerBuilder.hpp>

Public Member Functions

 AsyncPosControllerBuilder (const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger())
 A builder that creates async position controllers.
 
AsyncPosControllerBuilderwithMotor (const Motor &imotor)
 Sets the motor.
 
AsyncPosControllerBuilderwithMotor (const MotorGroup &imotor)
 Sets the motor.
 
AsyncPosControllerBuilderwithMotor (const std::shared_ptr< AbstractMotor > &imotor)
 Sets the motor.
 
AsyncPosControllerBuilderwithSensor (const ADIEncoder &isensor)
 Sets the sensor.
 
AsyncPosControllerBuilderwithSensor (const IntegratedEncoder &isensor)
 Sets the sensor.
 
AsyncPosControllerBuilderwithSensor (const std::shared_ptr< RotarySensor > &isensor)
 Sets the sensor.
 
AsyncPosControllerBuilderwithGains (const IterativePosPIDController::Gains &igains)
 Sets the controller gains, causing the builder to generate an AsyncPosPIDController.
 
AsyncPosControllerBuilderwithDerivativeFilter (std::unique_ptr< Filter > iderivativeFilter)
 Sets the derivative filter which filters the derivative term before it is scaled by kD.
 
AsyncPosControllerBuilderwithGearset (const AbstractMotor::GearsetRatioPair &igearset)
 Sets the gearset.
 
AsyncPosControllerBuilderwithMaxVelocity (double imaxVelocity)
 Sets the maximum velocity.
 
AsyncPosControllerBuilderwithTimeUtilFactory (const TimeUtilFactory &itimeUtilFactory)
 Sets the TimeUtilFactory used when building the controller.
 
AsyncPosControllerBuilderwithLogger (const std::shared_ptr< Logger > &ilogger)
 Sets the logger.
 
AsyncPosControllerBuilderparentedToCurrentTask ()
 Parents the internal tasks started by this builder to the current task, meaning they will be deleted once the current task is deleted.
 
AsyncPosControllerBuildernotParentedToCurrentTask ()
 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.
 
std::shared_ptr< AsyncPositionController< double, double > > build ()
 Builds the AsyncPositionController.
 

Detailed Description

Definition at line 19 of file asyncPosControllerBuilder.hpp.

Constructor & Destructor Documentation

◆ AsyncPosControllerBuilder()

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

A builder that creates async position controllers.

Use this to create an AsyncPosIntegratedController or an AsyncPosPIDController.

Parameters
iloggerThe logger this instance will log to.

Member Function Documentation

◆ build()

std::shared_ptr< AsyncPositionController< double, double > > okapi::AsyncPosControllerBuilder::build ( )

Builds the AsyncPositionController.

Throws a std::runtime_exception is no motors were set.

Returns
A fully built AsyncPositionController.

◆ notParentedToCurrentTask()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::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.

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] (docs/tutorials/concepts/builders-and-tasks.md).

Returns
An ongoing builder.

◆ parentedToCurrentTask()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::parentedToCurrentTask ( )

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

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] (docs/tutorials/concepts/builders-and-tasks.md).

Returns
An ongoing builder.

◆ withDerivativeFilter()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withDerivativeFilter ( std::unique_ptr< Filter iderivativeFilter)

Sets the derivative filter which filters the derivative term before it is scaled by kD.

The filter is ignored when using integrated control. The default derivative filter is a PassthroughFilter.

Parameters
iderivativeFilterThe derivative filter.
Returns
An ongoing builder.

◆ withGains()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withGains ( const IterativePosPIDController::Gains igains)

Sets the controller gains, causing the builder to generate an AsyncPosPIDController.

This does not set the integrated control's gains.

Parameters
igainsThe gains.
Returns
An ongoing builder.

◆ withGearset()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withGearset ( const AbstractMotor::GearsetRatioPair igearset)

Sets the gearset.

The default gearset is derived from the motor's.

Parameters
igearsetThe gearset.
Returns
An ongoing builder.

◆ withLogger()

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

Sets the logger.

Parameters
iloggerThe logger.
Returns
An ongoing builder.

◆ withMaxVelocity()

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withMaxVelocity ( double  imaxVelocity)

Sets the maximum velocity.

The default maximum velocity is derived from the motor's gearset. This parameter is ignored when using an AsyncPosPIDController.

Parameters
imaxVelocityThe maximum velocity.
Returns
An ongoing builder.

◆ withMotor() [1/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withMotor ( const Motor imotor)

Sets the motor.

Parameters
imotorThe motor.
Returns
An ongoing builder.

◆ withMotor() [2/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withMotor ( const MotorGroup imotor)

Sets the motor.

Parameters
imotorThe motor.
Returns
An ongoing builder.

◆ withMotor() [3/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withMotor ( const std::shared_ptr< AbstractMotor > &  imotor)

Sets the motor.

Parameters
imotorThe motor.
Returns
An ongoing builder.

◆ withSensor() [1/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withSensor ( const ADIEncoder isensor)

Sets the sensor.

The default sensor is the motor's integrated encoder.

Parameters
isensorThe sensor.
Returns
An ongoing builder.

◆ withSensor() [2/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withSensor ( const IntegratedEncoder isensor)

Sets the sensor.

The default sensor is the motor's integrated encoder.

Parameters
isensorThe sensor.
Returns
An ongoing builder.

◆ withSensor() [3/3]

AsyncPosControllerBuilder & okapi::AsyncPosControllerBuilder::withSensor ( const std::shared_ptr< RotarySensor > &  isensor)

Sets the sensor.

The default sensor is the motor's integrated encoder.

Parameters
isensorThe sensor.
Returns
An ongoing builder.

◆ withTimeUtilFactory()

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

Sets the TimeUtilFactory used when building the controller.

The default is the static TimeUtilFactory.

Parameters
itimeUtilFactoryThe TimeUtilFactory.
Returns
An ongoing builder.

The documentation for this class was generated from the following file: