SMACC2
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
sm_pubsub_1::StState2 Struct Reference

#include <st_state_2.hpp>

Inheritance diagram for sm_pubsub_1::StState2:
Inheritance graph
Collaboration diagram for sm_pubsub_1::StState2:
Collaboration graph

Classes

struct  NEXT
 
struct  PREVIOUS
 
struct  TIMEOUT
 

Public Types

typedef mpl::list< Transition< EvKeyPressP< CbDefaultKeyboardBehavior, OrKeyboard >, StState1, PREVIOUS >, Transition< EvKeyPressN< CbDefaultKeyboardBehavior, OrKeyboard >, StState3, NEXT >, Transition< EvMyBehavior< CbMySubscriberBehavior, OrSubscriber >, StState3, NEXT >, Transition< EvTrue< EgConditionalGenerator, StState2 >, StState3, NEXT > > reactions
 
- Public Types inherited from smacc2::SmaccState< StState2, MsRun >
typedef MsRun TContext
 
typedef Context::inner_context_type context_type
 
typedef context_type::state_iterator state_iterator
 
typedef mpl::list<> LastDeepState
 
typedef base_type::outermost_context_base_type outermost_context_base_type
 
typedef base_type::inner_context_ptr_type inner_context_ptr_type
 
typedef base_type::context_ptr_type context_ptr_type
 
typedef base_type::inner_initial_list inner_initial_list
 

Public Member Functions

void runtimeConfigure ()
 
bool eventGeneratorPredicate (ISmaccState *st)
 
void update () override
 
void onEntry ()
 
void onExit ()
 
- Public Member Functions inherited from smacc2::SmaccState< StState2, MsRun >
 SmaccState ()=delete
 
 SmaccState (my_context ctx)
 
virtual ~SmaccState ()
 
const smacc2::introspection::SmaccStateInfogetStateInfo ()
 
std::string getName () override
 
std::string getFullName ()
 
std::string getShortName ()
 
virtual ISmaccStategetParentState ()
 
void exit ()
 
void runtimeConfigure ()
 
void onEntry ()
 
void onExit ()
 
bool getGlobalSMData (std::string name, T &ret)
 
void setGlobalSMData (std::string name, T value)
 
void requiresComponent (SmaccComponentType *&storage)
 
virtual ISmaccStateMachinegetStateMachine ()
 
void checkWhileLoopConditionAndThrowEvent (bool(MostDerived::*conditionFn)())
 
void throwSequenceFinishedEvent ()
 
- Public Member Functions inherited from smacc2::ISmaccState
virtual ISmaccStateMachinegetStateMachine ()=0
 
virtual std::string getName ()=0
 
ISmaccStategetParentState ()
 
rclcpp::Node::SharedPtr & getNode ()
 
rclcpp::Logger getLogger ()
 
virtual std::string getClassName ()
 
template<typename TOrthogonal , typename TBehavior , typename... Args>
std::shared_ptr< TBehavior > configure (Args &&... args)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename T >
bool getGlobalSMData (std::string name, T &ret)
 
template<typename T >
void setGlobalSMData (std::string name, T value)
 
template<typename TStateReactor , typename TTriggerEvent , typename TEventList , typename... TEvArgs>
std::shared_ptr< TStateReactor > createStateReactor (TEvArgs... args)
 
template<typename TStateReactor , typename... TEvArgs>
std::shared_ptr< TStateReactor > createStateReactor (TEvArgs... args)
 
template<typename TEventGenerator , typename... TEvArgs>
std::shared_ptr< TEventGenerator > createEventGenerator (TEvArgs... args)
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TransitionType >
void notifyTransition ()
 
void notifyTransitionFromTransitionTypeInfo (std::shared_ptr< smacc2::introspection::TypeInfo > &transitionTypeInfo)
 
std::vector< std::shared_ptr< StateReactor > > & getStateReactors ()
 
std::vector< std::shared_ptr< SmaccEventGenerator > > & getEventGenerators ()
 
template<typename TOrthogonal >
TOrthogonal * getOrthogonal ()
 
template<typename TEventGenerator >
TEventGenerator * getEventGenerator ()
 
template<typename TStateReactor >
TStateReactor * getStateReactor ()
 
- Public Member Functions inherited from smacc2::ISmaccUpdatable
 ISmaccUpdatable ()
 
 ISmaccUpdatable (rclcpp::Duration duration)
 
void executeUpdate (rclcpp::Node::SharedPtr node)
 
void setUpdatePeriod (rclcpp::Duration duration)
 

Static Public Member Functions

static void staticConfigure ()
 
- Static Public Member Functions inherited from smacc2::SmaccState< StState2, MsRun >
static void configure_orthogonal_runtime (std::function< void(TBehavior &bh, StState2 &)> initializationFunction)
 
static void configure_orthogonal_runtime (std::function< void(TBehavior &bh)> initializationFunction)
 
static void configure_orthogonal (Args &&... args)
 
static std::shared_ptr< smacc2::introspection::StateReactorHandlerstatic_createStateReactor (TArgs... args)
 
static std::shared_ptr< smacc2::introspection::EventGeneratorHandlerstatic_createEventGenerator (TUArgs... args)
 
static std::shared_ptr< smacc2::introspection::StateReactorHandlerstatic_createStateReactor_aux (TUArgs... args)
 
