sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_force_sensor_client.hpp
1#pragma once
2/*
3# Copyright (c) 2020-2026 Murilo Marques Marinho
4#
5# This file is part of sas_force_sensor.
6#
7# sas_force_sensor 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_force_sensor 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_force_sensor. If not, see <https://www.gnu.org/licenses/>.
19#
20# ################################################################
21#
22# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23#
24# ################################################################*/
25
26#include <atomic>
27
28#include <dqrobotics/DQ.h>
29
30#include <rclcpp/rclcpp.hpp>
31#include <geometry_msgs/msg/wrench_stamped.hpp>
33
34using namespace rclcpp;
35using namespace DQ_robotics;
36
37namespace sas
38{
47class ForceSensorClient: private sas::Object
48{
49private:
50 std::shared_ptr<Node> node_;
51
52 std::atomic_bool enabled_;
53 const std::string topic_prefix_;
54
55 Subscription<geometry_msgs::msg::WrenchStamped>::SharedPtr subscriber_wrench_;
56 DQ force_;
57 DQ torque_;
58
59 void _callback_wrench(const geometry_msgs::msg::WrenchStamped& msg);
60public:
61 ForceSensorClient() = delete;
62 ForceSensorClient(const ForceSensorClient&) = delete;
63
71 ForceSensorClient(const std::shared_ptr<Node>& node, const std::string& topic_prefix="GET_FROM_NODE");
72
78 bool is_enabled() const;
79
86 DQ get_force() const;
87
94 DQ get_torque() const;
95
101 std::string get_topic_prefix() const;
102};
103
104}
std::string get_topic_prefix() const
Get the configured topic prefix.
Definition sas_force_sensor_client.cpp:83
DQ get_torque() const
Get the last received torque reading.
Definition sas_force_sensor_client.cpp:75
DQ get_force() const
Get the last received force reading.
Definition sas_force_sensor_client.cpp:67
bool is_enabled() const
Check whether the client has received at least one force/torque reading.
Definition sas_force_sensor_client.cpp:62
Base class for SAS objects.
Definition sas_object.hpp:40
Base object class for identification and license utilities.