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
statemachine::VerifyingMarkerState Class Reference

The VerifyingMarkerState class implements the Verifying Marker state for the Autonomy State Machine. More...

#include <VerifyingMarkerState.h>

Inheritance diagram for statemachine::VerifyingMarkerState:
Collaboration diagram for statemachine::VerifyingMarkerState:

Public Member Functions

 VerifyingMarkerState ()
 Construct a new State object.
 
void Run () override
 Run the state machine. Returns the next state.
 
States TriggerEvent (Event eEvent) override
 Trigger an event in the state machine. Returns the next state.
 
- Public Member Functions inherited from statemachine::State
 State (States eState)
 Construct a new State object.
 
virtual ~State ()=default
 Destroy the State object.
 
States GetState () const
 Accessor for the State private member.
 
virtual std::string ToString () const
 Accessor for the State private member. Returns the state as a string.
 
virtual bool operator== (const State &other) const
 Checks to see if the current state is equal to the passed state.
 
virtual bool operator!= (const State &other) const
 Checks to see if the current state is not equal to the passed state.
 

Protected Member Functions

void Start () override
 This method is called when the state is first started. It is used to initialize the state.
 
void Exit () override
 This method is called when the state is exited. It is used to clean up the state.
 

Private Attributes

std::vector< int > m_vMarkerIDs
 
int m_nMaxMarkerIDs
 
bool m_bInitialized
 

Detailed Description

The VerifyingMarkerState class implements the Verifying Marker state for the Autonomy State Machine.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17

Constructor & Destructor Documentation

◆ VerifyingMarkerState()

statemachine::VerifyingMarkerState::VerifyingMarkerState ( )

Construct a new State object.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
64 : State(States::eVerifyingMarker)
65 {
66 LOG_INFO(logging::g_qConsoleLogger, "Entering State: {}", ToString());
67
68 m_bInitialized = false;
69
70 if (!m_bInitialized)
71 {
72 Start();
73 m_bInitialized = true;
74 }
75 }
virtual std::string ToString() const
Accessor for the State private member. Returns the state as a string.
Definition State.hpp:207
State(States eState)
Construct a new State object.
Definition State.hpp:150
void Start() override
This method is called when the state is first started. It is used to initialize the state.
Definition VerifyingMarkerState.cpp:31
Here is the call graph for this function:

Member Function Documentation

◆ Start()

void statemachine::VerifyingMarkerState::Start ( )
overrideprotectedvirtual

This method is called when the state is first started. It is used to initialize the state.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17

Reimplemented from statemachine::State.

32 {
33 // Schedule the next run of the state's logic
34 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Scheduling next run of state logic.");
35
36 m_nMaxMarkerIDs = 50;
37
38 m_vMarkerIDs.reserve(m_nMaxMarkerIDs);
39 }
Here is the caller graph for this function:

◆ Exit()

void statemachine::VerifyingMarkerState::Exit ( )
overrideprotectedvirtual

This method is called when the state is exited. It is used to clean up the state.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17

Reimplemented from statemachine::State.

50 {
51 // Clean up the state before exiting
52 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Exiting state.");
53
54 m_vMarkerIDs.clear();
55 }
Here is the caller graph for this function:

◆ Run()

void statemachine::VerifyingMarkerState::Run ( )
overridevirtual

Run the state machine. Returns the next state.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17

Implements statemachine::State.

84 {
85 // TODO: Implement the behavior specific to the VerifyingMarker state
86 LOG_DEBUG(logging::g_qSharedLogger, "VerifyingMarkerState: Running state-specific behavior.");
87 }

◆ TriggerEvent()

States statemachine::VerifyingMarkerState::TriggerEvent ( Event  eEvent)
overridevirtual

Trigger an event in the state machine. Returns the next state.

Parameters
eEvent- The event to trigger.
Returns
std::shared_ptr<State> - The next state.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17

Implements statemachine::State.

99 {
100 // Create instance variables.
101 States eNextState = States::eVerifyingMarker;
102 bool bCompleteStateExit = true;
103
104 switch (eEvent)
105 {
106 case Event::eStart:
107 {
108 // Submit logger message.
109 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Handling Start event.");
110 // Send multimedia command to update state display.
111 globals::g_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eAutonomy);
112 break;
113 }
114 case Event::eVerifyingComplete:
115 {
116 // Submit logger message.
117 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Handling Verifying Complete event.");
118 // Send multimedia command to update state display.
119 globals::g_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eReachedGoal);
120 // Pop old waypoint out of queue.
121 globals::g_pWaypointHandler->PopNextWaypoint();
122 // Change state.
123 eNextState = States::eIdle;
124 break;
125 }
126 case Event::eAbort:
127 {
128 // Submit logger message.
129 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Handling Abort event.");
130 // Send multimedia command to update state display.
131 globals::g_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eAutonomy);
132 // Change state.
133 eNextState = States::eIdle;
134 break;
135 }
136 default:
137 {
138 LOG_WARNING(logging::g_qSharedLogger, "VerifyingMarkerState: Handling unknown event.");
139 eNextState = States::eIdle;
140 break;
141 }
142 }
143
144 if (eNextState != States::eVerifyingMarker)
145 {
146 LOG_INFO(logging::g_qSharedLogger, "VerifyingMarkerState: Transitioning to {} State.", StateToString(eNextState));
147
148 // Exit the current state
149 if (bCompleteStateExit)
150 {
151 Exit();
152 }
153 }
154
155 return eNextState;
156 }
void SendLightingState(MultimediaBoardLightingState eState)
Sends a predetermined color pattern to board.
Definition MultimediaBoard.cpp:55
geoops::Waypoint PopNextWaypoint()
Removes and returns the next waypoint at the front of the list.
Definition WaypointHandler.cpp:499
void Exit() override
This method is called when the state is exited. It is used to clean up the state.
Definition VerifyingMarkerState.cpp:49
std::string StateToString(States eState)
Converts a state object to a string.
Definition State.hpp:89
States
The states that the state machine can be in.
Definition State.hpp:31
Here is the call graph for this function:

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