2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
argos_lib Namespace Reference

Namespaces

namespace  cancoder_config
 
namespace  falcon_config
 
namespace  status_frame_config
 
namespace  swerve
 
namespace  talonsrx_config
 

Classes

struct  CANAddress
 
struct  ClosedLoopSensorConversions
 Conversion factors to aid displaying sensor values as meaningful numbers. More...
 
class  Debouncer
 
struct  DebounceSettings
 
class  EdgeDetector
 
class  HysteresisFilter
 A simple hysteresis filter for giving a bool output for a threshold. More...
 
struct  InterpMapPoint
 Point that helps generate an interpolation map. More...
 
class  InterpolationMap
 Performs linear interpolation of a value based on a set of input->output mapping points. More...
 
class  NTMotorPIDTuner
 Allows user to set PID parameters from network tables and update the motor configurations on updates. Also monitors status information from motors to aid tuning. More...
 
class  NTSubscriber
 Subscribes to Network Tables entry updates and calls a specified callback to use the new value. More...
 
class  SwapControllersCommand
 Swaps rolls of two controllers. Useful if one controller breaks during a match. More...
 
class  SwappableControllersSubsystem
 Allows two controllers to swap between "Driver" and "Operator" control schemes on the fly by swapping the m_driverController and m_operatorController objects. More...
 
struct  VibrationStatus
 Vibration percentages that can be sent to controller for user feedback. More...
 
class  XboxController
 

Typedefs

using VibrationModel = std::function< VibrationStatus()>
 

Enumerations

enum struct  RobotInstance { Competition , Practice }
 Differentiates between practice robot and competition robot. More...
 

Functions

RobotInstance GetRobotInstance ()
 Detect robot instance. More...
 
VibrationModel VibrationOff ()
 Turn off vibration. More...
 
VibrationModel VibrationConstant (double intensity)
 Set vibration to a constant value where left and right are the same intensity. More...
 
VibrationModel VibrationConstant (double intensityLeft, double intensityRight)
 Set vibration to a constant value where left and right have discrete intensities. More...
 
VibrationModel VibrationSyncPulse (units::millisecond_t pulsePeriod, double intensityOn, double intensityOff=0.0)
 Toggle vibration between intensityOn and intensityOff levels. Left and right have the same vibration intensity. More...
 
VibrationModel VibrationSyncWave (units::millisecond_t pulsePeriod, double intensityOn, double intensityOff=0.0)
 Smoothly transition vibration between intensityOn and intensityOff levels. Left and right have the same vibration intensity. More...
 
VibrationModel VibrationAlternatePulse (units::millisecond_t pulsePeriod, double intensityOn, double intensityOff=0.0)
 Toggle vibration between intensityOn and intensityOff levels. Left output is in intensityOn phase while right output is in intensityOff phase and vice-versa. More...
 
VibrationModel VibrationAlternateWave (units::millisecond_t pulsePeriod, double intensityOn, double intensityOff=0.0)
 Smoothly transition vibration between intensityOn and intensityOff levels. Left output is in intensityOn phase while right output is in intensityOff phase and vice-versa. More...
 
VibrationModel TemporaryVibrationPattern (VibrationModel temporaryModel, units::millisecond_t temporaryModelDuration, VibrationModel lastingModel=VibrationOff())
 Run a vibration model for a specified duration, then run another model in perpetuity thereafter. More...
 
template<typename T >
static constexpr bool InThreshold (const T value, const T target, const T threshold)
 Detect if a value is within a threshold of a target value. More...
 
template<class T , class V >
constexpr bool operator< (const InterpMapPoint< T, V > &a, const T &b)
 
template<class T , class V >
constexpr bool operator< (const T &a, const InterpMapPoint< T, V > &b)
 
template<class Callable >
constexpr double GetSensorConversionFactor (Callable toPhysicalUnitsFunction)
 Generates a double value to convert raw sensor values to physical units represented as a double. More...
 

Detailed Description

Typedef Documentation

◆ VibrationModel

using argos_lib::VibrationModel = typedef std::function<VibrationStatus()>

Enumeration Type Documentation

◆ RobotInstance

enum struct argos_lib::RobotInstance
strong

Differentiates between practice robot and competition robot.

Enumerator
Competition 

Competition robot.

Practice 

Practice robot.

Function Documentation

◆ GetRobotInstance()

argos_lib::RobotInstance argos_lib::GetRobotInstance ( )

Detect robot instance.

Returns
RobotInstance

◆ GetSensorConversionFactor()

template<class Callable >
constexpr double argos_lib::GetSensorConversionFactor ( Callable  toPhysicalUnitsFunction)
constexpr

Generates a double value to convert raw sensor values to physical units represented as a double.

