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::State Class Referenceabstract

The abstract state class. All states inherit from this class. More...

#include <State.hpp>

Inheritance diagram for statemachine::State:

Public Member Functions

 State (States eState)
 Construct a new State object.
 
virtual ~State ()=default
 Destroy the State object.
 
virtual States TriggerEvent (Event eEvent)=0
 Trigger an event in the state machine. Returns the next state.
 
virtual void Run ()=0
 Run the state machine. Returns the next state.
 
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

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

Private Attributes

States m_eState
 
std::string m_szStateName
 

Detailed Description

The abstract state class. All states inherit from this class.

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

Constructor & Destructor Documentation

◆ State()

statemachine::State::State ( States  eState)
inline

Construct a new State object.

Parameters
eState- The state to start in.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-18
151 {
152 // Set State
153 m_eState = eState;
154
155 // Set State Name
156 m_szStateName = StateToString(m_eState);
157
158 // Start the State
159 Start();
160 }
virtual void Start()
This method is called when the state is first started. It is used to initialize the state.
Definition State.hpp:129
std::string StateToString(States eState)
Converts a state object to a string.
Definition State.hpp:89
Here is the call graph for this function:

◆ ~State()

virtual statemachine::State::~State ( )
virtualdefault

Destroy the State object.

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

Member Function Documentation

◆ Start()

virtual void statemachine::State::Start ( )
inlineprotectedvirtual

◆ Exit()

◆ TriggerEvent()

virtual States statemachine::State::TriggerEvent ( Event  eEvent)
pure virtual

◆ Run()

◆ GetState()

States statemachine::State::GetState ( ) const
inline

Accessor for the State private member.

Returns
States - The current state.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
197{ return m_eState; }

◆ ToString()

virtual std::string statemachine::State::ToString ( ) const
inlinevirtual

Accessor for the State private member. Returns the state as a string.

Returns
std::string - The current state as a string.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
207{ return m_szStateName; }
Here is the caller graph for this function:

◆ operator==()

virtual bool statemachine::State::operator== ( const State other) const
inlinevirtual

Checks to see if the current state is equal to the passed state.

Parameters
other- The state to compare to.
Returns
true - The states are equal.
false - The states are not equal.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
219{ return ToString() == other.ToString(); }
virtual std::string ToString() const
Accessor for the State private member. Returns the state as a string.
Definition State.hpp:207
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

virtual bool statemachine::State::operator!= ( const State other) const
inlinevirtual

Checks to see if the current state is not equal to the passed state.

Parameters
other- The state to compare to.
Returns
true - The states are not equal.
false - The states are equal.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2024-01-17
231{ return !operator==(other); }
virtual bool operator==(const State &other) const
Checks to see if the current state is equal to the passed state.
Definition State.hpp:219
Here is the call graph for this function:

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