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

#include <simple_led_subsystem.h>

Inheritance diagram for SimpleLedSubsystem:

Public Member Functions

 SimpleLedSubsystem (argos_lib::RobotInstance instance)
 
void Enable ()
 
void Disable ()
 
void SetLedsConnectedBrightness (bool connected)
 
void SetDisableAnimation (std::function< void()> animationFunction)
 
void SetLedGroupColor (LedGroup group, argos_lib::ArgosColor color, bool restorable=true)
 Sets group of leds to given color.
 
void SetLedStripColor (LedStrip strip, argos_lib::ArgosColor color, bool restorable=true)
 
void SetAllGroupsColor (argos_lib::ArgosColor color, bool restorable=true, std::optional< std::function< GamePiece()> > tipColor=std::nullopt)
 Sets all led groups to a given color.
 
void SetAllGroupsFade (argos_lib::ArgosColor color, bool restorable=true, std::optional< std::function< GamePiece()> > tipColor=std::nullopt)
 
void SetAllGroupsFlash (argos_lib::ArgosColor color, bool restorable=true)
 
void FlashStrip (LedStrip strip, argos_lib::ArgosColor color, bool restorable=true)
 
void SetAllGroupsLarson (argos_lib::ArgosColor color, bool restorable=true)
 
argos_lib::ArgosColor GetAllianceColor ()
 
void SetAllGroupsAllianceColor (bool fade, bool restorable=true, std::optional< std::function< GamePiece()> > tipColor=std::nullopt)
 Set all groups of LEDs to the alliance color.
 
void StopAllAnimations (bool restorable=true)
 
void SetAllGroupsGamePieceColor (GamePiece gp, bool restorable=true)
 Set all groups to color of given game piece.
 
void SetAllGroupsOff (bool restorable=true)
 Turn off all LEDs.
 
void Periodic () override
 
void FireEverywhere (bool restorable=true)
 
void Blind (bool restorable=true)
 
void ColorSweep (argos_lib::ArgosColor color, bool correctGamma=true, bool restorable=true)
 
void TemporaryAnimate (std::function< void()> animationFunction, units::millisecond_t duration)
 

Static Private Member Functions

static constexpr argos_lib::ArgosColor GetGamePieceColor (GamePiece gp, bool gammaCorrect=true)
 

Private Attributes

std::optional< CANdle > m_CANdle
 
argos_lib::ArgosLogger m_log
 
bool m_enabled
 
bool m_hasBeenConnected
 
std::function< void()> m_disableUpdateFunction
 
std::function< void()> m_ledUpdateFunction
 
std::optional< std::function< void(void)> > m_restoreAnimationFunction
 
std::chrono::time_point< std::chrono::steady_clock > m_startTime
 
units::millisecond_t m_temporaryDuration
 

Static Private Attributes

static constexpr int startIndex_frontLeft = 8
 Address of first LED in strip.
 
static constexpr int length_frontLeft = 29
 Number of LEDs in strip.
 
static constexpr bool inverted_frontLeft = false
 true indicates first index is at top of tower
 
static constexpr int startIndex_frontRight = 37
 
static constexpr int length_frontRight = 30
 
static constexpr bool inverted_frontRight = true
 
static constexpr int startIndex_sideFront = 67
 
static constexpr int length_sideFront = 61
 
static constexpr bool inverted_sideFront = false
 
static constexpr int startIndex_sideBack = 128
 
static constexpr int length_sideBack = 61
 
static constexpr bool inverted_sideBack = true
 
static constexpr int startIndex_backRight = 189
 
static constexpr int length_backRight = 58
 
static constexpr bool inverted_backRight = false
 
static constexpr int startIndex_backLeft = 247
 
static constexpr int length_backLeft = 57
 
static constexpr bool inverted_backLeft = true
 

Constructor & Destructor Documentation

◆ SimpleLedSubsystem()

SimpleLedSubsystem::SimpleLedSubsystem ( argos_lib::RobotInstance  instance)
explicit

Member Function Documentation

◆ Blind()

void SimpleLedSubsystem::Blind ( bool  restorable = true)

◆ ColorSweep()

void SimpleLedSubsystem::ColorSweep ( argos_lib::ArgosColor  color,
bool  correctGamma = true,
bool  restorable = true 
)

◆ Disable()

void SimpleLedSubsystem::Disable ( )

◆ Enable()

void SimpleLedSubsystem::Enable ( )

◆ FireEverywhere()

void SimpleLedSubsystem::FireEverywhere ( bool  restorable = true)

◆ FlashStrip()

void SimpleLedSubsystem::FlashStrip ( LedStrip  strip,
argos_lib::ArgosColor  color,
bool  restorable = true 
)

◆ GetAllianceColor()

argos_lib::ArgosColor SimpleLedSubsystem::GetAllianceColor ( )

◆ GetGamePieceColor()

constexpr argos_lib::ArgosColor SimpleLedSubsystem::GetGamePieceColor ( GamePiece  gp,
bool  gammaCorrect = true 
)
staticconstexprprivate

◆ Periodic()

void SimpleLedSubsystem::Periodic ( )
override

Will be called periodically whenever the CommandScheduler runs.

◆ SetAllGroupsAllianceColor()

void SimpleLedSubsystem::SetAllGroupsAllianceColor ( bool  fade,
bool  restorable = true,
std::optional< std::function< GamePiece()> >  tipColor = std::nullopt 
)

Set all groups of LEDs to the alliance color.

◆ SetAllGroupsColor()

void SimpleLedSubsystem::SetAllGroupsColor ( argos_lib::ArgosColor  color,
bool  restorable = true,
std::optional< std::function< GamePiece()> >  tipColor = std::nullopt 
)

