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::SearchPatternState Class Reference

The SearchPatternState class implements the Search Pattern state for the Autonomy State Machine. More...

#include <SearchPatternState.h>

Inheritance diagram for statemachine::SearchPatternState:
Collaboration diagram for statemachine::SearchPatternState:

Public Member Functions

 SearchPatternState ()
 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 Types

enum class  SearchPatternType { eSpiral , eSnake , eZigZag , END }
 

Private Attributes

bool m_bInitialized
 
geoops::Waypoint m_stSearchPatternCenter
 
std::vector< std::shared_ptr< TagDetector > > m_vTagDetectors
 
std::vector< std::shared_ptr< ObjectDetector > > m_vObjectDetectors
 
std::vector< geoops::Waypointm_vSearchPath
 
int m_nSearchPathIdx
 
SearchPatternType m_eCurrentSearchPatternType
 
statemachine::TimeIntervalBasedStuckDetector m_StuckDetector
 
std::unique_ptr< logging::graphing::PathTracerm_pRoverPathPlot
 

Detailed Description

The SearchPatternState class implements the Search Pattern state for the Autonomy State Machine.

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

Member Enumeration Documentation

◆ SearchPatternType

enum class statemachine::SearchPatternState::SearchPatternType
strongprivate
51 {
52 eSpiral,
53 eSnake,
54 eZigZag,
55 END
56 };

Constructor & Destructor Documentation

◆ SearchPatternState()

statemachine::SearchPatternState::SearchPatternState ( )

Construct a new State object.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
93 : State(States::eSearchPattern)
94 {
95 // Submit logger message.
96 LOG_INFO(logging::g_qConsoleLogger, "Entering State: {}", ToString());
97
98 // Initialize member variables.
99 m_bInitialized = false;
100 m_StuckDetector = statemachine::TimeIntervalBasedStuckDetector(constants::STUCK_CHECK_ATTEMPTS,
101 constants::STUCK_CHECK_INTERVAL,
102 constants::STUCK_CHECK_VEL_THRESH,
103 constants::STUCK_CHECK_ROT_THRESH);
104 m_pRoverPathPlot = std::make_unique<logging::graphing::PathTracer>("SearchPatternRoverPath");
105
106 // Start state.
107 if (!m_bInitialized)
108 {
109 Start();
110 m_bInitialized = true;
111 }
112 }
void Start() override
This method is called when the state is first started. It is used to initialize the state.
Definition SearchPatternState.cpp:35
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
This class should be instantiated within another state to be used for detection of if the rover is st...
Definition StuckDetection.hpp:43
Here is the call graph for this function:

Member Function Documentation

◆ Start()

void statemachine::SearchPatternState::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.

