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
using namespace
rclcpp;
46
47
namespace
sas
48
{
49
57
struct
RobotDriverROSConfiguration
58
{
60
std::string
robot_driver_provider_prefix
;
61
63
double
thread_sampling_time_sec
;
64
66
double
watchdog_period_in_seconds
;
67
69
std::vector<double>
q_min
;
70
72
std::vector<double>
q_max
;
73
};
74
82
class
RobotDriverROS
83
{
84
private
:
85
std::shared_ptr<Node> node_;
86
87
RobotDriverROSConfiguration
configuration_;
88
std::atomic_bool* kill_this_node_;
//Deprecated
89
std::shared_ptr<ShutdownSignaler> shutdown_signaler_;
90
std::shared_ptr<RobotDriver> robot_driver_;
91
Clock
clock_;
92
RobotDriverServer
robot_driver_server_;
93
bool
watchdog_started_;
94
double
watchdog_period_in_seconds_;
95
double
watchdog_maximum_acceptable_delay_in_seconds_;
96
bool
_should_shutdown()
const
;
97
98
public
:
99
RobotDriverROS(
const
RobotDriverROS&)=
delete
;
100
RobotDriverROS()=
delete
;
101
110
RobotDriverROS(std::shared_ptr<Node>& node,
111
const
std::shared_ptr<RobotDriver>& robot_driver,
112
const
RobotDriverROSConfiguration
& configuration,
113
const
std::shared_ptr<ShutdownSignaler>& shutdown_signaler_);
114
115
[[deprecated(
"Use RobotDriver(const std::shared_ptr<ShutdownSignaler>& shutdown_signaler_) instead."
)]]
116
RobotDriverROS(std::shared_ptr<Node>& node,
117
const
std::shared_ptr<RobotDriver>& robot_driver,
118
const
RobotDriverROSConfiguration
& configuration,
119
std::atomic_bool* kill_this_node);
120
124
~RobotDriverROS
();
125
134
int
control_loop
();
135
};
136
137
}
sas::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:206
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:59
sas_clock.hpp
Timing utilities for control loops and statistics collection.
sas_robot_driver.hpp
Abstract RobotDriver interface and watchdog support.
sas_shutdown_signaler.hpp
Cross-module shutdown signaling class.
sas::RobotDriverROSConfiguration
Configuration structure for RobotDriverROS.
Definition
sas_robot_driver_ros.hpp:58
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:72
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:60
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:66
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:69
sas::RobotDriverROSConfiguration::thread_sampling_time_sec
double thread_sampling_time_sec
Control thread sampling time in seconds.
Definition
sas_robot_driver_ros.hpp:63
src
sas_robot_driver
include
sas_robot_driver
sas_robot_driver_ros.hpp
Generated by
1.17.0