sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_simulator_client.hpp
1#pragma once
2/*
3# Copyright (c) 2026 Murilo Marques Marinho
4#
5# This file is part of sas_common.
6#
7# sas_common is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# sas_common is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with sas_common. If not, see <https://www.gnu.org/licenses/>.
19#
20# ################################################################
21#
22# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23#
24# ################################################################
25# Contributors:
26# ---
27*/
28
29#include <atomic>
30
31#include <rclcpp/rclcpp.hpp>
32#include <std_srvs/srv/trigger.hpp>
34
35using namespace rclcpp;
36
37namespace sas
38{
39
48{
49private:
50 std::shared_ptr<Node> node_;
51
52 std::atomic_bool enabled_;
53 std::string topic_prefix_;
54
55 std::shared_ptr<Client<std_srvs::srv::Trigger>> service_client_start_simulation_;
56 std::shared_ptr<Client<std_srvs::srv::Trigger>> service_client_stop_simulation_;
57
58public:
59 SimulatorClient() = delete;
60 SimulatorClient(const SimulatorClient&) = delete;
61
68 SimulatorClient(const std::shared_ptr<Node> &node,
69 const std::string topic_prefix="GET_FROM_NODE");
70
79 bool start_simulation();
80
89 bool stop_simulation();
90
96 bool is_enabled() const;
97
103 std::string get_topic_prefix() const;
104};
105
106}
Definition sas_object.hpp:39
Client for controlling a simulator via ROS services.
Definition sas_simulator_client.hpp:48
bool is_enabled() const
Query whether the client is enabled.
Definition sas_simulator_client.cpp:62
bool stop_simulation()
Call the stop simulation service.
Definition sas_simulator_client.cpp:55
std::string get_topic_prefix() const
Get the configured topic/service prefix.
Definition sas_simulator_client.cpp:68
bool start_simulation()
Call the start simulation service.
Definition sas_simulator_client.cpp:48
Base object class for identification and license utilities.