36 {
37 // Schedule the next run of the state's logic
38 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Scheduling next run of state logic.");
39
40 // Initialize member variables.
41 m_eCurrentSearchPatternType = SearchPatternType::eSpiral;
42 m_nSearchPathIdx = 0;
43 m_stSearchPatternCenter = globals::g_pWaypointHandler->PeekNextWaypoint();
44
45 // Get the current rover pose.
46 geoops::RoverPose stCurrentRoverPose = globals::g_pWaypointHandler->SmartRetrieveRoverPose();
47
48 // Calculate the search path.
49 m_vSearchPath = searchpattern::CalculateSpiralPatternWaypoints(m_stSearchPatternCenter.GetGPSCoordinate(),
50 constants::SEARCH_ANGULAR_STEP_DEGREES,
51 m_stSearchPatternCenter.dRadius,
52 stCurrentRoverPose.GetCompassHeading(),
53 constants::SEARCH_SPIRAL_SPACING);
54
55 // Add the search and rover path layers to the plot.
56 m_pRoverPathPlot->CreatePathLayer("SpiralSearchPattern", "-o");
57 m_pRoverPathPlot->CreateDotLayer("SnakeSearchPattern", "-g");
58 m_pRoverPathPlot->CreateDotLayer("VerticalZigZagSearchPattern", "yellow");
59 m_pRoverPathPlot->CreateDotLayer("DetectedTags", "blue");
60 m_pRoverPathPlot->CreateDotLayer("DetectedObjects", "purple");
61 m_pRoverPathPlot->CreatePathLayer("RoverPath", "-.r*");
62 // Plot the search path on the rover path.
63 m_pRoverPathPlot->AddPathPoints(m_vSearchPath, "SpiralSearchPattern", 0);
64
65 m_vTagDetectors = {globals::g_pTagDetectionHandler->GetTagDetector(TagDetectionHandler::TagDetectors::eHeadMainCam)};
66 m_vObjectDetectors = {globals::g_pObjectDetectionHandler->GetObjectDetector(ObjectDetectionHandler::ObjectDetectors::eHeadMainCam)};
67 }
std::shared_ptr< ObjectDetector > GetObjectDetector(ObjectDetectors eDetectorName)
Accessor for ObjectDetector detectors.
Definition ObjectDetectionHandler.cpp:127
std::shared_ptr< TagDetector > GetTagDetector(TagDetectors eDetectorName)
Accessor for TagDetector detectors.
Definition TagDetectionHandler.cpp:132
const geoops::Waypoint PeekNextWaypoint()
Returns an immutable reference to the geoops::Waypoint struct at the front of the list without removi...
Definition WaypointHandler.cpp:540
geoops::RoverPose SmartRetrieveRoverPose(bool bVIOHeading=true, bool bVIOTracking=false)
Retrieve the rover's current position and heading. Automatically picks between getting the position/h...
Definition WaypointHandler.cpp:742
std::vector< geoops::Waypoint > CalculateSpiralPatternWaypoints(const geoops::Waypoint &stStartingPoint, const double dAngularStepDegrees=57, const double dMaxRadius=25, const double dStartingHeadingDegrees=0, const double dStartSpacing=1)
Perform a spiral search pattern starting from a given point.
Definition SearchPattern.hpp:49
This struct is used by the WaypointHandler to provide an easy way to store all pose data about the ro...
Definition GeospatialOperations.hpp:677
double GetCompassHeading() const
Accessor for the Compass Heading private member.
Definition GeospatialOperations.hpp:756
const geoops::GPSCoordinate & GetGPSCoordinate() const
Accessor for the geoops::GPSCoordinate member variable.
Definition GeospatialOperations.hpp:466
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Exit()

void statemachine::SearchPatternState::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.

78 {
79 // Clean up the state before exiting
80 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Exiting state.");
81
82 // Stop drive.
83 globals::g_pDriveBoard->SendStop();
84 }
void SendStop()
Stop the drivetrain of the Rover.
Definition DriveBoard.cpp:163
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Run()

void statemachine::SearchPatternState::Run ( )
overridevirtual

Run the state machine. Returns the next state.

