ROS 2 node that receives state machine descriptions and exposes them for the web viewer.
More...
#include <yasmin_viewer_node.hpp>
|
| struct | CachedFsm |
| | Stores a serialized finite state machine and its last update time. More...
|
|
| void | fsm_viewer_cb (const StateMachineMsg::SharedPtr msg) |
| | Callback for incoming state machine messages.
|
| void | start_server () |
| | Starts the embedded web server thread.
|
| void | stop_server () |
| | Stops the embedded web server thread.
|
| void | run_server () |
| | Runs the embedded web server loop.
|
| void | prune_expired_locked (const std::chrono::steady_clock::time_point &now) const |
| | Removes expired finite state machines from the cache.
|
|
| std::mutex | fsms_mutex_ |
| | Mutex protecting access to the finite state machine cache.
|
| std::unordered_map< std::string, CachedFsm > | fsms_ |
| | Cache of serialized finite state machines indexed by name.
|
| rclcpp::Subscription< StateMachineMsg >::SharedPtr | fsm_sub_ |
| | Subscription for incoming state machine descriptions.
|
| std::string | host_ |
| | Host address used by the embedded web server.
|
| std::string | web_root_ |
| | Root directory containing the web viewer files.
|
| int64_t | port_ |
| | Port used by the embedded web server.
|
| double | max_age_seconds_ |
| | Maximum cache age in seconds before a finite state machine is removed.
|
| std::atomic_bool | server_running_ |
| | Indicates whether the embedded web server is running.
|
| std::thread | server_thread_ |
| | Background thread executing the embedded web server.
|
ROS 2 node that receives state machine descriptions and exposes them for the web viewer.
◆ StateMachineMsg
◆ StateMsg
◆ TransitionMsg
◆ YasminViewerNode() [1/2]
| yasmin_viewer::YasminViewerNode::YasminViewerNode |
( |
| ) |
|
Constructs the YasminViewerNode and initializes subscriptions, parameters, and the web server.
◆ ~YasminViewerNode()
| yasmin_viewer::YasminViewerNode::~YasminViewerNode |
( |
| ) |
|
|
override |
◆ YasminViewerNode() [2/2]
| yasmin_viewer::YasminViewerNode::YasminViewerNode |
( |
const YasminViewerNode & | | ) |
|
|
delete |
◆ escape_json()
| std::string yasmin_viewer::YasminViewerNode::escape_json |
( |
const std::string & | value | ) |
|
|
staticprivate |
Escapes a string for safe JSON serialization.
- Parameters
-
- Returns
- Escaped JSON string.
◆ fsm_viewer_cb()
| void yasmin_viewer::YasminViewerNode::fsm_viewer_cb |
( |
const StateMachineMsg::SharedPtr | msg | ) |
|
|
private |
Callback for incoming state machine messages.
- Parameters
-
| msg | Received state machine message. |
◆ get_fsms_json()
| std::string yasmin_viewer::YasminViewerNode::get_fsms_json |
( |
| ) |
const |
Returns the cached finite state machines as a JSON string.
- Returns
- JSON representation of all cached finite state machines.
◆ get_web_root()
| std::string yasmin_viewer::YasminViewerNode::get_web_root |
( |
| ) |
const |
Returns the configured web root directory.
- Returns
- Path to the web root directory.
◆ operator=()
◆ prune_expired_locked()
| void yasmin_viewer::YasminViewerNode::prune_expired_locked |
( |
const std::chrono::steady_clock::time_point & | now | ) |
const |
|
private |
Removes expired finite state machines from the cache.
- Parameters
-
| now | Current time used for age comparison. |
◆ run_server()
| void yasmin_viewer::YasminViewerNode::run_server |
( |
| ) |
|
|
private |
Runs the embedded web server loop.
◆ start_server()
| void yasmin_viewer::YasminViewerNode::start_server |
( |
| ) |
|
|
private |
Starts the embedded web server thread.
◆ state_machine_to_json()
| std::string yasmin_viewer::YasminViewerNode::state_machine_to_json |
( |
const StateMachineMsg & | msg | ) |
|
|
staticprivate |
Serializes a full state machine message into JSON.
- Parameters
-
| msg | State machine message to serialize. |
- Returns
- JSON representation of the state machine.
◆ state_to_json()
| std::string yasmin_viewer::YasminViewerNode::state_to_json |
( |
const StateMsg & | state | ) |
|
|
staticprivate |
Serializes a state into JSON.
- Parameters
-
| state | State message to serialize. |
- Returns
- JSON representation of the state.
◆ stop_server()
| void yasmin_viewer::YasminViewerNode::stop_server |
( |
| ) |
|
|
private |
Stops the embedded web server thread.
◆ transitions_to_json()
| std::string yasmin_viewer::YasminViewerNode::transitions_to_json |
( |
const std::vector< TransitionMsg > & | transitions | ) |
|
|
staticprivate |
Serializes a list of transitions into JSON.
- Parameters
-
| transitions | List of transitions. |
- Returns
- JSON representation of the transitions.
◆ fsm_sub_
| rclcpp::Subscription<StateMachineMsg>::SharedPtr yasmin_viewer::YasminViewerNode::fsm_sub_ |
|
private |
Subscription for incoming state machine descriptions.
◆ fsms_
| std::unordered_map<std::string, CachedFsm> yasmin_viewer::YasminViewerNode::fsms_ |
|
mutableprivate |
Cache of serialized finite state machines indexed by name.
◆ fsms_mutex_
| std::mutex yasmin_viewer::YasminViewerNode::fsms_mutex_ |
|
mutableprivate |
Mutex protecting access to the finite state machine cache.
◆ host_
| std::string yasmin_viewer::YasminViewerNode::host_ |
|
private |
Host address used by the embedded web server.
◆ max_age_seconds_
| double yasmin_viewer::YasminViewerNode::max_age_seconds_ |
|
private |
Maximum cache age in seconds before a finite state machine is removed.
◆ port_
| int64_t yasmin_viewer::YasminViewerNode::port_ |
|
private |
Port used by the embedded web server.
◆ server_running_
| std::atomic_bool yasmin_viewer::YasminViewerNode::server_running_ |
|
private |
Indicates whether the embedded web server is running.
◆ server_thread_
| std::thread yasmin_viewer::YasminViewerNode::server_thread_ |
|
private |
Background thread executing the embedded web server.
◆ web_root_
| std::string yasmin_viewer::YasminViewerNode::web_root_ |
|
private |
Root directory containing the web viewer files.
The documentation for this class was generated from the following files: