WPILibC++  2020.3.2-60-g3011ebe
frc2::SubsystemBase Class Reference

A base for subsystems that handles registration in the constructor, and provides a more intuitive method for setting the default command. More...

#include <SubsystemBase.h>

Inheritance diagram for frc2::SubsystemBase:
frc2::Subsystem frc::Sendable frc::SendableHelper< SubsystemBase > frc2::PIDSubsystem frc2::ProfiledPIDSubsystem< Distance > frc2::TrapezoidProfileSubsystem< Distance >

Public Member Functions

void InitSendable (frc::SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
std::string GetName () const
 Gets the name of this Subsystem. More...
 
void SetName (const wpi::Twine &name)
 Sets the name of this Subsystem. More...
 
std::string GetSubsystem () const
 Gets the subsystem name of this Subsystem. More...
 
void SetSubsystem (const wpi::Twine &name)
 Sets the subsystem name of this Subsystem. More...
 
void AddChild (std::string name, frc::Sendable *child)
 Associate a Sendable with this Subsystem. More...
 
- Public Member Functions inherited from frc2::Subsystem
virtual void Periodic ()
 This method is called periodically by the CommandScheduler. More...
 
template<class T , typename = std::enable_if_t<std::is_base_of_v< Command, std::remove_reference_t<T>>>>
void SetDefaultCommand (T &&defaultCommand)
 Sets the default Command of the subsystem. More...
 
CommandGetDefaultCommand () const
 Gets the default command for this subsystem. More...
 
CommandGetCurrentCommand () const
 Returns the command currently running on this subsystem. More...
 
void Register ()
 Registers this subsystem with the CommandScheduler, allowing its Periodic() method to be called when the scheduler runs.
 
- Public Member Functions inherited from frc::SendableHelper< SubsystemBase >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 
std::string GetName () const
 Gets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &name)
 Sets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &subsystem, const wpi::Twine &name)
 Sets both the subsystem name and device name of this Sendable object. More...
 
std::string GetSubsystem () const
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (const wpi::Twine &subsystem)
 Sets the subsystem name of this Sendable object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from frc::SendableHelper< SubsystemBase >
void SetName (const wpi::Twine &moduleType, int channel)
 Sets the name of the sensor with a channel number. More...
 
void SetName (const wpi::Twine &moduleType, int moduleNumber, int channel)
 Sets the name of the sensor with a module and channel number. More...
 
void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 

Detailed Description

A base for subsystems that handles registration in the constructor, and provides a more intuitive method for setting the default command.

Member Function Documentation

◆ AddChild()

void frc2::SubsystemBase::AddChild ( std::string  name,
frc::Sendable child 
)

Associate a Sendable with this Subsystem.

Also update the child's name.

Parameters
namename to give child
childsendable

◆ GetName()

std::string frc2::SubsystemBase::GetName ( ) const

Gets the name of this Subsystem.

Returns
Name

◆ GetSubsystem()

std::string frc2::SubsystemBase::GetSubsystem ( ) const

Gets the subsystem name of this Subsystem.

Returns
Subsystem name

◆ InitSendable()

void frc2::SubsystemBase::InitSendable ( frc::SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements frc::Sendable.

◆ SetName()

void frc2::SubsystemBase::SetName ( const wpi::Twine name)

Sets the name of this Subsystem.

Parameters
namename

◆ SetSubsystem()

void frc2::SubsystemBase::SetSubsystem ( const wpi::Twine name)

Sets the subsystem name of this Subsystem.

Parameters
subsystemsubsystem name

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