|
LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
|
#include <chassisControllerBuilder.hpp>
Public Member Functions | |
| ChassisControllerBuilder (const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger()) | |
| A builder that creates ChassisControllers. | |
| ChassisControllerBuilder & | withMotors (const Motor &ileft, const Motor &iright) |
| Sets the motors using a skid-steer layout. | |
| ChassisControllerBuilder & | withMotors (const MotorGroup &ileft, const MotorGroup &iright) |
| Sets the motors using a skid-steer layout. | |
| ChassisControllerBuilder & | withMotors (const std::shared_ptr< AbstractMotor > &ileft, const std::shared_ptr< AbstractMotor > &iright) |
| Sets the motors using a skid-steer layout. | |
| ChassisControllerBuilder & | withMotors (const Motor &itopLeft, const Motor &itopRight, const Motor &ibottomRight, const Motor &ibottomLeft) |
| Sets the motors using an x-drive layout. | |
| ChassisControllerBuilder & | withMotors (const MotorGroup &itopLeft, const MotorGroup &itopRight, const MotorGroup &ibottomRight, const MotorGroup &ibottomLeft) |
| Sets the motors using an x-drive layout. | |
| ChassisControllerBuilder & | withMotors (const std::shared_ptr< AbstractMotor > &itopLeft, const std::shared_ptr< AbstractMotor > &itopRight, const std::shared_ptr< AbstractMotor > &ibottomRight, const std::shared_ptr< AbstractMotor > &ibottomLeft) |
| Sets the motors using an x-drive layout. | |
| ChassisControllerBuilder & | withMotors (const Motor &ileft, const Motor &iright, const Motor &imiddle) |
| Sets the motors using an h-drive layout. | |
| ChassisControllerBuilder & | withMotors (const MotorGroup &ileft, const MotorGroup &iright, const MotorGroup &imiddle) |
| Sets the motors using an h-drive layout. | |
| ChassisControllerBuilder & | withMotors (const MotorGroup &ileft, const MotorGroup &iright, const Motor &imiddle) |
| Sets the motors using an h-drive layout. | |
| ChassisControllerBuilder & | withMotors (const std::shared_ptr< AbstractMotor > &ileft, const std::shared_ptr< AbstractMotor > &iright, const std::shared_ptr< AbstractMotor > &imiddle) |
| Sets the motors using an h-drive layout. | |
| ChassisControllerBuilder & | withSensors (const ADIEncoder &ileft, const ADIEncoder &iright) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const ADIEncoder &ileft, const ADIEncoder &iright, const ADIEncoder &imiddle) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const RotationSensor &ileft, const RotationSensor &iright) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const RotationSensor &ileft, const RotationSensor &iright, const RotationSensor &imiddle) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const IntegratedEncoder &ileft, const IntegratedEncoder &iright) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const IntegratedEncoder &ileft, const IntegratedEncoder &iright, const ADIEncoder &imiddle) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const std::shared_ptr< ContinuousRotarySensor > &ileft, const std::shared_ptr< ContinuousRotarySensor > &iright) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withSensors (const std::shared_ptr< ContinuousRotarySensor > &ileft, const std::shared_ptr< ContinuousRotarySensor > &iright, const std::shared_ptr< ContinuousRotarySensor > &imiddle) |
| Sets the sensors. | |
| ChassisControllerBuilder & | withGains (const IterativePosPIDController::Gains &idistanceGains, const IterativePosPIDController::Gains &iturnGains) |
| Sets the PID controller gains, causing the builder to generate a ChassisControllerPID. | |
| ChassisControllerBuilder & | withGains (const IterativePosPIDController::Gains &idistanceGains, const IterativePosPIDController::Gains &iturnGains, const IterativePosPIDController::Gains &iangleGains) |
| Sets the PID controller gains, causing the builder to generate a ChassisControllerPID. | |
| ChassisControllerBuilder & | withOdometry (const StateMode &imode=StateMode::FRAME_TRANSFORMATION, const QLength &imoveThreshold=0_mm, const QAngle &iturnThreshold=0_deg) |
| Sets the odometry information, causing the builder to generate an Odometry variant. | |
| ChassisControllerBuilder & | withOdometry (const ChassisScales &iodomScales, const StateMode &imode=StateMode::FRAME_TRANSFORMATION, const QLength &imoveThreshold=0_mm, const QAngle &iturnThreshold=0_deg) |
| Sets the odometry information, causing the builder to generate an Odometry variant. | |
| ChassisControllerBuilder & | withOdometry (std::shared_ptr< Odometry > iodometry, const StateMode &imode=StateMode::FRAME_TRANSFORMATION, const QLength &imoveThreshold=0_mm, const QAngle &iturnThreshold=0_deg) |
| Sets the odometry information, causing the builder to generate an Odometry variant. | |
| ChassisControllerBuilder & | withDerivativeFilters (std::unique_ptr< Filter > idistanceFilter, std::unique_ptr< Filter > iturnFilter=std::make_unique< PassthroughFilter >(), std::unique_ptr< Filter > iangleFilter=std::make_unique< PassthroughFilter >()) |
| Sets the derivative filters. | |
| ChassisControllerBuilder & | withDimensions (const AbstractMotor::GearsetRatioPair &igearset, const ChassisScales &iscales) |
| Sets the chassis dimensions. | |
| ChassisControllerBuilder & | withMaxVelocity (double imaxVelocity) |
| Sets the max velocity. | |
| ChassisControllerBuilder & | withMaxVoltage (double imaxVoltage) |
| Sets the max voltage. | |
| ChassisControllerBuilder & | withChassisControllerTimeUtilFactory (const TimeUtilFactory &itimeUtilFactory) |
| Sets the TimeUtilFactory used when building a ChassisController. | |
| ChassisControllerBuilder & | withClosedLoopControllerTimeUtilFactory (const TimeUtilFactory &itimeUtilFactory) |
| Sets the TimeUtilFactory used when building a ClosedLoopController. | |
| ChassisControllerBuilder & | withClosedLoopControllerTimeUtil (double iatTargetError=50, double iatTargetDerivative=5, const QTime &iatTargetTime=250_ms) |
| Creates a new ConfigurableTimeUtilFactory with the given parameters. | |
| ChassisControllerBuilder & | withOdometryTimeUtilFactory (const TimeUtilFactory &itimeUtilFactory) |
| Sets the TimeUtilFactory used when building an Odometry. | |
| ChassisControllerBuilder & | withLogger (const std::shared_ptr< Logger > &ilogger) |
| Sets the logger used for the ChassisController and ClosedLoopControllers. | |
| ChassisControllerBuilder & | parentedToCurrentTask () |
| Parents the internal tasks started by this builder to the current task, meaning they will be deleted once the current task is deleted. | |
| ChassisControllerBuilder & | 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. | |
| std::shared_ptr< ChassisController > | build () |
| Builds the ChassisController. | |
| std::shared_ptr< OdomChassisController > | buildOdometry () |
| Builds the OdomChassisController. | |
Definition at line 24 of file chassisControllerBuilder.hpp.
|
explicit |
A builder that creates ChassisControllers.
Use this to create your ChassisController.
| ilogger | The logger this instance will log to. |
| std::shared_ptr< ChassisController > okapi::ChassisControllerBuilder::build | ( | ) |
Builds the ChassisController.
Throws a std::runtime_exception if no motors were set or if no dimensions were set.
| std::shared_ptr< OdomChassisController > okapi::ChassisControllerBuilder::buildOdometry | ( | ) |
Builds the OdomChassisController.
Throws a std::runtime_exception if no motors were set, if no dimensions were set, or if no odometry information was passed.
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::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).
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::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).
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withChassisControllerTimeUtilFactory | ( | const TimeUtilFactory & | itimeUtilFactory | ) |
Sets the TimeUtilFactory used when building a ChassisController.
This instance will be given to the ChassisController (not to controllers it uses). The default is the static TimeUtilFactory.
| itimeUtilFactory | The TimeUtilFactory. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withClosedLoopControllerTimeUtil | ( | double | iatTargetError = 50, |
| double | iatTargetDerivative = 5, |
||
| const QTime & | iatTargetTime = 250_ms |
||
| ) |
Creates a new ConfigurableTimeUtilFactory with the given parameters.
Given to any ClosedLoopController instances.
| iatTargetError | The minimum error to be considered settled. |
| iatTargetDerivative | The minimum error derivative to be considered settled. |
| iatTargetTime | The minimum time within atTargetError to be considered settled. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withClosedLoopControllerTimeUtilFactory | ( | const TimeUtilFactory & | itimeUtilFactory | ) |
Sets the TimeUtilFactory used when building a ClosedLoopController.
This instance will be given to any ClosedLoopController instances. The default is the static TimeUtilFactory.
| itimeUtilFactory | The TimeUtilFactory. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withDerivativeFilters | ( | std::unique_ptr< Filter > | idistanceFilter, |
| std::unique_ptr< Filter > | iturnFilter = std::make_unique< PassthroughFilter >(), |
||
| std::unique_ptr< Filter > | iangleFilter = std::make_unique< PassthroughFilter >() |
||
| ) |
Sets the derivative filters.
Uses a PassthroughFilter by default.
| idistanceFilter | The distance controller's filter. |
| iturnFilter | The turn controller's filter. |
| iangleFilter | The angle controller's filter. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withDimensions | ( | const AbstractMotor::GearsetRatioPair & | igearset, |
| const ChassisScales & | iscales | ||
| ) |
Sets the chassis dimensions.
| igearset | The gearset in the drive motors. |
| iscales | The ChassisScales for the base. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withGains | ( | const IterativePosPIDController::Gains & | idistanceGains, |
| const IterativePosPIDController::Gains & | iturnGains | ||
| ) |
Sets the PID controller gains, causing the builder to generate a ChassisControllerPID.
Uses the turn controller's gains for the angle controller's gains.
| idistanceGains | The distance controller's gains. |
| iturnGains | The turn controller's gains. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withGains | ( | const IterativePosPIDController::Gains & | idistanceGains, |
| const IterativePosPIDController::Gains & | iturnGains, | ||
| const IterativePosPIDController::Gains & | iangleGains | ||
| ) |
Sets the PID controller gains, causing the builder to generate a ChassisControllerPID.
| idistanceGains | The distance controller's gains. |
| iturnGains | The turn controller's gains. |
| iangleGains | The angle controller's gains. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withLogger | ( | const std::shared_ptr< Logger > & | ilogger | ) |
Sets the logger used for the ChassisController and ClosedLoopControllers.
| ilogger | The logger. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMaxVelocity | ( | double | imaxVelocity | ) |
Sets the max velocity.
Overrides the max velocity of the gearset.
| imaxVelocity | The max velocity. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMaxVoltage | ( | double | imaxVoltage | ) |
Sets the max voltage.
The default is 12000.
| imaxVoltage | The max voltage. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const Motor & | ileft, |
| const Motor & | iright | ||
| ) |
Sets the motors using a skid-steer layout.
| ileft | The left motor. |
| iright | The right motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const Motor & | ileft, |
| const Motor & | iright, | ||
| const Motor & | imiddle | ||
| ) |
Sets the motors using an h-drive layout.
| ileft | The left motor. |
| iright | The right motor. |
| imiddle | The middle motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const Motor & | itopLeft, |
| const Motor & | itopRight, | ||
| const Motor & | ibottomRight, | ||
| const Motor & | ibottomLeft | ||
| ) |
Sets the motors using an x-drive layout.
| itopLeft | The top left motor. |
| itopRight | The top right motor. |
| ibottomRight | The bottom right motor. |
| ibottomLeft | The bottom left motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const MotorGroup & | ileft, |
| const MotorGroup & | iright | ||
| ) |
Sets the motors using a skid-steer layout.
| ileft | The left motor. |
| iright | The right motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const MotorGroup & | ileft, |
| const MotorGroup & | iright, | ||
| const Motor & | imiddle | ||
| ) |
Sets the motors using an h-drive layout.
| ileft | The left motor. |
| iright | The right motor. |
| imiddle | The middle motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const MotorGroup & | ileft, |
| const MotorGroup & | iright, | ||
| const MotorGroup & | imiddle | ||
| ) |
Sets the motors using an h-drive layout.
| ileft | The left motor. |
| iright | The right motor. |
| imiddle | The middle motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const MotorGroup & | itopLeft, |
| const MotorGroup & | itopRight, | ||
| const MotorGroup & | ibottomRight, | ||
| const MotorGroup & | ibottomLeft | ||
| ) |
Sets the motors using an x-drive layout.
| itopLeft | The top left motor. |
| itopRight | The top right motor. |
| ibottomRight | The bottom right motor. |
| ibottomLeft | The bottom left motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const std::shared_ptr< AbstractMotor > & | ileft, |
| const std::shared_ptr< AbstractMotor > & | iright | ||
| ) |
Sets the motors using a skid-steer layout.
| ileft | The left motor. |
| iright | The right motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const std::shared_ptr< AbstractMotor > & | ileft, |
| const std::shared_ptr< AbstractMotor > & | iright, | ||
| const std::shared_ptr< AbstractMotor > & | imiddle | ||
| ) |
Sets the motors using an h-drive layout.
| ileft | The left motor. |
| iright | The right motor. |
| imiddle | The middle motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withMotors | ( | const std::shared_ptr< AbstractMotor > & | itopLeft, |
| const std::shared_ptr< AbstractMotor > & | itopRight, | ||
| const std::shared_ptr< AbstractMotor > & | ibottomRight, | ||
| const std::shared_ptr< AbstractMotor > & | ibottomLeft | ||
| ) |
Sets the motors using an x-drive layout.
| itopLeft | The top left motor. |
| itopRight | The top right motor. |
| ibottomRight | The bottom right motor. |
| ibottomLeft | The bottom left motor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withOdometry | ( | const ChassisScales & | iodomScales, |
| const StateMode & | imode = StateMode::FRAME_TRANSFORMATION, |
||
| const QLength & | imoveThreshold = 0_mm, |
||
| const QAngle & | iturnThreshold = 0_deg |
||
| ) |
Sets the odometry information, causing the builder to generate an Odometry variant.
| iodomScales | The ChassisScales used just for odometry (if they are different than those for the drive). |
| imode | The new default StateMode used to interpret target points and query the Odometry state. |
| imoveThreshold | The minimum length movement. |
| iturnThreshold | The minimum angle turn. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withOdometry | ( | const StateMode & | imode = StateMode::FRAME_TRANSFORMATION, |
| const QLength & | imoveThreshold = 0_mm, |
||
| const QAngle & | iturnThreshold = 0_deg |
||
| ) |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withOdometry | ( | std::shared_ptr< Odometry > | iodometry, |
| const StateMode & | imode = StateMode::FRAME_TRANSFORMATION, |
||
| const QLength & | imoveThreshold = 0_mm, |
||
| const QAngle & | iturnThreshold = 0_deg |
||
| ) |
Sets the odometry information, causing the builder to generate an Odometry variant.
| iodometry | The odometry object. |
| imode | The new default StateMode used to interpret target points and query the Odometry state. |
| imoveThreshold | The minimum length movement. |
| iturnThreshold | The minimum angle turn. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withOdometryTimeUtilFactory | ( | const TimeUtilFactory & | itimeUtilFactory | ) |
Sets the TimeUtilFactory used when building an Odometry.
The default is the static TimeUtilFactory.
| itimeUtilFactory | The TimeUtilFactory. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const ADIEncoder & | ileft, |
| const ADIEncoder & | iright | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const ADIEncoder & | ileft, |
| const ADIEncoder & | iright, | ||
| const ADIEncoder & | imiddle | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| imiddle | The middle sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const IntegratedEncoder & | ileft, |
| const IntegratedEncoder & | iright | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const IntegratedEncoder & | ileft, |
| const IntegratedEncoder & | iright, | ||
| const ADIEncoder & | imiddle | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| imiddle | The middle sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const RotationSensor & | ileft, |
| const RotationSensor & | iright | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const RotationSensor & | ileft, |
| const RotationSensor & | iright, | ||
| const RotationSensor & | imiddle | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| imiddle | The middle sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const std::shared_ptr< ContinuousRotarySensor > & | ileft, |
| const std::shared_ptr< ContinuousRotarySensor > & | iright | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| ChassisControllerBuilder & okapi::ChassisControllerBuilder::withSensors | ( | const std::shared_ptr< ContinuousRotarySensor > & | ileft, |
| const std::shared_ptr< ContinuousRotarySensor > & | iright, | ||
| const std::shared_ptr< ContinuousRotarySensor > & | imiddle | ||
| ) |
Sets the sensors.
The default sensors are the motor's integrated encoders.
| ileft | The left side sensor. |
| iright | The right side sensor. |
| imiddle | The middle sensor. |