sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_object_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 <dqrobotics/DQ.h>
32
33#include <rclcpp/rclcpp.hpp>
34#include <geometry_msgs/msg/pose_stamped.hpp>
35#include <sas_core/sas_object.hpp>
36
37using namespace DQ_robotics;
38
39namespace sas
40{
41
51class ObjectClient: private sas::Object
52{
53private:
54 std::shared_ptr<rclcpp::Node> node_;
55
56 std::atomic_bool enabled_;
57 std::string topic_prefix_;
58
59 rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr subscriber_pose_;
60 rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr publisher_pose_;
61 DQ pose_;
62
63 void _callback_pose(const geometry_msgs::msg::PoseStamped& msg);
64public:
65 ObjectClient() = delete;
66 ObjectClient(const ObjectClient&) = delete;
67
74 ObjectClient(const std::shared_ptr<rclcpp::Node> &node,
75 const std::string topic_prefix="GET_FROM_NODE");
76
84 void send_pose(const DQ& pose) const;
85
92 DQ get_pose() const;
93
99 bool is_enabled() const;
100
106 std::string get_topic_prefix() const;
107};
108
109}
Base class for SAS objects.
Definition sas_object.hpp:40
std::string get_topic_prefix() const
Get the configured topic prefix.
Definition sas_object_client.cpp:77
bool is_enabled() const
Query whether the client is enabled.
Definition sas_object_client.cpp:72
DQ get_pose() const
Get the last received pose.
Definition sas_object_client.cpp:64
void send_pose(const DQ &pose) const
Publish the provided pose to the configured topic.
Definition sas_object_client.cpp:59