WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
AnalogTrigger Class Reference
Inheritance diagram for AnalogTrigger:
SensorBase ErrorBase

Public Member Functions

 AnalogTrigger (int32_t channel)
 Constructor for an analog trigger given a channel number. More...
 
 AnalogTrigger (AnalogInput *channel)
 Construct an analog trigger given an analog input. More...
 
void SetLimitsVoltage (float lower, float upper)
 Set the upper and lower limits of the analog trigger. More...
 
void SetLimitsRaw (int32_t lower, int32_t 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...
 
uint32_t 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...
 
- Public Member Functions inherited from SensorBase
 SensorBase ()
 Creates an instance of the sensor base and gets an FPGA handle.
 
 SensorBase (const SensorBase &)=delete
 
SensorBaseoperator= (const SensorBase &)=delete
 
- Public Member Functions inherited from ErrorBase
 ErrorBase (const ErrorBase &)=delete
 
ErrorBaseoperator= (const ErrorBase &)=delete
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t 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, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

Friends

class AnalogTriggerOutput
 

Additional Inherited Members

- Static Public Member Functions inherited from SensorBase
static void DeleteSingletons ()
 Delete all the singleton classes on the list. More...
 
static uint32_t GetDefaultSolenoidModule ()
 
static bool CheckSolenoidModule (uint8_t moduleNumber)
 Check that the solenoid module number is valid. More...
 
static bool CheckDigitalChannel (uint32_t channel)
 Check that the digital channel number is valid. More...
 
static bool CheckRelayChannel (uint32_t channel)
 Check that the digital channel number is valid. More...
 
static bool CheckPWMChannel (uint32_t channel)
 Check that the digital channel number is valid. More...
 
static bool CheckAnalogInput (uint32_t channel)
 Check that the analog input number is value. More...
 
static bool CheckAnalogOutput (uint32_t channel)
 Check that the analog output number is valid. More...
 
static bool CheckSolenoidChannel (uint32_t channel)
 Verify that the solenoid channel number is within limits. More...
 
static bool CheckPDPChannel (uint32_t channel)
 Verify that the power distribution channel number is within limits. More...
 
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static void SetGlobalWPIError (llvm::StringRef errorMessage, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 Retrieve the current global error.
 
- Static Public Attributes inherited from SensorBase
static const uint32_t kDigitalChannels = 26
 
static const uint32_t kAnalogInputs = 8
 
static const uint32_t kAnalogOutputs = 2
 
static const uint32_t kSolenoidChannels = 8
 
static const uint32_t kSolenoidModules = 2
 
static const uint32_t kPwmChannels = 20
 
static const uint32_t kRelayChannels = 8
 
static const uint32_t kPDPChannels = 16
 
static const uint32_t kChassisSlots = 8
 
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
 Add sensor to the singleton list. More...
 
- Protected Attributes inherited from ErrorBase
Error m_error
 
- Static Protected Attributes inherited from SensorBase
static void * m_digital_ports [kDigitalChannels]
 
static void * m_relay_ports [kRelayChannels]
 
static void * m_pwm_ports [kPwmChannels]
 
- Static Protected Attributes inherited from ErrorBase
static priority_mutex _globalErrorMutex
 
static Error _globalError
 

Constructor & Destructor Documentation

AnalogTrigger::AnalogTrigger ( int32_t  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.
AnalogTrigger::AnalogTrigger ( AnalogInput input)
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 > 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.
uint32_t 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 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 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 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 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 AnalogTrigger::SetLimitsRaw ( int32_t  lower,
int32_t  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 AnalogTrigger::SetLimitsVoltage ( float  lower,
float  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 files: