sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas::SimulatorServer Class Reference

Server exposing simulator control services. More...

#include <sas_simulator_server.hpp>

Inheritance diagram for sas::SimulatorServer:
sas::Object

Public Member Functions

 SimulatorServer (const SimulatorServer &)=delete
 
 SimulatorServer (const std::shared_ptr< Node > &node, const std::string topic_prefix="GET_FROM_NODE")
 Construct a new SimulatorServer.
 
void set_start_simulation_callback (const std::function< void()> &)
 Register a callback executed when the start service is called.
 
void set_stop_simulation_callback (const std::function< void()> &)
 Register a callback executed when the stop service is called.
 
bool is_enabled () const
 Query whether the server is enabled.
 
std::string get_topic_prefix () const
 Get the configured topic/service prefix.
 

Detailed Description

Server exposing simulator control services.

SimulatorServer provides ROS service servers for starting and stopping a simulator (std_srvs::srv::Trigger). Callers can register callbacks that will be executed when the corresponding service is invoked. The class also exposes query methods for enabled state and topic/service prefix.

Constructor & Destructor Documentation

◆ SimulatorServer()

sas::SimulatorServer::SimulatorServer ( const std::shared_ptr< Node > &  node,
const std::string  topic_prefix = "GET_FROM_NODE" 
)

Construct a new SimulatorServer.

Parameters
nodeShared pointer to the rclcpp::Node used for ROS communications.
topic_prefixTopic/service prefix used to build service names. Defaults to "GET_FROM_NODE".

Member Function Documentation

◆ get_topic_prefix()

std::string sas::SimulatorServer::get_topic_prefix ( ) const

Get the configured topic/service prefix.

Returns
std::string The topic/service prefix used by this server.

◆ is_enabled()

bool sas::SimulatorServer::is_enabled ( ) const

Query whether the server is enabled.

Returns
true if enabled, false otherwise.

◆ set_start_simulation_callback()

void sas::SimulatorServer::set_start_simulation_callback ( const std::function< void()> &  start_simulation_callback)

Register a callback executed when the start service is called.

Parameters
cbFunction invoked on start service requests.

◆ set_stop_simulation_callback()

void sas::SimulatorServer::set_stop_simulation_callback ( const std::function< void()> &  stop_simulation_callback)

Register a callback executed when the stop service is called.

Parameters
cbFunction invoked on stop service requests.

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