![]() |
WPILibC++ 2027.0.0-alpha-2
|
Common base class for all PWM Motor Controllers. More...
#include <frc/motorcontrol/PWMMotorController.h>
Public Member Functions | |
| PWMMotorController (PWMMotorController &&)=default | |
| PWMMotorController & | operator= (PWMMotorController &&)=default |
| void | Set (double value) override |
| Set the PWM value. | |
| void | SetVoltage (units::volt_t output) override |
| Sets the voltage output of the PWMMotorController. | |
| double | Get () const override |
| Get the recently set value of the PWM. | |
| virtual units::volt_t | GetVoltage () const |
| Gets the voltage output of the motor controller, nominally between -12 V and 12 V. | |
| void | SetInverted (bool isInverted) override |
| Common interface for inverting direction of a motor controller. | |
| bool | GetInverted () const override |
| Common interface for returning the inversion state of a motor controller. | |
| void | Disable () override |
| Common interface for disabling a motor. | |
| void | StopMotor () override |
| Common interface to stop the motor until Set is called again. | |
| std::string | GetDescription () const override |
| Returns a description to print when an error occurs. | |
| int | GetChannel () const |
| void | EnableDeadbandElimination (bool eliminateDeadband) |
| Optionally eliminate the deadband from a motor controller. | |
| void | AddFollower (PWMMotorController &follower) |
| Make the given PWM motor controller follow the output of this one. | |
| template<std::derived_from< PWMMotorController > T> | |
| void | AddFollower (T &&follower) |
| Make the given PWM motor controller follow the output of this one. | |
Public Member Functions inherited from frc::MotorController | |
| virtual | ~MotorController ()=default |
Public Member Functions inherited from frc::MotorSafety | |
| MotorSafety () | |
| virtual | ~MotorSafety () |
| MotorSafety (MotorSafety &&rhs) | |
| MotorSafety & | operator= (MotorSafety &&rhs) |
| void | Feed () |
| Feed the motor safety object. | |
| void | SetExpiration (units::second_t expirationTime) |
| Set the expiration time for the corresponding motor safety object. | |
| units::second_t | GetExpiration () const |
| Retrieve the timeout value for the corresponding motor safety object. | |
| bool | IsAlive () const |
| Determine if the motor is still operating or has timed out. | |
| void | SetSafetyEnabled (bool enabled) |
| Enable/disable motor safety for this device. | |
| bool | IsSafetyEnabled () const |
| Return the state of the motor safety enabled flag. | |
| void | Check () |
| Check if this motor has exceeded its timeout. | |
Public Member Functions inherited from wpi::Sendable | |
| virtual constexpr | ~Sendable ()=default |
Public Member Functions inherited from wpi::SendableHelper< PWMMotorController > | |
| constexpr | SendableHelper (const SendableHelper &rhs)=default |
| constexpr | SendableHelper (SendableHelper &&rhs) |
| constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
| constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Protected Member Functions | |
| PWMMotorController (std::string_view name, int channel) | |
| Constructor for a PWM Motor Controller connected via PWM. | |
| void | InitSendable (wpi::SendableBuilder &builder) override |
| Initializes this Sendable object. | |
| void | SetSpeed (double speed) |
| double | GetSpeed () const |
| void | SetBounds (units::microsecond_t maxPwm, units::microsecond_t deadbandMaxPwm, units::microsecond_t centerPwm, units::microsecond_t deadbandMinPwm, units::microsecond_t minPwm) |
Protected Member Functions inherited from wpi::SendableHelper< PWMMotorController > | |
| constexpr | SendableHelper ()=default |
| constexpr | ~SendableHelper () |
Protected Attributes | |
| PWM | m_pwm |
| PWM instances for motor controller. | |
Additional Inherited Members | |
Static Public Member Functions inherited from frc::MotorSafety | |
| static void | CheckMotors () |
| Check the motors to see if any have timed out. | |
Common base class for all PWM Motor Controllers.
|
default |
|
protected |
| void frc::PWMMotorController::AddFollower | ( | PWMMotorController & | follower | ) |
Make the given PWM motor controller follow the output of this one.
| follower | The motor controller follower. |
|
inline |
Make the given PWM motor controller follow the output of this one.
| follower | The motor controller follower. |
|
overridevirtual |
Common interface for disabling a motor.
Implements frc::MotorController.
| void frc::PWMMotorController::EnableDeadbandElimination | ( | bool | eliminateDeadband | ) |
Optionally eliminate the deadband from a motor controller.
| eliminateDeadband | If true, set the motor curve on the motor controller to eliminate the deadband in the middle of the range. Otherwise, keep the full range without modifying any values. |
|
overridevirtual |
Get the recently set value of the PWM.
This value is affected by the inversion property. If you want the value that is sent directly to the MotorController, use PWM::GetSpeed() instead.
Implements frc::MotorController.
| int frc::PWMMotorController::GetChannel | ( | ) | const |
|
overridevirtual |
Returns a description to print when an error occurs.
Implements frc::MotorSafety.
|
overridevirtual |
Common interface for returning the inversion state of a motor controller.
Implements frc::MotorController.
|
protected |
|
virtual |
Gets the voltage output of the motor controller, nominally between -12 V and 12 V.
|
overrideprotectedvirtual |
|
default |
|
overridevirtual |
Set the PWM value.
The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the FPGA.
| value | The speed value between -1.0 and 1.0 to set. |
Implements frc::MotorController.
|
protected |
|
overridevirtual |
Common interface for inverting direction of a motor controller.
| isInverted | The state of inversion, true is inverted. |
Implements frc::MotorController.
|
protected |
|
overridevirtual |
Sets the voltage output of the PWMMotorController.
Compensates for the current bus voltage to ensure that the desired voltage is output even if the battery voltage is below 12V - highly useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward calculation).
NOTE: This function must be called regularly in order for voltage compensation to work properly - unlike the ordinary set function, it is not "set it and forget it."
| output | The voltage to output. |
Reimplemented from frc::MotorController.
|
overridevirtual |
Common interface to stop the motor until Set is called again.
Implements frc::MotorController.