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>
33#include <sas_core/sas_object.hpp>
34
35namespace sas
36{
37
45class SimulatorClient: private sas::Object
46{
47private:
48 std::shared_ptr<rclcpp::Node> node_;
49
50 std::atomic_bool enabled_;
51 std::string topic_prefix_;
52
53 std::shared_ptr<rclcpp::Client<std_srvs::srv::Trigger>> service_client_start_simulation_;
54 std::shared_ptr<rclcpp::Client<std_srvs::srv::Trigger>> service_client_stop_simulation_;
55
56public:
57 SimulatorClient() = delete;
58 SimulatorClient(const SimulatorClient&) = delete;
59
66 SimulatorClient(const std::shared_ptr<rclcpp::Node> &node,
67 const std::string topic_prefix="GET_FROM_NODE");
68
77 bool start_simulation();
78
87 bool stop_simulation();
88
94 bool is_enabled() const;
95
101 std::string get_topic_prefix() const;
102};
103
104}
Base class for SAS objects.
Definition sas_object.hpp:40
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