sas
Modularised monitoring, logging, and control of robots.
Toggle main menu visibility
Loading...
Searching...
No Matches
sas_robot_driver_ros.hpp
1
/*
2
# Copyright (c) 2016-2025 Murilo Marques Marinho
3
#
4
# This file is part of sas_robot_driver.
5
#
6
# sas_robot_driver is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Lesser General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# sas_robot_driver is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Lesser General Public License for more details.
15
#
16
# You should have received a copy of the GNU Lesser General Public License
17
# along with sas_robot_driver. If not, see <https://www.gnu.org/licenses/>.
18
#
19
# ################################################################
20
#
21
# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
22
#
23
# ################################################################
24
# Contributors:
25
#
26
# 1. Juan Jose Quiroz Omana (juanjose.quirozomana@manchester.ac.uk)
27
# - Added the Watchdog functionality.
28
# - Renamed robot_driver_provider_ to robot_driver_server_
29
# - Added a new std::optional parameter in RobotDriverROSConfiguration to define the watchdog period
30
#
31
*/
32
33
#pragma once
34
35
#include <atomic>
36
#include <vector>
37
#include <memory>
38
39
#include <rclcpp/rclcpp.hpp>
40
#include <sas_core/sas_shutdown_signaler.hpp>
41
#include <sas_core/sas_clock.hpp>
42
#include <sas_core/sas_robot_driver.hpp>
43
#include <sas_robot_driver/sas_robot_driver_server.hpp>
44
45
46
namespace
sas
47
{
48
56
struct
RobotDriverROSConfiguration
57
{
59
std::string
robot_driver_provider_prefix
;
60
62
double
thread_sampling_time_sec
;
63
65
double
watchdog_period_in_seconds
;
66
68
std::vector<double>
q_min
;
69
71
std::vector<double>
q_max
;
72
};
73
81
class
RobotDriverROS
82
{
83
private
:
84
std::shared_ptr<rclcpp::Node> node_;
85
86
RobotDriverROSConfiguration
configuration_;
87
std::atomic_bool* kill_this_node_;
//Deprecated
88
std::shared_ptr<ShutdownSignaler> shutdown_signaler_;
89
std::shared_ptr<RobotDriver> robot_driver_;
90
Clock
clock_;
91
RobotDriverServer
robot_driver_server_;
92
bool
watchdog_started_;
93
double
watchdog_period_in_seconds_;
94
double
watchdog_maximum_acceptable_delay_in_seconds_;
95
bool
_should_shutdown()
const
;
96
97
public
:
98
RobotDriverROS(
const
RobotDriverROS&)=
delete
;
99
RobotDriverROS()=
delete
;
100
109
RobotDriverROS(std::shared_ptr<rclcpp::Node>& node,
110
const
std::shared_ptr<RobotDriver>& robot_driver,
111
const
RobotDriverROSConfiguration
& configuration,
112
const
std::shared_ptr<ShutdownSignaler>& shutdown_signaler_);
113
114
[[deprecated(
"Use RobotDriver(const std::shared_ptr<ShutdownSignaler>& shutdown_signaler_) instead."
)]]
115
RobotDriverROS(std::shared_ptr<rclcpp::Node>& node,
116
const
std::shared_ptr<RobotDriver>& robot_driver,
117
const
RobotDriverROSConfiguration
& configuration,
118
std::atomic_bool* kill_this_node);
119
123
~RobotDriverROS
();
124
133
int
control_loop
();
134
};
135
136
}
marinholab::sas::core::Clock
Clock utility for timing and statistics in control loops.
Definition
sas_clock.hpp:49
sas::RobotDriverROS::~RobotDriverROS
~RobotDriverROS()
Destructor; stops the control loop and performs cleanup.
Definition
sas_robot_driver_ros.cpp:226
sas::RobotDriverROS::control_loop
int control_loop()
Run the control loop.
Definition
sas_robot_driver_ros.cpp:84
sas::RobotDriverServer
Server interface for robot driver ROS topics.
Definition
sas_robot_driver_server.hpp:58
sas::RobotDriverROSConfiguration
Configuration structure for RobotDriverROS.
Definition
sas_robot_driver_ros.hpp:57
sas::RobotDriverROSConfiguration::q_max
std::vector< double > q_max
Joint position maximum limits (q_max.size() == number of joints).
Definition
sas_robot_driver_ros.hpp:71
sas::RobotDriverROSConfiguration::robot_driver_provider_prefix
std::string robot_driver_provider_prefix
Prefix that identifies the robot driver provider node/topic namespace.
Definition
sas_robot_driver_ros.hpp:59
sas::RobotDriverROSConfiguration::watchdog_period_in_seconds
double watchdog_period_in_seconds
Watchdog period in seconds. If <= 0 the watchdog may be considered disabled.
Definition
sas_robot_driver_ros.hpp:65
sas::RobotDriverROSConfiguration::q_min
std::vector< double > q_min
Joint position minimum limits (q_min.size() == number of joints).
Definition
sas_robot_driver_ros.hpp:68
sas::RobotDriverROSConfiguration::thread_sampling_time_sec
double thread_sampling_time_sec
Control thread sampling time in seconds.
Definition
sas_robot_driver_ros.hpp:62
src
sas_robot_driver
include
sas_robot_driver
sas_robot_driver_ros.hpp
Generated by
1.17.0