Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
MultimediaBoard Class Reference

This class handles communication with the multimedia board on the rover by sending RoveComm packets over the network. More...

#include <MultimediaBoard.h>

Collaboration diagram for MultimediaBoard:

Classes

struct  RGB
 This struct serves as a container for RGB values, and provides a few overridden constructors for converting from hex to 8-bit RGB values. More...
 

Public Types

enum class  MultimediaBoardLightingState {
  eOff = -2 , eCustom , eTeleOp , eAutonomy ,
  eReachedGoal
}
 

Public Member Functions

 MultimediaBoard ()
 Construct a new Multimedia Board:: Multimedia Board object.
 
 ~MultimediaBoard ()
 Destroy the Multimedia Board:: Multimedia Board object.
 
void SendLightingState (MultimediaBoardLightingState eState)
 Sends a predetermined color pattern to board.
 
void SendRGB (RGB stRGBVal)
 Send a custom RGB value to the board.
 
MultimediaBoardLightingState GetCurrentLightingState () const
 Accessor for the current lighting state of the multimedia board.
 
RGB GetCustomLightingValues () const
 Accessor for the current custom lighting RGB values.
 

Private Attributes

MultimediaBoardLightingState m_eCurrentLightingState
 
RGB m_stCustomRGBValues
 

Detailed Description

This class handles communication with the multimedia board on the rover by sending RoveComm packets over the network.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-23

Member Enumeration Documentation

◆ MultimediaBoardLightingState

enum class MultimediaBoard::MultimediaBoardLightingState
strong
96 {
97 eOff = -2, // LED panel off.
98 eCustom, // A custom value has been set or board should go back to a previously custom set value.
99 eTeleOp, // TeleOp color = BLUE
100 eAutonomy, // Autonomy color = RED
101 eReachedGoal // Goal reached = FLASH GREEN
102 };

Constructor & Destructor Documentation

◆ MultimediaBoard()

MultimediaBoard::MultimediaBoard ( )

Construct a new Multimedia Board:: Multimedia Board object.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-23
28{
29 // Initialize member variables.
30 m_eCurrentLightingState = MultimediaBoardLightingState::eOff;
31}

◆ ~MultimediaBoard()

MultimediaBoard::~MultimediaBoard ( )

Destroy the Multimedia Board:: Multimedia Board object.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-23
41{
42 // Send RGB 0, 0, 0 to multimedia board to turn LED panel off.
43 this->SendLightingState(MultimediaBoardLightingState::eOff);
44}
void SendLightingState(MultimediaBoardLightingState eState)
Sends a predetermined color pattern to board.
Definition MultimediaBoard.cpp:55
Here is the call graph for this function:

Member Function Documentation

◆ SendLightingState()

void MultimediaBoard::SendLightingState ( MultimediaBoardLightingState  eState)

Sends a predetermined color pattern to board.

