A.R.G.U.S 2.1.0
Adaptive Real-Time Guardian for Unsafe Situations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GuardianStateMachine Class Reference

Event-driven safety state machine with callback hooks. More...

#include <GuardianStateMachine.hpp>

Public Member Functions

 GuardianStateMachine (int fc=30, int rc=3)
 Construct the FSM with frame-count hysteresis thresholds.
 
void processEvent (GuardianEvent event)
 Process an explicit FSM event.
 
void processFrame (FrameStatus status)
 Convenience wrapper that maps frame status to an FSM event.
 
void operatorAcknowledge ()
 Inject an operator acknowledge event.
 
void setOnFreezeCallback (std::function< void()> callback)
 Register callback fired when freeze is commanded.
 
void setOnClearFreezeCallback (std::function< void()> callback)
 Register callback fired when freeze is cleared.
 
void setOnStateChangeCallback (std::function< void(GuardianState, GuardianState)> callback)
 Register callback fired on state transitions.
 
GuardianState getState () const
 Get current FSM state.
 
bool isMotionBlocked () const
 True when guardian currently blocks motion.
 
bool isMotionAllowed () const
 True when motion is currently allowed.
 
int getBadCount () const
 Get current consecutive bad-frame count.
 
int getGoodCount () const
 Get current consecutive good-frame count.
 
std::string stateToString (GuardianState state) const
 Convert a state enum to a readable string.
 
std::string getCurrentStateString () const
 Return readable string for current state.
 
void printStatus () const
 Print a status snapshot for debugging.
 

Detailed Description

Integration model:

Definition at line 63 of file GuardianStateMachine.hpp.

Constructor & Destructor Documentation

◆ GuardianStateMachine()

GuardianStateMachine::GuardianStateMachine ( int  fc = 30,
int  rc = 3 
)
Parameters
fcConsecutive bad frames required to freeze.
rcConsecutive good frames required to clear after ack.

Definition at line 24 of file GuardianStateMachine.cpp.

Member Function Documentation

◆ getBadCount()

int GuardianStateMachine::getBadCount ( ) const

Definition at line 314 of file GuardianStateMachine.cpp.

◆ getCurrentStateString()

std::string GuardianStateMachine::getCurrentStateString ( ) const

Definition at line 343 of file GuardianStateMachine.cpp.

References stateToString().

Referenced by printStatus().

◆ getGoodCount()

int GuardianStateMachine::getGoodCount ( ) const

Definition at line 318 of file GuardianStateMachine.cpp.

◆ getState()

GuardianState GuardianStateMachine::getState ( ) const

Definition at line 302 of file GuardianStateMachine.cpp.

◆ isMotionAllowed()

bool GuardianStateMachine::isMotionAllowed ( ) const

Definition at line 310 of file GuardianStateMachine.cpp.

◆ isMotionBlocked()

bool GuardianStateMachine::isMotionBlocked ( ) const

Definition at line 306 of file GuardianStateMachine.cpp.

◆ operatorAcknowledge()

void GuardianStateMachine::operatorAcknowledge ( )

Definition at line 272 of file GuardianStateMachine.cpp.

References OPERATOR_ACK, and processEvent().

Referenced by AppController::runGuardianScenarioDemo().

◆ printStatus()

void GuardianStateMachine::printStatus ( ) const

Definition at line 354 of file GuardianStateMachine.cpp.

References getCurrentStateString().

Referenced by AppController::runGuardianScenarioDemo().

◆ processEvent()

void GuardianStateMachine::processEvent ( GuardianEvent  event)

◆ processFrame()

void GuardianStateMachine::processFrame ( FrameStatus  status)

Definition at line 255 of file GuardianStateMachine.cpp.

References FRAME_BAD, FRAME_GOOD, and processEvent().

Referenced by AppController::runGuardianScenarioDemo().

◆ setOnClearFreezeCallback()

void GuardianStateMachine::setOnClearFreezeCallback ( std::function< void()>  callback)

Definition at line 288 of file GuardianStateMachine.cpp.

Referenced by AppController::runGuardianScenarioDemo().

◆ setOnFreezeCallback()

void GuardianStateMachine::setOnFreezeCallback ( std::function< void()>  callback)

Definition at line 284 of file GuardianStateMachine.cpp.

Referenced by AppController::runGuardianScenarioDemo().

◆ setOnStateChangeCallback()

void GuardianStateMachine::setOnStateChangeCallback ( std::function< void(GuardianState, GuardianState)>  callback)

Definition at line 292 of file GuardianStateMachine.cpp.

Referenced by AppController::runGuardianScenarioDemo().

◆ stateToString()

std::string GuardianStateMachine::stateToString ( GuardianState  state) const

Definition at line 329 of file GuardianStateMachine.cpp.

References FROZEN_UNSAFE, RESET_PENDING, and SAFE_MONITORING.

Referenced by getCurrentStateString().


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