7#include <frc/AddressableLED.h>
31 Array2D(
unsigned width,
unsigned height, T fillValue = {}) :
m_cells(width, std::vector<T>(height, fillValue)) {}
43 T&
at(
unsigned x,
unsigned y) {
return m_cells.at(x).at(y); }
56 const T&
at(
unsigned x,
unsigned y)
const {
return m_cells.at(x).at(y); }
73 }
catch (
const std::out_of_range&) {
80 std::vector<std::vector<T>>
91 using Strip = std::vector<frc::AddressableLED::LEDData>;
Array2D representation where origin is at bottom left.
Definition panel.h:18
unsigned Height() const noexcept
Cells in vertical dimension.
Definition panel.h:70
std::vector< std::vector< T > > m_cells
2D grid of cells. Kept private in case we actually get an ND-Array that would be better than this vec...
Definition panel.h:81
unsigned Width() const noexcept
Cells in horizontal dimension.
Definition panel.h:63
const T & at(unsigned x, unsigned y) const
Const reference to cell at a given coordinate. Useful to read a value and allowing the compiler to pr...
Definition panel.h:56
T & at(unsigned x, unsigned y)
Get mutable reference to cell at a given coordinate.
Definition panel.h:43
Array2D(unsigned width, unsigned height, T fillValue={})
Construct a new Array2D object.
Definition panel.h:31
Array2D()=delete
Disable default constructor because we need dimensions.
address::comp_bot::led led
Definition addresses.h:74
PrimaryScanDirection
When representing a panel as a strip, sequential addresses are in this direction. Note that the actua...
Definition panel.h:99
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 ...
Definition panel.cpp:7
FirstPixelPosition
When representing a panel as a strip, which pixel is the first address.
Definition panel.h:104
std::vector< frc::AddressableLED::LEDData > Strip
A strip of LEDs.
Definition panel.h:91
Definition swap_controllers_command.h:12
PrimaryScanDirection scanDirection
Sequential address direction.
Definition panel.h:108
FirstPixelPosition firstPixel
Location of lowest address pixel.
Definition panel.h:107