WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
frc::AnalogTrigger Class Reference
Inheritance diagram for frc::AnalogTrigger:
frc::ErrorBase frc::SendableBase frc::Sendable

Public Member Functions

 AnalogTrigger (int channel)
 Constructor for an analog trigger given a channel number. More...
 
 AnalogTrigger (AnalogInput *channel)
 Construct an analog trigger given an analog input. More...
 
 AnalogTrigger (AnalogTrigger &&rhs)
 
AnalogTriggeroperator= (AnalogTrigger &&rhs)
 
void SetLimitsVoltage (double lower, double upper)
 Set the upper and lower limits of the analog trigger. More...
 
void SetLimitsRaw (int lower, int upper)
 Set the upper and lower limits of the analog trigger. More...
 
void SetAveraged (bool useAveragedValue)
 Configure the analog trigger to use the averaged vs. More...
 
void SetFiltered (bool useFilteredValue)
 Configure the analog trigger to use a filtered value. More...
 
int GetIndex () const
 Return the index of the analog trigger. More...
 
bool GetInWindow ()
 Return the InWindow output of the analog trigger. More...
 
bool GetTriggerState ()
 Return the TriggerState output of the analog trigger. More...
 
std::shared_ptr
< AnalogTriggerOutput
CreateOutput (AnalogTriggerType type) const
 Creates an AnalogTriggerOutput object. More...
 
void InitSendable (SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::ErrorBase
 ErrorBase (ErrorBase &&)=default
 
ErrorBaseoperator= (ErrorBase &&)=default
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 Retrieve the current error. More...
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual void SetErrnoError (const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetErrorRange (Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const wpi::Twine &errorMessage, Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. 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...
 

Friends

class AnalogTriggerOutput
 

Additional Inherited Members

- Static Public Member Functions inherited from frc::ErrorBase
static void SetGlobalError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static void SetGlobalWPIError (const wpi::Twine &errorMessage, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static const ErrorGetGlobalError ()
 Retrieve the current global error.
 
- 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...
 
- Protected Attributes inherited from frc::ErrorBase
Error m_error
 

Constructor & Destructor Documentation

frc::AnalogTrigger::AnalogTrigger ( int  channel)
explicit

Constructor for an analog trigger given a channel number.

Parameters
channelThe channel number on the roboRIO to represent. 0-3 are on-board 4-7 are on the MXP port.
frc::AnalogTrigger::AnalogTrigger ( AnalogInput channel)
explicit

Construct an analog trigger given an analog input.

This should be used in the case of sharing an analog channel between the trigger and an analog input object.

Parameters
channelThe pointer to the existing AnalogInput object

Member Function Documentation

std::shared_ptr<AnalogTriggerOutput> frc::AnalogTrigger::CreateOutput ( AnalogTriggerType  type) const

Creates an AnalogTriggerOutput object.

Gets an output object that can be used for routing. Caller is responsible for deleting the AnalogTriggerOutput object.

Parameters
typeAn enum of the type of output object to create.
Returns
A pointer to a new AnalogTriggerOutput object.
int frc::AnalogTrigger::GetIndex ( ) const

Return the index of the analog trigger.

This is the FPGA index of this analog trigger instance.

Returns
The index of the analog trigger.
bool frc::AnalogTrigger::GetInWindow ( )

Return the InWindow output of the analog trigger.

True if the analog input is between the upper and lower limits.

Returns
True if the analog input is between the upper and lower limits.
bool frc::AnalogTrigger::GetTriggerState ( )

Return the TriggerState output of the analog trigger.

True if above upper limit. False if below lower limit. If in Hysteresis, maintain previous state.

Returns
True if above upper limit. False if below lower limit. If in Hysteresis, maintain previous state.
void frc::AnalogTrigger::InitSendable ( SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements frc::Sendable.

void frc::AnalogTrigger::SetAveraged ( bool  useAveragedValue)

Configure the analog trigger to use the averaged vs.

raw values.

If the value is true, then the averaged value is selected for the analog trigger, otherwise the immediate value is used.

Parameters
useAveragedValueIf true, use the Averaged value, otherwise use the instantaneous reading
void frc::AnalogTrigger::SetFiltered ( bool  useFilteredValue)

Configure the analog trigger to use a filtered value.

The analog trigger will operate with a 3 point average rejection filter. This is designed to help with 360 degree pot applications for the period where the pot crosses through zero.

Parameters
useFilteredValueIf true, use the 3 point rejection filter, otherwise use the unfiltered value
void frc::AnalogTrigger::SetLimitsRaw ( int  lower,
int  upper 
)

Set the upper and lower limits of the analog trigger.

The limits are given in ADC codes. If oversampling is used, the units must be scaled appropriately.

Parameters
lowerThe lower limit of the trigger in ADC codes (12-bit values).
upperThe upper limit of the trigger in ADC codes (12-bit values).
void frc::AnalogTrigger::SetLimitsVoltage ( double  lower,
double  upper 
)

Set the upper and lower limits of the analog trigger.

The limits are given as floating point voltage values.

Parameters
lowerThe lower limit of the trigger in Volts.
upperThe upper limit of the trigger in Volts.

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