Sets all led groups to a given color.

Parameters
coloran ArgosColor to set the LEDs too

◆ SetAllGroupsFade()

void SimpleLedSubsystem::SetAllGroupsFade ( argos_lib::ArgosColor  color,
bool  restorable = true,
std::optional< std::function< GamePiece()> >  tipColor = std::nullopt 
)

◆ SetAllGroupsFlash()

void SimpleLedSubsystem::SetAllGroupsFlash ( argos_lib::ArgosColor  color,
bool  restorable = true 
)

◆ SetAllGroupsGamePieceColor()

void SimpleLedSubsystem::SetAllGroupsGamePieceColor ( GamePiece  gp,
bool  restorable = true 
)

Set all groups to color of given game piece.

◆ SetAllGroupsLarson()

void SimpleLedSubsystem::SetAllGroupsLarson ( argos_lib::ArgosColor  color,
bool  restorable = true 
)

◆ SetAllGroupsOff()

void SimpleLedSubsystem::SetAllGroupsOff ( bool  restorable = true)

Turn off all LEDs.

◆ SetDisableAnimation()

void SimpleLedSubsystem::SetDisableAnimation ( std::function< void()>  animationFunction)

◆ SetLedGroupColor()

void SimpleLedSubsystem::SetLedGroupColor ( LedGroup  group,
argos_lib::ArgosColor  color,
bool  restorable = true 
)

Sets group of leds to given color.

Parameters
groupThe group of leds to set
coloran ArgosColor to set the LEDs too

◆ SetLedsConnectedBrightness()

void SimpleLedSubsystem::SetLedsConnectedBrightness ( bool  connected)

◆ SetLedStripColor()

void SimpleLedSubsystem::SetLedStripColor ( LedStrip  strip,
argos_lib::ArgosColor  color,
bool  restorable = true 
)

◆ StopAllAnimations()

void SimpleLedSubsystem::StopAllAnimations ( bool  restorable = true)

◆ TemporaryAnimate()

void SimpleLedSubsystem::TemporaryAnimate ( std::function< void()>  animationFunction,
units::millisecond_t  duration 
)

Member Data Documentation

◆ inverted_backLeft

constexpr bool SimpleLedSubsystem::inverted_backLeft = true
staticconstexprprivate

◆ inverted_backRight

constexpr bool SimpleLedSubsystem::inverted_backRight = false
staticconstexprprivate

◆ inverted_frontLeft

constexpr bool SimpleLedSubsystem::inverted_frontLeft = false
staticconstexprprivate

true indicates first index is at top of tower

◆ inverted_frontRight

constexpr bool SimpleLedSubsystem::inverted_frontRight = true
staticconstexprprivate

◆ inverted_sideBack

constexpr bool SimpleLedSubsystem::inverted_sideBack = true
staticconstexprprivate

◆ inverted_sideFront

constexpr bool SimpleLedSubsystem::inverted_sideFront = false
staticconstexprprivate

◆ length_backLeft

constexpr int SimpleLedSubsystem::length_backLeft = 57
staticconstexprprivate

◆ length_backRight

constexpr int SimpleLedSubsystem::length_backRight = 58
staticconstexprprivate

◆ length_frontLeft

constexpr int SimpleLedSubsystem::length_frontLeft = 29
staticconstexprprivate

Number of LEDs in strip.

◆ length_frontRight

constexpr int SimpleLedSubsystem::length_frontRight = 30
staticconstexprprivate

◆ length_sideBack

constexpr int SimpleLedSubsystem::length_sideBack = 61
staticconstexprprivate

◆ length_sideFront

constexpr int SimpleLedSubsystem::length_sideFront = 61
staticconstexprprivate

◆ m_CANdle

std::optional<CANdle> SimpleLedSubsystem::m_CANdle
private

◆ m_disableUpdateFunction

std::function<void()> SimpleLedSubsystem::m_disableUpdateFunction
private

◆ m_enabled

bool SimpleLedSubsystem::m_enabled
private

◆ m_hasBeenConnected

bool SimpleLedSubsystem::m_hasBeenConnected
private

◆ m_ledUpdateFunction

std::function<void()> SimpleLedSubsystem::m_ledUpdateFunction
private

◆ m_log

argos_lib::ArgosLogger SimpleLedSubsystem::m_log
private

◆ m_restoreAnimationFunction

std::optional<std::function<void(void)> > SimpleLedSubsystem::m_restoreAnimationFunction
private

◆ m_startTime

std::chrono::time_point<std::chrono::steady_clock> SimpleLedSubsystem::m_startTime
private

◆ m_temporaryDuration

units::millisecond_t SimpleLedSubsystem::m_temporaryDuration
private

◆ startIndex_backLeft

constexpr int SimpleLedSubsystem::startIndex_backLeft = 247
staticconstexprprivate

◆ startIndex_backRight

constexpr int SimpleLedSubsystem::startIndex_backRight = 189
staticconstexprprivate

◆ startIndex_frontLeft

constexpr int SimpleLedSubsystem::startIndex_frontLeft = 8
staticconstexprprivate

Address of first LED in strip.

◆ startIndex_frontRight

constexpr int SimpleLedSubsystem::startIndex_frontRight = 37
staticconstexprprivate

◆ startIndex_sideBack

constexpr int SimpleLedSubsystem::startIndex_sideBack = 128
staticconstexprprivate

◆ startIndex_sideFront

constexpr int SimpleLedSubsystem::startIndex_sideFront = 67
staticconstexprprivate

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