22#include <boost/any.hpp>
32#include <smacc2_msgs/msg/smacc_state_machine.hpp>
33#include <smacc2_msgs/msg/smacc_status.hpp>
34#include <smacc2_msgs/msg/smacc_transition_log_entry.hpp>
35#include <smacc2_msgs/srv/smacc_get_transition_history.hpp>
69 rclcpp::NodeOptions
nodeOptions = rclcpp::NodeOptions());
79 template <
typename TOrthogonal>
84 template <
typename TOrthogonal,
typename TClientBehavior>
92 const std::map<std::string, std::shared_ptr<smacc2::ISmaccOrthogonal>> &
getOrthogonals()
const;
94 template <
typename SmaccComponentType>
97 template <
typename EventType>
100 template <
typename EventType>
104 template <
typename T>
108 template <
typename T>
111 template <
typename StateField,
typename BehaviorType>
127 const std::shared_ptr<smacc2_msgs::srv::SmaccGetTransitionHistory::Request>
req,
128 std::shared_ptr<smacc2_msgs::srv::SmaccGetTransitionHistory::Response>
res);
130 template <
typename TSmaccSignal,
typename TMemberFunctionPrototype,
typename TSmaccObjectType>
136 template <
typename StateType>
139 template <
typename StateType>
142 template <
typename StateType>
145 template <
typename StateType>
148 template <
typename StateType>
151 template <
typename StateType>
160 template <
typename InitialStateType>
163 rclcpp::Node::SharedPtr
getNode();
176 template <
typename TOrthogonal>
180 rclcpp::Node::SharedPtr
nh_;
197 std::map<std::string, std::shared_ptr<smacc2::ISmaccOrthogonal>>
orthogonals_;
213 std::map<std::string, std::pair<std::function<std::string()>, boost::any>>
globalData_;
229 template <
typename EventType>
std::map< std::string, std::shared_ptr< smacc2::ISmaccOrthogonal > > orthogonals_
smacc2::SMRunMode runMode_
std::vector< ISmaccState * > currentState_
std::recursive_mutex eventQueueMutex_
virtual ~ISmaccStateMachine()
std::string getStateMachineName()
bool getGlobalSMData(std::string name, T &ret)
void publishTransition(const SmaccTransitionInfo &transitionInfo)
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
StateMachineInternalAction stateMachineCurrentAction
rclcpp::Publisher< smacc2_msgs::msg::SmaccStateMachine >::SharedPtr stateMachinePub_
std::shared_ptr< SmaccStateInfo > currentStateInfo_
TClientBehavior * getClientBehavior(int index=0)
rclcpp::Node::SharedPtr getNode()
std::map< std::string, std::pair< std::function< std::string()>, boost::any > > globalData_
void notifyOnStateExitting(StateType *state)
rclcpp::Service< smacc2_msgs::srv::SmaccGetTransitionHistory >::SharedPtr transitionHistoryService_
void setGlobalSMData(std::string name, T value)
virtual void onInitialize()
this function should be implemented by the user to create the orthogonals
TOrthogonal * getOrthogonal()
std::vector< smacc2_msgs::msg::SmaccTransitionLogEntry > transitionLogHistory_
void buildStateMachineInfo()
void notifyOnRuntimeConfigurationFinished(StateType *state)
const std::map< std::string, std::shared_ptr< smacc2::ISmaccOrthogonal > > & getOrthogonals() const
std::recursive_mutex m_mutex_
rclcpp::Publisher< smacc2_msgs::msg::SmaccStatus >::SharedPtr stateMachineStatusPub_
void notifyOnStateExited(StateType *state)
void lockStateMachine(std::string msg)
void notifyOnStateEntryEnd(StateType *state)
void propagateEventToStateReactors(ISmaccState *st, EventType *ev)
void disconnectSmaccSignalObject(void *object)
const SmaccStateMachineInfo & getStateMachineInfo()
rclcpp::Node::SharedPtr nh_
std::shared_ptr< SmaccStateInfo > getCurrentStateInfo()
void unlockStateMachine(std::string msg)
int64_t getCurrentStateCounter() const
rclcpp::TimerBase::SharedPtr timer_
rclcpp::Publisher< smacc2_msgs::msg::SmaccTransitionLogEntry >::SharedPtr transitionLogPub_
void requiresComponent(SmaccComponentType *&storage, bool throwsExceptionIfNotExist=false)
ISmaccState * getCurrentState() const
void checkStateMachineConsistence()
SignalDetector * signalDetector_
std::vector< boost::signals2::scoped_connection > longLivedSignalConnections_
std::map< void *, std::shared_ptr< CallbackCounterSemaphore > > stateCallbackConnections
rclcpp::Logger getLogger()
void notifyOnRuntimeConfigured(StateType *state)
void initializeROS(std::string smshortname)
smacc2_msgs::msg::SmaccStatus status_msg_
void state_machine_visualization()
std::shared_ptr< SmaccStateMachineInfo > stateMachineInfo_
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)
void updateStatusMessage()
std::recursive_mutex & getMutex()
void getTransitionLogHistory(const std::shared_ptr< rmw_request_id_t > request_header, const std::shared_ptr< smacc2_msgs::srv::SmaccGetTransitionHistory::Request > req, std::shared_ptr< smacc2_msgs::srv::SmaccGetTransitionHistory::Response > res)
void notifyOnStateEntryStart(StateType *state)
StateMachineInternalAction