Template Parameters
CallableFunction that generates a units value from a double
Parameters
toPhysicalUnitsFunctionConversion function
Returns
double Physical unit value stripped of unit so it's just a double

◆ InThreshold()

template<typename T >
static constexpr bool argos_lib::InThreshold ( const T  value,
const T  target,
const T  threshold 
)
staticconstexpr

Detect if a value is within a threshold of a target value.

Template Parameters
TType that implements operator+(), operator-(), operator<=() and operator>=()
Parameters
valueValue to check
targetCenter of range
thresholdAllowable error from target
Returns
true when value is within threshold of target, false otherwise

◆ operator<() [1/2]

template<class T , class V >
constexpr bool argos_lib::operator< ( const InterpMapPoint< T, V > &  a,
const T &  b 
)
constexpr

◆ operator<() [2/2]

template<class T , class V >
constexpr bool argos_lib::operator< ( const T &  a,
const InterpMapPoint< T, V > &  b 
)
constexpr

◆ TemporaryVibrationPattern()

VibrationModel argos_lib::TemporaryVibrationPattern ( argos_lib::VibrationModel  temporaryModel,
units::millisecond_t  temporaryModelDuration,
argos_lib::VibrationModel  lastingModel = VibrationOff() 
)

Run a vibration model for a specified duration, then run another model in perpetuity thereafter.

Parameters
temporaryModelModel to run for the specified duration
temporaryModelDurationAmount of time to run temporaryModel
lastingModelModel to run forever after the specified duration
Returns
VibrationModel

◆ VibrationAlternatePulse()

VibrationModel argos_lib::VibrationAlternatePulse ( units::millisecond_t  pulsePeriod,
double  intensityOn,
double  intensityOff = 0.0 
)

Toggle vibration between intensityOn and intensityOff levels. Left output is in intensityOn phase while right output is in intensityOff phase and vice-versa.

Parameters
pulsePeriodTime to complete one intensityOn->intensityOff cycle
intensityOnVibration percent output when in intensityOn portion of cycle [0,1.0]
intensityOffVibration percent output when in intensityOff portion of cycle [0,1.0]
Returns
VibrationModel

◆ VibrationAlternateWave()

VibrationModel argos_lib::VibrationAlternateWave ( units::millisecond_t  pulsePeriod,
double  intensityOn,
double  intensityOff = 0.0 
)

Smoothly transition vibration between intensityOn and intensityOff levels. Left output is in intensityOn phase while right output is in intensityOff phase and vice-versa.

Parameters
pulsePeriodTime to complete one intensityOn->intensityOff cycle
intensityOnVibration percent output when at peak of intensityOn portion of cycle [0,1.0]
intensityOffVibration percent output when in trough of intensityOff portion of cycle [0,1.0]
Returns
VibrationModel

◆ VibrationConstant() [1/2]

VibrationModel argos_lib::VibrationConstant ( double  intensity)

Set vibration to a constant value where left and right are the same intensity.

Parameters
intensityPercent vibration output [0,1.0]
Returns
VibrationModel

◆ VibrationConstant() [2/2]

VibrationModel argos_lib::VibrationConstant ( double  intensityLeft,
double  intensityRight 
)

Set vibration to a constant value where left and right have discrete intensities.

Parameters
intensityLeftLeft vibration percent output [0,1.0]
intensityRightRight vibration percent output [0,1.0]
Returns
VibrationModel

◆ VibrationOff()

VibrationModel argos_lib::VibrationOff ( )

Turn off vibration.

Returns
VibrationModel

◆ VibrationSyncPulse()

VibrationModel argos_lib::VibrationSyncPulse ( units::millisecond_t  pulsePeriod,
double  intensityOn,
double  intensityOff = 0.0 
)

Toggle vibration between intensityOn and intensityOff levels. Left and right have the same vibration intensity.

Parameters
pulsePeriodTime to complete one intensityOn->intensityOff cycle
intensityOnVibration percent output when in intensityOn portion of cycle [0,1.0]
intensityOffVibration percent output when in intensityOff portion of cycle [0,1.0]
Returns
VibrationModel

◆ VibrationSyncWave()

VibrationModel argos_lib::VibrationSyncWave ( units::millisecond_t  pulsePeriod,
double  intensityOn,
double  intensityOff = 0.0 
)

Smoothly transition vibration between intensityOn and intensityOff levels. Left and right have the same vibration intensity.

Parameters
pulsePeriodTime to complete one intensityOn->intensityOff cycle
intensityOnVibration percent output when at peak of intensityOn portion of cycle [0,1.0]
intensityOffVibration percent output when in trough of intensityOff portion of cycle [0,1.0]
Returns
VibrationModel