16#ifndef YASMIN_VIEWER__YASMIN_VIEWER_PUB_HPP
17#define YASMIN_VIEWER__YASMIN_VIEWER_PUB_HPP
24#include "rclcpp/rclcpp.hpp"
28#include "yasmin_msgs/msg/state.hpp"
29#include "yasmin_msgs/msg/state_machine.hpp"
30#include "yasmin_msgs/msg/transition.hpp"
49 std::shared_ptr<yasmin::StateMachine>
fsm);
58 std::shared_ptr<yasmin::StateMachine>
fsm);
67 std::vector<yasmin_msgs::msg::Transition>
79 void parse_state(std::string name, std::shared_ptr<yasmin::State> state,
80 std::map<std::string, std::string> transitions,
81 std::vector<yasmin_msgs::msg::State> &states_list,
95 rclcpp::Publisher<yasmin_msgs::msg::StateMachine>::SharedPtr
publisher;
97 rclcpp::TimerBase::SharedPtr
timer;
102 std::shared_ptr<yasmin::StateMachine>
fsm;
Publishes state machine data for visualization.
Definition yasmin_viewer_pub.hpp:38
std::string fsm_name
Name of the finite state machine.
Definition yasmin_viewer_pub.hpp:100
rclcpp::TimerBase::SharedPtr timer
Timer for periodic publishing.
Definition yasmin_viewer_pub.hpp:97
std::vector< yasmin_msgs::msg::Transition > parse_transitions(std::map< std::string, std::string > transitions)
Parses transitions from a map of transitions and returns a list of Transition messages.
Definition yasmin_viewer_pub.cpp:64
std::shared_ptr< yasmin::StateMachine > fsm
Shared pointer to the state machine.
Definition yasmin_viewer_pub.hpp:102
void publish_data()
Publishes the data of the finite state machine to the associated ROS topic.
Definition yasmin_viewer_pub.cpp:138
YasminViewerPub(const rclcpp::Node::SharedPtr &node, std::string fsm_name, std::shared_ptr< yasmin::StateMachine > fsm)
Constructs YasminViewerPub with a given ROS 2 node, state machine name, and state machine instance.
Definition yasmin_viewer_pub.cpp:38
rclcpp::Node::SharedPtr node_
Shared pointer to the ROS 2 node.
Definition yasmin_viewer_pub.hpp:93
void parse_state(std::string name, std::shared_ptr< yasmin::State > state, std::map< std::string, std::string > transitions, std::vector< yasmin_msgs::msg::State > &states_list, int parent)
Parses a state and its transitions to add it to the list of state messages.
Definition yasmin_viewer_pub.cpp:87
rclcpp::Publisher< yasmin_msgs::msg::StateMachine >::SharedPtr publisher
Publisher for StateMachine messages.
Definition yasmin_viewer_pub.hpp:95
Definition yasmin_viewer_pub.hpp:32