WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc::AnalogTrigger Class Reference

#include <frc/AnalogTrigger.h>

Inheritance diagram for frc::AnalogTrigger:
wpi::Sendable wpi::SendableHelper< AnalogTrigger >

Public Member Functions

 AnalogTrigger (int channel)
 Constructor for an analog trigger given a channel number.
 
 AnalogTrigger (AnalogInput &input)
 Construct an analog trigger using an existing analog input.
 
 AnalogTrigger (AnalogInput *input)
 Construct an analog trigger using an existing analog input.
 
 AnalogTrigger (std::shared_ptr< AnalogInput > input)
 Construct an analog trigger using an existing analog input.
 
 AnalogTrigger (DutyCycle &dutyCycle)
 Construct an analog trigger using an existing duty cycle input.
 
 AnalogTrigger (DutyCycle *dutyCycle)
 Construct an analog trigger using an existing duty cycle input.
 
 AnalogTrigger (std::shared_ptr< DutyCycle > dutyCycle)
 Construct an analog trigger using an existing duty cycle input.
 
 AnalogTrigger (AnalogTrigger &&)=default
 
AnalogTriggeroperator= (AnalogTrigger &&)=default
 
 ~AnalogTrigger () override=default
 
void SetLimitsVoltage (double lower, double upper)
 Set the upper and lower limits of the analog trigger.
 
void SetLimitsDutyCycle (double lower, double upper)
 Set the upper and lower duty cycle limits of the analog trigger.
 
void SetLimitsRaw (int lower, int upper)
 Set the upper and lower limits of the analog trigger.
 
void SetAveraged (bool useAveragedValue)
 Configure the analog trigger to use the averaged vs.
 
void SetFiltered (bool useFilteredValue)
 Configure the analog trigger to use a filtered value.
 
int GetIndex () const
 Return the index of the analog trigger.
 
bool GetInWindow ()
 Return the InWindow output of the analog trigger.
 
bool GetTriggerState ()
 Return the TriggerState output of the analog trigger.
 
std::shared_ptr< AnalogTriggerOutputCreateOutput (AnalogTriggerType type) const
 Creates an AnalogTriggerOutput object.
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object.
 
- Public Member Functions inherited from wpi::Sendable
virtual constexpr ~Sendable ()=default
 
- Public Member Functions inherited from wpi::SendableHelper< AnalogTrigger >
constexpr SendableHelper (const SendableHelper &rhs)=default
 
constexpr SendableHelper (SendableHelper &&rhs)
 
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default
 
constexpr SendableHelperoperator= (SendableHelper &&rhs)
 

Friends

class AnalogTriggerOutput
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ AnalogTrigger() [1/8]

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.

◆ AnalogTrigger() [2/8]

frc::AnalogTrigger::AnalogTrigger ( AnalogInput & input)
explicit

Construct an analog trigger using an existing analog input.

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

Parameters
inputA reference to the existing AnalogInput object

◆ AnalogTrigger() [3/8]

frc::AnalogTrigger::AnalogTrigger ( AnalogInput * input)
explicit

Construct an analog trigger using an existing analog input.

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

Parameters
inputA pointer to the existing AnalogInput object

◆ AnalogTrigger() [4/8]

frc::AnalogTrigger::AnalogTrigger ( std::shared_ptr< AnalogInput > input)
explicit

Construct an analog trigger using an existing analog input.

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

Parameters
inputA shared_ptr to the existing AnalogInput object

◆ AnalogTrigger() [5/8]

frc::AnalogTrigger::AnalogTrigger ( DutyCycle & dutyCycle)
explicit

Construct an analog trigger using an existing duty cycle input.

Parameters
dutyCycleA reference to the existing DutyCycle object

◆ AnalogTrigger() [6/8]

frc::AnalogTrigger::AnalogTrigger ( DutyCycle * dutyCycle)
explicit

Construct an analog trigger using an existing duty cycle input.

Parameters
dutyCycleA pointer to the existing DutyCycle object

◆ AnalogTrigger() [7/8]

frc::AnalogTrigger::AnalogTrigger ( std::shared_ptr< DutyCycle > dutyCycle)
explicit

Construct an analog trigger using an existing duty cycle input.

Parameters
dutyCycleA shared_ptr to the existing DutyCycle object

◆ AnalogTrigger() [8/8]

frc::AnalogTrigger::AnalogTrigger ( AnalogTrigger && )
default

◆ ~AnalogTrigger()

frc::AnalogTrigger::~AnalogTrigger ( )
overridedefault

Member Function Documentation

◆ CreateOutput()

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

Creates an AnalogTriggerOutput object.

Parameters
typeAn enum of the type of output object to create.
Returns
A pointer to a new AnalogTriggerOutput object.

◆ GetIndex()

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.

◆ GetInWindow()

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.

◆ GetTriggerState()

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.

◆ InitSendable()

void frc::AnalogTrigger::InitSendable ( wpi::SendableBuilder & builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::Sendable.

◆ operator=()

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

◆ SetAveraged()

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

◆ SetFiltered()

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

◆ SetLimitsDutyCycle()

void frc::AnalogTrigger::SetLimitsDutyCycle ( double lower,
double upper )

Set the upper and lower duty cycle limits of the analog trigger.

The limits are given as floating point values between 0 and 1.

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

◆ SetLimitsRaw()

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

◆ SetLimitsVoltage()

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.

Friends And Related Symbol Documentation

◆ AnalogTriggerOutput

friend class AnalogTriggerOutput
friend

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