static void initial_deep_construct (outermost_context_base_type &outermostContextBase)
 
static void deep_construct (const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
 
static inner_context_ptr_type shallow_construct (const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
 

Static Public Attributes

static int k = 0
 

Additional Inherited Members

- Public Attributes inherited from smacc2::SmaccState< StState2, MsRun >
bool finishStateThrown
 
mpl::list<> * smacc_inner_type
 
virtual void update ()=0
 
- Protected Attributes inherited from smacc2::ISmaccState
rclcpp::Node::SharedPtr node_
 
std::shared_ptr< rclcpp::Logger > logger_
 
std::vector< std::shared_ptr< StateReactor > > stateReactors_
 
std::vector< std::shared_ptr< smacc2::SmaccEventGenerator > > eventGenerators_
 
ISmaccStateparentState_
 
const smacc2::introspection::SmaccStateInfostateInfo_
 

Detailed Description

Definition at line 20 of file st_state_2.hpp.

Member Typedef Documentation

◆ reactions

typedef mpl::list< Transition<EvKeyPressP<CbDefaultKeyboardBehavior, OrKeyboard>, StState1, PREVIOUS>, Transition<EvKeyPressN<CbDefaultKeyboardBehavior, OrKeyboard>, StState3, NEXT>, Transition<EvMyBehavior<CbMySubscriberBehavior, OrSubscriber>, StState3, NEXT>, Transition<EvTrue<EgConditionalGenerator, StState2>, StState3, NEXT> > sm_pubsub_1::StState2::reactions

Definition at line 40 of file st_state_2.hpp.

Member Function Documentation

◆ eventGeneratorPredicate()

bool sm_pubsub_1::StState2::eventGeneratorPredicate ( ISmaccState *  st)
inline

Definition at line 71 of file st_state_2.hpp.

72 {
73 auto res = k > 300;
74 RCLCPP_INFO(st->getLogger(), "[State2] checking k: %d > 300 == %d", k, res);
75 rclcpp::sleep_for(10ms);
76 // rclcpp::Duration(10ms).sleep();
77 return res;
78 }

References k.

Referenced by runtimeConfigure().

Here is the caller graph for this function:

◆ onEntry()

void sm_pubsub_1::StState2::onEntry ( )
inline

Definition at line 86 of file st_state_2.hpp.

86{ RCLCPP_INFO(getLogger(), "On Entry!"); }
rclcpp::Logger getLogger()
Definition: smacc_state.hpp:36

References smacc2::ISmaccState::getLogger().

Here is the call graph for this function:

◆ onExit()

void sm_pubsub_1::StState2::onExit ( )
inline

Definition at line 88 of file st_state_2.hpp.

88{ RCLCPP_INFO(getLogger(), "On Exit!"); }

References smacc2::ISmaccState::getLogger().

Here is the call graph for this function:

◆ runtimeConfigure()

void sm_pubsub_1::StState2::runtimeConfigure ( )
inline

Definition at line 63 of file st_state_2.hpp.

64 {
65 k = 0;
66
67 auto eg = this->getEventGenerator<EgConditionalGenerator>();
68 eg->setPredicateFunction([=] { return this->eventGeneratorPredicate(this); });
69 }
bool eventGeneratorPredicate(ISmaccState *st)
Definition: st_state_2.hpp:71

References eventGeneratorPredicate(), and k.

Here is the call graph for this function:

◆ staticConfigure()

static void sm_pubsub_1::StState2::staticConfigure ( )
inlinestatic

Definition at line 45 of file st_state_2.hpp.

46 {
47 // configure_orthogonal<OrTimer, CbTimerCountdownOnce>(10);
48 // configure_orthogonal<OrSubscriber, CbWatchdogSubscriberBehavior>();
49 configure_orthogonal<OrSubscriber, CbMySubscriberBehavior>();
50 // configure_orthogonal<OrUpdatablePublisher, CbDefaultPublishLoop>();
51 configure_orthogonal<OrKeyboard, CbDefaultKeyboardBehavior>();
52
53 // Create State Reactor
54 // auto sbAll = static_createStateReactor<SrAllEventsGo>();
55 // sbAll->addInputEvent<EvKeyPressA<CbDefaultKeyboardBehavior, OrKeyboard>>();
56 // sbAll->addInputEvent<EvKeyPressB<CbDefaultKeyboardBehavior, OrKeyboard>>();
57 // sbAll->addInputEvent<EvKeyPressC<CbDefaultKeyboardBehavior, OrKeyboard>>();
58 // sbAll->setOutputEvent<EvAllGo<SrAllEventsGo>>();
59
60 static_createEventGenerator<EgConditionalGenerator>(ConditionalGeneratorMode::ON_UPDATE);
61 }

◆ update()

void sm_pubsub_1::StState2::update ( )
inlineoverridevirtual

Implements smacc2::ISmaccUpdatable.

Definition at line 80 of file st_state_2.hpp.

81 {
82 k++;
83 RCLCPP_INFO(getLogger(), "[State2] internally updating k: %d", k);
84 }

References smacc2::ISmaccState::getLogger(), and k.

Here is the call graph for this function:

Member Data Documentation

◆ k

int sm_pubsub_1::StState2::k = 0
static

Definition at line 42 of file st_state_2.hpp.

Referenced by eventGeneratorPredicate(), runtimeConfigure(), and update().


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