Author
Jason Pittman (jspen.nosp@m.cerp.nosp@m.ittma.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-01-17

Implements statemachine::State.

121 {
122 // Submit logger message.
123 LOG_DEBUG(logging::g_qSharedLogger, "SearchPatternState: Running state-specific behavior.");
124
125 // Get the current rover pose.
126 geoops::RoverPose stCurrentRoverPose = globals::g_pWaypointHandler->SmartRetrieveRoverPose();
127
128 // Add the current rover pose to the path plot.
129 m_pRoverPathPlot->AddPathPoint(stCurrentRoverPose.GetUTMCoordinate(), "RoverPath");
130
131 /*
132 The overall flow of this state is as follows.
133 1. Is there a tag -> MarkerSeen
134 2. Is there an object -> ObjectSeen
135 3. Is there an obstacle -> TBD
136 4. Is the rover stuck -> Stuck
137 5. Is the search pattern complete -> Abort
138 6. Follow the search pattern.
139 */
140
142 /* --- Detect Tags --- */
144
145 // In order to even care about any tags we see, the goal waypoint needs to be of type MARKER and we need to be within the search radius of the MARKER waypoint.
146 if (m_stSearchPatternCenter.eType == geoops::WaypointType::eTagWaypoint)
147 {
148 // Create instance variables.
149 tagdetectutils::ArucoTag stBestArucoTag, stBestTorchTag;
150 // Identify target marker.
151 statemachine::IdentifyTargetMarker(m_vTagDetectors, stBestArucoTag, stBestTorchTag, m_stSearchPatternCenter.nID);
152 // Check if either tag type is seen.
153 if (stBestArucoTag.nID != -1 || stBestTorchTag.dConfidence != 0.0)
154 {
155 // Submit logger message.
156 LOG_NOTICE(logging::g_qSharedLogger, "SearchPatternState: Rover has seen a target marker!");
157
158 // Check if the OpenCV tag has a good absolute position.
159 if (stBestArucoTag.nID != -1 && stBestArucoTag.stGeolocatedPosition.eType == geoops::WaypointType::eTagWaypoint)
160 {
161 // Add the tag to the path plot.
162 m_pRoverPathPlot->AddDot(stBestArucoTag.stGeolocatedPosition.GetUTMCoordinate(), "DetectedTags");
163 }
164 // Check if the torch tag has a good absolute position.
165 if (stBestTorchTag.dConfidence != 0.0 && stBestTorchTag.stGeolocatedPosition.eType == geoops::WaypointType::eTagWaypoint)
166 {
167 // Add the tag to the path plot.
168 m_pRoverPathPlot->AddDot(stBestTorchTag.stGeolocatedPosition.GetUTMCoordinate(), "DetectedTags");
169 }
170
171 // Handle state transition and save the current search pattern state.
172 globals::g_pStateMachineHandler->HandleEvent(Event::eMarkerSeen, true);
173 // Don't execute the rest of the state.
174 return;
175 }
176 }
177
179 /* --- Detect Objects --- */
181
182 // In order to even care about any tags we see, the goal waypoint needs to be of type MARKER and we need to be within the search radius of the MARKER waypoint.
183 if (m_stSearchPatternCenter.eType == geoops::WaypointType::eObjectWaypoint || m_stSearchPatternCenter.eType == geoops::WaypointType::eMalletWaypoint ||
184 m_stSearchPatternCenter.eType == geoops::WaypointType::eWaterBottleWaypoint)
185 {
186 // Create instance variables.
187 objectdetectutils::Object stBestTorchObject;
188 // Identify target object.
189 statemachine::IdentifyTargetObject(m_vObjectDetectors, stBestTorchObject, m_stSearchPatternCenter.eType);
190 // Check if either tag type is seen.
191 if (stBestTorchObject.dConfidence != 0.0)
192 {
193 // Submit logger message.
194 LOG_NOTICE(logging::g_qSharedLogger, "SearchPatternState: Rover has seen a target object!");
195
196 // Check if the torch tag has a good absolute position.
197 if (stBestTorchObject.dConfidence != 0.0 && stBestTorchObject.stGeolocatedPosition.eType == geoops::WaypointType::eObjectWaypoint)
198 {
199 // Add the tag to the path plot.
200 m_pRoverPathPlot->AddDot(stBestTorchObject.stGeolocatedPosition.GetUTMCoordinate(), "DetectedObjects");
201 }
202
203 // Handle state transition and save the current search pattern state.
204 globals::g_pStateMachineHandler->HandleEvent(Event::eObjectSeen, true);
205 // Don't execute the rest of the state.
206 return;
207 }
208 }
209
211 /* --- Detect Obstacles --- */
213
214 // TODO: Add obstacle detection to SearchPattern state
215
217 /* --- Check if the rover is stuck --- */
219
220 // Check if stuck.
221 if (constants::SEARCH_ENABLE_STUCK_DETECT &&
222 m_StuckDetector.CheckIfStuck(globals::g_pWaypointHandler->SmartRetrieveVelocity(), globals::g_pWaypointHandler->SmartRetrieveAngularVelocity()))
223 {
224 // Submit logger message.
225 LOG_WARNING(logging::g_qSharedLogger, "SearchPattern: Rover has become stuck!");
226 // Increment search path index so we skip the waypoint where we got stuck when reentering searchpattern.
227 m_nSearchPathIdx += 1;
228 // Check path index is within bounds.
229 if (m_nSearchPathIdx >= int(m_vSearchPath.size()))
230 {
231 m_nSearchPathIdx = m_vSearchPath.size() - 1;
232 }
233 // Handle state transition and save the current search pattern state.
234 globals::g_pStateMachineHandler->HandleEvent(Event::eStuck, true);
235 // Don't execute the rest of the state.
236 return;
237 }
238
240 /* --- Follow Search Pattern --- */
242
243 // Check if the search path is empty.
244 if (m_vSearchPath.empty())
245 {
246 // Submit logger message.
247 LOG_WARNING(logging::g_qSharedLogger, "SearchPatternState: Search path is empty, aborting search.");
248 // Handle state transition.
249 globals::g_pStateMachineHandler->HandleEvent(Event::eAbort);
250 return;
251 }
252
253 // Have we reached the current waypoint?
254 geoops::GPSCoordinate stCurrTargetGPS = m_vSearchPath[m_nSearchPathIdx].GetGPSCoordinate();
255 geoops::GeoMeasurement stCurrRelToTarget = geoops::CalculateGeoMeasurement(stCurrentRoverPose.GetGPSCoordinate(), stCurrTargetGPS);
256 bool bReachedTarget = stCurrRelToTarget.dDistanceMeters <= constants::SEARCH_WAYPOINT_PROXIMITY;
257
258 // If the entire search pattern has been completed without seeing tags or objects, try different search pattern.
259 if (bReachedTarget && m_nSearchPathIdx >= int(m_vSearchPath.size() - 1))
260 {
261 globals::g_pStateMachineHandler->HandleEvent(Event::eSearchFailed);
262 return;
263 }
264 // Move on to the next waypoint in the search path.
265 else if (bReachedTarget)
266 {
267 ++m_nSearchPathIdx;
268 stCurrTargetGPS = m_vSearchPath[m_nSearchPathIdx].GetGPSCoordinate();
269 stCurrRelToTarget = geoops::CalculateGeoMeasurement(stCurrentRoverPose.GetGPSCoordinate(), stCurrTargetGPS);
270 }
271
272 // Drive to target waypoint.
273 diffdrive::DrivePowers stDrivePowers = globals::g_pDriveBoard->CalculateMove(constants::SEARCH_MOTOR_POWER,
274 stCurrRelToTarget.dStartRelativeBearing,
275 stCurrentRoverPose.GetCompassHeading(),
276 diffdrive::DifferentialControlMethod::eArcadeDrive);
277
278 // Send drive powers over RoveComm.
279 globals::g_pDriveBoard->SendDrive(stDrivePowers);
280
281 return;
282 }
void SendDrive(const diffdrive::DrivePowers &stDrivePowers)
Sets the left and right drive powers of the drive board.
Definition DriveBoard.cpp:117
diffdrive::DrivePowers CalculateMove(const double dGoalSpeed, const double dGoalHeading, const double dActualHeading, const diffdrive::DifferentialControlMethod eKinematicsMethod=diffdrive::DifferentialControlMethod::eArcadeDrive, const bool bAlwaysProgressForward=false)
This method determines drive powers to make the Rover drive towards a given heading at a given speed.
Definition DriveBoard.cpp:87
void HandleEvent(statemachine::Event eEvent, const bool bSaveCurrentState=false)
This method Handles Events that are passed to the State Machine Handler. It will check the current st...
Definition StateMachineHandler.cpp:350
bool CheckIfStuck(double dCurrentVelocity, double dCurrentAngularVelocity)
Checks if the rover meets stuck criteria based in the given parameters.
Definition StuckDetection.hpp:105
GeoMeasurement CalculateGeoMeasurement(const GPSCoordinate &stCoord1, const GPSCoordinate &stCoord2)
The shortest path between two points on an ellipsoid at (lat1, lon1) and (lat2, lon2) is called the g...
Definition GeospatialOperations.hpp:522
int IdentifyTargetMarker(const std::vector< std::shared_ptr< TagDetector > > &vTagDetectors, tagdetectutils::ArucoTag &stArucoTarget, tagdetectutils::ArucoTag &stTorchTarget, const int nTargetTagID=static_cast< int >(manifest::Autonomy::AUTONOMYWAYPOINTTYPES::ANY))
Identify a target marker in the rover's vision, using OpenCV detection.
Definition TagDetectionChecker.hpp:91
int IdentifyTargetObject(const std::vector< std::shared_ptr< ObjectDetector > > &vObjectDetectors, objectdetectutils::Object &stObjectTarget, const geoops::WaypointType &eDesiredDetectionType=geoops::WaypointType::eUNKNOWN)
Identify a target object in the rover's vision, using Torch detection.
Definition ObjectDetectionChecker.hpp:90
This struct is used to store the left and right drive powers for the robot. Storing these values in a...
Definition DifferentialDrive.hpp:73
This struct stores/contains information about a GPS data.
Definition GeospatialOperations.hpp:99
This struct is used to store the distance, arc length, and relative bearing for a calculated geodesic...
Definition GeospatialOperations.hpp:82
const geoops::GPSCoordinate & GetGPSCoordinate() const
Accessor for the geoops::GPSCoordinate member variable.
Definition GeospatialOperations.hpp:725
const geoops::UTMCoordinate & GetUTMCoordinate() const
Accessor for the geoops::UTMCoordinate member variable.
Definition GeospatialOperations.hpp:736
const geoops::UTMCoordinate & GetUTMCoordinate() const
Accessor for the geoops::UTMCoordinate member variable.
Definition GeospatialOperations.hpp:477
Represents a single detected object. Combines attributes from TorchObject and TensorflowObject struct...
Definition ObjectDetectionUtility.hpp:73
Represents a single ArUco tag. Combines attributes from TorchTag, TensorflowTag, and the original Aru...
Definition TagDetectionUtilty.hpp:59
Here is the call graph for this function:

◆ TriggerEvent()

States statemachine::SearchPatternState::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.

294 {
295 // Create instance variables.
296 States eNextState = States::eSearchPattern;
297 bool bCompleteStateExit = true;
298
299 switch (eEvent)
300 {
301 case Event::eMarkerSeen:
302 {
303 // Submit logger message.
304 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Handling MarkerSeen event.");
305 // Change states.
306 eNextState = States::eApproachingMarker;
307 break;
308 }
309 case Event::eObjectSeen:
310 {
311 // Submit logger message.
312 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Handling ObjectSeen event.");
313 // Change state.
314 eNextState = States::eApproachingObject;
315 break;
316 }
317 case Event::eStart:
318 {
319 // Submit logger message
320 LOG_NOTICE(logging::g_qSharedLogger, "SearchPatternState: Handling Start event.");
321 // Send multimedia command to update state display.
322 globals::g_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eAutonomy);
323 break;
324 }
325 case Event::eSearchFailed:
326 {
327 // Submit logger message.
328 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Handling SearchFailed event.");
329 // Stop drive.
330 globals::g_pDriveBoard->SendStop();
331
332 // Regenerate a new search pattern.
333 switch (m_eCurrentSearchPatternType)
334 {
335 // Check which pattern to do next.
336 case SearchPatternType::eSpiral:
337 {
338 // Submit logger message.
339 LOG_NOTICE(logging::g_qSharedLogger, "SearchPatternState: Spiral search pattern failed, trying snake...");
340 // Generate vertical zigzag pattern.
341 m_vSearchPath = searchpattern::CalculateSnakeSearchPattern(m_stSearchPatternCenter.GetGPSCoordinate(),
342 m_stSearchPatternCenter.dRadius * 2,
343 m_stSearchPatternCenter.dRadius * 2,
344 constants::SEARCH_ZIGZAG_SPACING,
345 constants::SEARCH_SNAKE_SLITHERS);
346 // Reset index counter.
347 m_nSearchPathIdx = 0;
348 // Update current search pattern
349 m_eCurrentSearchPatternType = SearchPatternType::eSnake;
350
351 // Add the search and rover path layers to the plot.
352 m_pRoverPathPlot->AddDots(m_vSearchPath, "SnakeSearchPattern");
353 break;
354 }
355 case SearchPatternType::eSnake:
356 {
357 // Submit logger message.
358 LOG_NOTICE(logging::g_qSharedLogger, "SearchPatternState: Snake search pattern failed, trying ZigZag...");
359 // Generate vertical zigzag pattern.
360 m_vSearchPath = searchpattern::CalculateZigZagPatternWaypoints(m_stSearchPatternCenter.GetGPSCoordinate(),
361 m_stSearchPatternCenter.dRadius * 2,
362 m_stSearchPatternCenter.dRadius * 2,
363 constants::SEARCH_ZIGZAG_SPACING);
364 // Reset index counter.
365 m_nSearchPathIdx = 0;
366 // Update current search pattern
367 m_eCurrentSearchPatternType = SearchPatternType::END;
368
369 // Add the search and rover path layers to the plot.
370 m_pRoverPathPlot->AddDots(m_vSearchPath, "VerticalZigZagSearchPattern");
371 break;
372 }
373 case SearchPatternType::END:
374 {
375 // Submit logger message.
376 LOG_WARNING(logging::g_qSharedLogger, "SearchPatternState: All patterns failed to find anything, giving up...");
377 // Pop old waypoint out of queue.
378 globals::g_pWaypointHandler->PopNextWaypoint();
379 // Change states.
380 eNextState = States::eIdle;
381 break;
382 }
383 default:
384 {
385 // Change states.
386 eNextState = States::eIdle;
387 break;
388 }
389 }
390 break;
391 }
392 case Event::eAbort:
393 {
394 // Submit logger message.
395 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Handling Abort event.");
396 // Send multimedia command to update state display.
397 globals::g_pMultimediaBoard->SendLightingState(MultimediaBoard::MultimediaBoardLightingState::eOff);
398 // Stop drive.
399 globals::g_pDriveBoard->SendStop();
400 // Change state.
401 eNextState = States::eIdle;
402 break;
403 }
404 case Event::eStuck:
405 {
406 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Handling Stuck event.");
407 eNextState = States::eStuck;
408 break;
409 }
410 default:
411 {
412 LOG_WARNING(logging::g_qSharedLogger, "SearchPatternState: Handling unknown event.");
413 eNextState = States::eIdle;
414 break;
415 }
416 }
417
418 if (eNextState != States::eSearchPattern)
419 {
420 LOG_INFO(logging::g_qSharedLogger, "SearchPatternState: Transitioning to {} State.", StateToString(eNextState));
421
422 // Exit the current state
423 if (bCompleteStateExit)
424 {
425 Exit();
426 }
427 }
428
429 return eNextState;
430 }
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:500
void Exit() override
This method is called when the state is exited. It is used to clean up the state.
Definition SearchPatternState.cpp:77
std::vector< geoops::Waypoint > CalculateSnakeSearchPattern(const geoops::Waypoint &stStartCoord, const double dWidth=20.0, const double dHeight=20.0, const double dSpacing=1.0, const int nNumberOfSlithers=1.0, const bool bVertical=true)
Calculate waypoints for a snake search pattern.
Definition SearchPattern.hpp:286
std::vector< geoops::Waypoint > CalculateZigZagPatternWaypoints(const geoops::Waypoint &stCenterPoint, const double dWidth=20.0, const double dHeight=20.0, const double dSpacing=1.0, const bool bVertical=true)
Calculate waypoints for a zigzag pattern. This function generates waypoints for a zigzag pattern star...
Definition SearchPattern.hpp:124
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: