WPILibC++ 2023.4.3
frc::MotorControllerGroup Class Reference

Allows multiple MotorController objects to be linked together. More...

#include <frc/motorcontrol/MotorControllerGroup.h>

Inheritance diagram for frc::MotorControllerGroup:
wpi::Sendable frc::MotorController wpi::SendableHelper< MotorControllerGroup >

Public Member Functions

template<class... MotorControllers>
 MotorControllerGroup (MotorController &motorController, MotorControllers &... motorControllers)
 
 MotorControllerGroup (std::vector< std::reference_wrapper< MotorController > > &&motorControllers)
 
 MotorControllerGroup (MotorControllerGroup &&)=default
 
MotorControllerGroupoperator= (MotorControllerGroup &&)=default
 
void Set (double speed) override
 Common interface for setting the speed of a motor controller. More...
 
void SetVoltage (units::volt_t output) override
 Sets the voltage output of the MotorController. More...
 
double Get () const override
 Common interface for getting the current set speed of a motor controller. More...
 
void SetInverted (bool isInverted) override
 Common interface for inverting direction of a motor controller. More...
 
bool GetInverted () const override
 Common interface for returning the inversion state of a motor controller. More...
 
void Disable () override
 Common interface for disabling a motor. More...
 
void StopMotor () override
 Common interface to stop the motor until Set is called again. More...
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::Sendable
virtual ~Sendable ()=default
 
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::MotorController
virtual ~MotorController ()=default
 
virtual void Set (double speed)=0
 Common interface for setting the speed of a motor controller. More...
 
virtual void SetVoltage (units::volt_t output)
 Sets the voltage output of the MotorController. More...
 
virtual double Get () const =0
 Common interface for getting the current set speed of a motor controller. More...
 
virtual void SetInverted (bool isInverted)=0
 Common interface for inverting direction of a motor controller. More...
 
virtual bool GetInverted () const =0
 Common interface for returning the inversion state of a motor controller. More...
 
virtual void Disable ()=0
 Common interface for disabling a motor. More...
 
virtual void StopMotor ()=0
 Common interface to stop the motor until Set is called again. More...
 
- Public Member Functions inherited from wpi::SendableHelper< MotorControllerGroup >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 

Additional Inherited Members

- Protected Member Functions inherited from wpi::SendableHelper< MotorControllerGroup >
 SendableHelper ()=default
 
 ~SendableHelper ()
 

Detailed Description

Allows multiple MotorController objects to be linked together.

Constructor & Destructor Documentation

◆ MotorControllerGroup() [1/3]

template<class... MotorControllers>
frc::MotorControllerGroup::MotorControllerGroup ( MotorController motorController,
MotorControllers &...  motorControllers 
)
explicit

◆ MotorControllerGroup() [2/3]

frc::MotorControllerGroup::MotorControllerGroup ( std::vector< std::reference_wrapper< MotorController > > &&  motorControllers)
explicit

◆ MotorControllerGroup() [3/3]

frc::MotorControllerGroup::MotorControllerGroup ( MotorControllerGroup &&  )
default

Member Function Documentation

◆ Disable()

void frc::MotorControllerGroup::Disable ( )
overridevirtual

Common interface for disabling a motor.

Implements frc::MotorController.

◆ Get()

double frc::MotorControllerGroup::Get ( ) const
overridevirtual

Common interface for getting the current set speed of a motor controller.

Returns
The current set speed. Value is between -1.0 and 1.0.

Implements frc::MotorController.

◆ GetInverted()

bool frc::MotorControllerGroup::GetInverted ( ) const
overridevirtual

Common interface for returning the inversion state of a motor controller.

Returns
isInverted The state of inversion, true is inverted.

Implements frc::MotorController.

◆ InitSendable()

void frc::MotorControllerGroup::InitSendable ( wpi::SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::Sendable.

◆ operator=()

MotorControllerGroup & frc::MotorControllerGroup::operator= ( MotorControllerGroup &&  )
default

◆ Set()

void frc::MotorControllerGroup::Set ( double  speed)
overridevirtual

Common interface for setting the speed of a motor controller.

Parameters
speedThe speed to set. Value should be between -1.0 and 1.0.

Implements frc::MotorController.

◆ SetInverted()

void frc::MotorControllerGroup::SetInverted ( bool  isInverted)
overridevirtual

Common interface for inverting direction of a motor controller.

Parameters
isInvertedThe state of inversion, true is inverted.

Implements frc::MotorController.

◆ SetVoltage()

void frc::MotorControllerGroup::SetVoltage ( units::volt_t  output)
overridevirtual

Sets the voltage output of the MotorController.

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."

Parameters
outputThe voltage to output.

Reimplemented from frc::MotorController.

◆ StopMotor()

void frc::MotorControllerGroup::StopMotor ( )
overridevirtual

Common interface to stop the motor until Set is called again.

Implements frc::MotorController.


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