Parameters
eState- The lighting state. Enum defined in header file for MultimediaBoard.h
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-23
56{
57 // Update member variables.
58 m_eCurrentLightingState = eState;
59
60 // Create new RoveCommPacket. Will be constructed in enum.
61 rovecomm::RoveCommPacket<uint8_t> stPacket;
62
63 // Decide what lighting operation to execute.
64 switch (eState)
65 {
66 case MultimediaBoardLightingState::eOff:
67 {
68 // Construct a RoveComm packet with the lighting data.
69 stPacket.unDataId = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_ID;
70 stPacket.unDataCount = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_COUNT;
71 stPacket.eDataType = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_TYPE;
72 // Use RoveComm to send 0, 0, 0 RGB values.
73 stPacket.vData.emplace_back(0);
74 stPacket.vData.emplace_back(0);
75 stPacket.vData.emplace_back(0);
76 break;
77 }
78 case MultimediaBoardLightingState::eCustom:
79 {
80 // Use RoveComm to send old custom values previously set.
81 this->SendRGB(m_stCustomRGBValues);
82 break;
83 }
84 case MultimediaBoardLightingState::eTeleOp:
85 {
86 // Construct a RoveComm packet with the lighting data.
87 stPacket.unDataId = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_ID;
88 stPacket.unDataCount = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_COUNT;
89 stPacket.eDataType = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_TYPE;
90 // Use RoveComm to send BLUE color state value.
91 stPacket.vData.emplace_back(static_cast<uint8_t>(manifest::Core::DISPLAYSTATE::TELEOP));
92 break;
93 }
94 case MultimediaBoardLightingState::eAutonomy:
95 {
96 // Construct a RoveComm packet with the lighting data.
97 stPacket.unDataId = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_ID;
98 stPacket.unDataCount = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_COUNT;
99 stPacket.eDataType = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_TYPE;
100 // Use RoveComm to send RED color state value.
101 stPacket.vData.emplace_back(static_cast<uint8_t>(manifest::Core::DISPLAYSTATE::AUTONOMY));
102 break;
103 }
104 case MultimediaBoardLightingState::eReachedGoal:
105 {
106 // Send Reached Goal state over RoveComm.
107 stPacket.unDataId = manifest::Autonomy::TELEMETRY.find("REACHEDGOAL")->second.DATA_ID;
108 stPacket.unDataCount = manifest::Autonomy::TELEMETRY.find("REACHEDGOAL")->second.DATA_COUNT;
109 stPacket.eDataType = manifest::Autonomy::TELEMETRY.find("REACHEDGOAL")->second.DATA_TYPE;
110 stPacket.vData.emplace_back(1);
111 // Send telemetry over RoveComm to all subscribers.
112 if (network::g_pRoveCommUDPNode)
113 {
114 network::g_pRoveCommUDPNode->SendUDPPacket(stPacket, "0.0.0.0", constants::ROVECOMM_OUTGOING_UDP_PORT);
115 }
116 // Construct a RoveComm packet with the lighting data.
117 stPacket.unDataId = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_ID;
118 stPacket.unDataCount = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_COUNT;
119 stPacket.eDataType = manifest::Core::COMMANDS.find("STATEDISPLAY")->second.DATA_TYPE;
120 stPacket.vData.clear();
121 // Use RoveComm to send flashing GREEN color state value.
122 stPacket.vData.emplace_back(static_cast<uint8_t>(manifest::Core::DISPLAYSTATE::REACHED_GOAL));
123 break;
124 }
125 default:
126 {
127 // Construct a RoveComm packet with the lighting data.
128 stPacket.unDataId = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_ID;
129 stPacket.unDataCount = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_COUNT;
130 stPacket.eDataType = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_TYPE;
131 // Send lighting state over RoveComm.
132 stPacket.vData.emplace_back(0);
133 stPacket.vData.emplace_back(0);
134 stPacket.vData.emplace_back(0);
135 break;
136 }
137 }
138
139 // Check if we should send packets to the SIM or board.
140 const char* cIPAddress = constants::MODE_SIM ? constants::SIM_IP_ADDRESS.c_str() : manifest::Core::IP_ADDRESS.IP_STR.c_str();
141 // Send multimedia board lighting state to board over RoveComm.
142 if (network::g_pRoveCommUDPNode)
143 {
144 network::g_pRoveCommUDPNode->SendUDPPacket(stPacket, cIPAddress, constants::ROVECOMM_OUTGOING_UDP_PORT);
145 }
146}
void SendRGB(RGB stRGBVal)
Send a custom RGB value to the board.
Definition MultimediaBoard.cpp:156
::uint8_t uint8_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendRGB()

void MultimediaBoard::SendRGB ( RGB  stRGBVal)

Send a custom RGB value to the board.

Parameters
stRGBVal- RGB struct containing color information.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-23
157{
158 // Update custom RGB values.
159 m_stCustomRGBValues = stRGBVal;
160 // Update internal lighting state.
161 m_eCurrentLightingState = MultimediaBoardLightingState::eCustom;
162
163 // Construct a RoveComm packet with the lighting data.
164 rovecomm::RoveCommPacket<uint8_t> stPacket;
165 stPacket.unDataId = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_ID;
166 stPacket.unDataCount = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_COUNT;
167 stPacket.eDataType = manifest::Core::COMMANDS.find("LEDRGB")->second.DATA_TYPE;
168 stPacket.vData.emplace_back(stRGBVal.dRed);
169 stPacket.vData.emplace_back(stRGBVal.dGreen);
170 stPacket.vData.emplace_back(stRGBVal.dBlue);
171 // Check if we should send packets to the SIM or board.
172 const char* cIPAddress = constants::MODE_SIM ? constants::SIM_IP_ADDRESS.c_str() : manifest::Core::IP_ADDRESS.IP_STR.c_str();
173 // Send RGB values to multimedia board over RoveComm.
174 if (network::g_pRoveCommUDPNode)
175 {
176 network::g_pRoveCommUDPNode->SendUDPPacket(stPacket, cIPAddress, constants::ROVECOMM_OUTGOING_UDP_PORT);
177 }
178}
Here is the caller graph for this function:

◆ GetCurrentLightingState()

MultimediaBoard::MultimediaBoardLightingState MultimediaBoard::GetCurrentLightingState ( ) const

Accessor for the current lighting state of the multimedia board.

Returns
MultimediaBoard::MultimediaBoardLightingState - An enumerator value representing the current lighting state of the board.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-03-03
190{
191 // Return the current lighting state.
192 return m_eCurrentLightingState;
193}

◆ GetCustomLightingValues()

MultimediaBoard::RGB MultimediaBoard::GetCustomLightingValues ( ) const

Accessor for the current custom lighting RGB values.

Returns
MultimediaBoard::RGB - The custom lighting values stored in an RGB struct.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-03-03
204{
205 // Return the currently stored custom lighting values.
206 return m_stCustomRGBValues;
207}

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