2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
|
Namespaces | |
namespace | animation |
Classes | |
struct | Animation |
A representation of a custom LED animation. More... | |
class | Array2D |
Array2D representation where origin is at bottom left. More... | |
struct | PanelScanParams |
struct | Sprite |
https://en.wikipedia.org/wiki/Sprite_(computer_graphics) More... | |
Typedefs | |
using | AnimatedSprite = std::function< Sprite()> |
Callable to get dynamic sprite. | |
using | Panel = Array2D< frc::AddressableLED::LEDData > |
Pixels in a panel. | |
using | Mask = Array2D< float > |
using | Strip = std::vector< frc::AddressableLED::LEDData > |
A strip of LEDs. | |
Enumerations | |
enum class | PrimaryScanDirection { Vertical , Horizontal } |
When representing a panel as a strip, sequential addresses are in this direction. Note that the actual scan direction will alternate on every row/column in the secondary scan direction. For example, if the primary scan direction is vertical, adjacent columns will alternate between up and down. More... | |
enum class | FirstPixelPosition { TopRight , TopLeft , BottomLeft , BottomRight } |
When representing a panel as a strip, which pixel is the first address. More... | |
Functions | |
units::degree_t | FlipHorizontal (units::degree_t incidentAngle) |
Flip an angle horizontally as though a ray bounces off a horizontal surface. | |
units::degree_t | FlipVertical (units::degree_t inicidentAngle) |
Flip an angle vertically as though a ray bounces off a vertical surface. | |
bool | PointInBox (float corner1X, float corner1Y, float corner2X, float corner2Y, float pointX, float pointY) |
Determine if a point (pointX, pointY) is within the bounds of an axis-aligned bounding box with opposite corners (corner1X, corner1Y) and (corner2X, corner2Y) | |
std::optional< std::pair< float, float > > | SegmentIntersection (float s1x1, float s1y1, float s1x2, float s1y2, float s2x1, float s2y1, float s2x2, float s2y2) |
Finds the intersection point of two lines – [(s1x1, s1y1), (s1x2, s1y2)] and [(s2x1, s2y1), (s2x2, s2y2)] – if it exists. If the two lines are colinear, no intersection point is returned. | |
Strip | Serialize (const Panel &panel, const PanelScanParams ¶ms) |
Convert a panel to a 1D vector of pixels in addressing order. This is a helper function because many panel animations are easier to design in 2D space then convert back to address order when it comes time to display. | |
using argos_lib::led::AnimatedSprite = typedef std::function<Sprite()> |
Callable to get dynamic sprite.
using argos_lib::led::Mask = typedef Array2D<float> |
Transparency mask (alpha channel) for a panel. Range [0,1] where 0 is fully transparent and 1 is fully opaque.
using argos_lib::led::Panel = typedef Array2D<frc::AddressableLED::LEDData> |
Pixels in a panel.
using argos_lib::led::Strip = typedef std::vector<frc::AddressableLED::LEDData> |
A strip of LEDs.
|
strong |
|
strong |
When representing a panel as a strip, sequential addresses are in this direction. Note that the actual scan direction will alternate on every row/column in the secondary scan direction. For example, if the primary scan direction is vertical, adjacent columns will alternate between up and down.
Enumerator | |
---|---|
Vertical | |
Horizontal |
units::degree_t argos_lib::led::FlipHorizontal | ( | units::degree_t | incidentAngle | ) |
Flip an angle horizontally as though a ray bounces off a horizontal surface.
incidentAngle | Angle of original motion |
units::degree_t argos_lib::led::FlipVertical | ( | units::degree_t | inicidentAngle | ) |
Flip an angle vertically as though a ray bounces off a vertical surface.
incidentAngle | Angle of original motion |
bool argos_lib::led::PointInBox | ( | float | corner1X, |
float | corner1Y, | ||
float | corner2X, | ||
float | corner2Y, | ||
float | pointX, | ||
float | pointY | ||
) |
Determine if a point (pointX, pointY) is within the bounds of an axis-aligned bounding box with opposite corners (corner1X, corner1Y) and (corner2X, corner2Y)
corner1X | First corner X coordinate |
corner1Y | First corner Y coordinate |
corner2X | Second corner X coordinate |
corner2Y | Second corner Y coordinate |
pointX | Test point X coordinate |
pointY | Test point Y coordinate |
std::optional< std::pair< float, float > > argos_lib::led::SegmentIntersection | ( | float | s1x1, |
float | s1y1, | ||
float | s1x2, | ||
float | s1y2, | ||
float | s2x1, | ||
float | s2y1, | ||
float | s2x2, | ||
float | s2y2 | ||
) |
Finds the intersection point of two lines – [(s1x1, s1y1), (s1x2, s1y2)] and [(s2x1, s2y1), (s2x2, s2y2)] – if it exists. If the two lines are colinear, no intersection point is returned.
s1x1 | First point of first segment x coordinate |
s1y1 | First point of first segment y coordinate |
s1x2 | Second point of first segment x coordinate |
s1y2 | Second point of first segment y coordinate |
s2x1 | First point of second segment x coordinate |
s2y1 | First point of second segment y coordinate |
s2x2 | Second point of second segment x coordinate |
s2y2 | Second point of second segment y coordinate |
argos_lib::led::Strip argos_lib::led::Serialize | ( | const Panel & | panel, |
const PanelScanParams & | params | ||
) |
Convert a panel to a 1D vector of pixels in addressing order. This is a helper function because many panel animations are easier to design in 2D space then convert back to address order when it comes time to display.
panel | Panel to serialize |
params | Parameters describing panel addressing and orientation |