WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
frc::Trigger Class Referenceabstract

This class provides an easy way to link commands to inputs. More...

#include <Trigger.h>

Inheritance diagram for frc::Trigger:
frc::SendableBase frc::Sendable frc::Button frc::InternalButton frc::JoystickButton frc::NetworkButton frc::POVButton

Public Member Functions

 Trigger (Trigger &&)=default
 
Triggeroperator= (Trigger &&)=default
 
bool Grab ()
 
virtual bool Get ()=0
 
void WhenActive (Command *command)
 
void WhileActive (Command *command)
 
void WhenInactive (Command *command)
 
void CancelWhenActive (Command *command)
 
void ToggleWhenActive (Command *command)
 
void InitSendable (SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::SendableBase
 SendableBase (bool addLiveWindow=true)
 Creates an instance of the sensor base. More...
 
 SendableBase (SendableBase &&rhs)
 
SendableBaseoperator= (SendableBase &&rhs)
 
std::string GetName () const final
 Gets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &name) final
 Sets the name of this Sendable object. More...
 
std::string GetSubsystem () const final
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (const wpi::Twine &subsystem) final
 Sets the subsystem name of this Sendable object. More...
 
- Public Member Functions inherited from frc::Sendable
 Sendable (Sendable &&)=default
 
Sendableoperator= (Sendable &&)=default
 
void SetName (const wpi::Twine &subsystem, const wpi::Twine &name)
 Sets both the subsystem name and device name of this Sendable object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from frc::SendableBase
void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 
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...
 

Detailed Description

This class provides an easy way to link commands to inputs.

It is very easy to link a polled input to a command. For instance, you could link the trigger button of a joystick to a "score" command or an encoder reaching a particular value.

It is encouraged that teams write a subclass of Trigger if they want to have something unusual (for instance, if they want to react to the user holding a button while the robot is reading a certain sensor input). For this, they only have to write the Trigger#Get() method to get the full functionality of the Trigger class.

Member Function Documentation

void frc::Trigger::InitSendable ( SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements frc::Sendable.


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