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

Namespaces

namespace  angle
 
namespace  cancoder_config
 
namespace  colors
 
namespace  falcon_config
 
namespace  gamma_corrected_colors
 
namespace  led
 
namespace  status_frame_config
 
namespace  swerve
 
namespace  talonsrx_config
 
namespace  testing
 
namespace  triggers
 

Classes

struct  ArgosColor
 
class  ArgosLogger
 Log to the console in a clean, repeatable manner. More...
 
struct  CANAddress
 
struct  ClosedLoopSensorConversions
 Conversion factors to aid displaying sensor values as meaningful numbers. More...
 
class  Debouncer
 
struct  DebounceSettings
 
class  EdgeDetector
 
class  FSHomingStorage
 Saves and loads home positions from filesystem. More...
 
class  GenericDebouncer
 
class  HomingStorageInterface
 Interface capable of saving and loading home positions from persistent storage. More...
 
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...
 
struct  LEDState
 Color and animation status for an individual LED. More...
 
class  LEDSubsystem
 
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...
 
class  SwerveFSHomingStorage
 
class  SwerveHomeStorageInterface
 Interface capable of saving and loading module home positions from persistent storage. 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...
 
enum  LogLevel { INFO , ERR }
 Represents a log level of either information, or error. More...
 

Functions

RobotInstance GetRobotInstance ()
 Detect robot instance.
 
static int GetCANAddr (const argos_lib::CANAddress &compAddress, const argos_lib::CANAddress &practiceAddress, argos_lib::RobotInstance instance)
 Gets integer address from CANAddress objects based on robot instance.
 
static std::string_view GetCANBus (const argos_lib::CANAddress &compAddress, const argos_lib::CANAddress &practiceAddress, argos_lib::RobotInstance instance)
 Gets std::string_view bus name from CANAddress objects based on robot instance.
 
VibrationModel VibrationOff ()
 Turn off vibration.
 
VibrationModel VibrationConstant (double intensity)
 Set vibration to a constant value where left and right are the same intensity.
 
VibrationModel VibrationConstant (double intensityLeft, double intensityRight)
 Set vibration to a constant value where left and right have discrete intensities.
 
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.
 
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.
 
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.
 
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.
 
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.
 
constexpr ArgosColor GammaCorrect (ArgosColor original)
 
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.
 
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.
 

Variables

constexpr std::array< uint8_t, 256 > gamma8
 

Detailed Description

Typedef Documentation

◆ VibrationModel

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

Enumeration Type Documentation

◆ LogLevel

Represents a log level of either information, or error.

Enumerator
INFO 
ERR 

◆ RobotInstance

enum struct argos_lib::RobotInstance
strong

Differentiates between practice robot and competition robot.

Enumerator
Competition 

Competition robot.

Practice 

Practice robot.

Function Documentation

◆ GammaCorrect()

constexpr ArgosColor argos_lib::GammaCorrect ( ArgosColor  original)
constexpr

◆ GetCANAddr()

static int argos_lib::GetCANAddr ( const argos_lib::CANAddress compAddress,
const argos_lib::CANAddress practiceAddress,
argos_lib::RobotInstance  instance 
)
inlinestatic

Gets integer address from CANAddress objects based on robot instance.

Parameters
compAddressThe competiton robot CANAddress object
practiceAddressThe practice robot CANAddress object
instanceCurrent instance of robot
Returns
returns compAddress.addr if instance is competition, practiceAddress.addr if instance is practice

◆ GetCANBus()

static std::string_view argos_lib::GetCANBus ( const argos_lib::CANAddress compAddress,
const argos_lib::CANAddress practiceAddress,
argos_lib::RobotInstance  instance 
)
inlinestatic

Gets std::string_view bus name from CANAddress objects based on robot instance.

Parameters
compAddressThe competiton robot CANAddress object
practiceAddressThe practice robot CANAddress object
instanceCurrent instance of robot
Returns
returns compAddress.busName if instance is competition, practiceAddress.busName if instance is practice

◆ 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

Variable Documentation

◆ gamma8

constexpr std::array<uint8_t, 256> argos_lib::gamma8
constexpr
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114,
115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142,
144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175,
177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213,
215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255}