sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_object_server.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 <dqrobotics/DQ.h>
32
33#include <rclcpp/rclcpp.hpp>
34#include <geometry_msgs/msg/pose_stamped.hpp>
36
37using namespace rclcpp;
38using namespace DQ_robotics;
39
40namespace sas
41{
42
53{
54private:
55 std::shared_ptr<Node> node_;
56
57 std::atomic_bool enabled_;
58 std::string topic_prefix_;
59
60 Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr subscriber_pose_;
61 Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr publisher_pose_;
62 DQ target_pose_;
63
64 void _callback_target_pose(const geometry_msgs::msg::PoseStamped& msg);
65public:
66 ObjectServer() = delete;
67 ObjectServer(const ObjectServer&) = delete;
68
75 ObjectServer(const std::shared_ptr<Node> &node,
76 const std::string topic_prefix="GET_FROM_NODE");
77
83 void send_pose(const DQ& pose);
84
90 DQ get_target_pose() const;
91
97 bool is_enabled() const;
98
104 std::string get_topic_prefix() const;
105};
106
107}
Server wrapper for object pose.
Definition sas_object_server.hpp:53
std::string get_topic_prefix() const
Get the configured topic prefix.
Definition sas_object_server.cpp:77
DQ get_target_pose() const
Get the currently stored target pose.
Definition sas_object_server.cpp:64
void send_pose(const DQ &pose)
Publish the provided pose to the configured topic.
Definition sas_object_server.cpp:59
bool is_enabled() const
Query whether the server is enabled.
Definition sas_object_server.cpp:72
Definition sas_object.hpp:39
Base object class for identification and license utilities.