Skip to content

Commit 4b834c0

Browse files
committed
Added inactive_timeout as parameter
1 parent c388e4a commit 4b834c0

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

ur_controllers/doc/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,15 @@ Parameters
282282
+----------------------------------+--------------+----------------------------------------+------------------------------------------------------------------------------------------------------------------+
283283
| ``tf_prefix`` | string | <empty> | Urdf prefix of the corresponding arm |
284284
+----------------------------------+--------------+----------------------------------------+------------------------------------------------------------------------------------------------------------------+
285+
| ``inactive_timeout`` | int | 10 | Time interval (in seconds) of message inactivity after which freedrive is deactivated |
286+
+----------------------------------+--------------+----------------------------------------+------------------------------------------------------------------------------------------------------------------+
285287

286288
Usage
287289
"""""
288290

289-
The controller provides the ``enable_freedrive_mode`` topic of type ``[std_msgs/msg/Bool]`` for handling activation and deactivation:
291+
The controller provides the ``/enable_freedrive_mode`` topic of type ``[std_msgs/msg/Bool]`` for handling activation and deactivation:
290292

291293
* to start and keep the freedrive active, it is necessary to continously publish a ``True`` msg on the indicated topic.
292294
To deal with malfunctioning on the client side, the controller deactivates the freedrive mode if messages
293-
are not received anymore within the ``timeout`` parameter.
295+
are not received anymore within the ``inactive_timeout`` parameter.
294296
+ to deactivate the freedrive mode is enough to publish a ``False`` msg on the indicated topic or to deactivate the controller.

ur_controllers/include/ur_controllers/freedrive_mode_controller.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class FreedriveModeController : public controller_interface::ControllerInterface
9494
std::shared_ptr<rclcpp::Subscription<std_msgs::msg::Bool>> enable_freedrive_mode_sub_;
9595

9696
rclcpp::TimerBase::SharedPtr freedrive_sub_timer_; ///< Timer to check on the topic
97-
std::chrono::seconds timeout_interval_ = std::chrono::seconds(2);
97+
mutable std::chrono::seconds timeout_interval_;
9898
void readFreedriveModeCmd(const std_msgs::msg::Bool::SharedPtr msg);
9999

100100
std::shared_ptr<freedrive_mode_controller::ParamListener> freedrive_param_listener_;

ur_controllers/src/freedrive_mode_controller.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ controller_interface::InterfaceConfiguration FreedriveModeController::command_in
6262
config.type = controller_interface::interface_configuration_type::INDIVIDUAL;
6363

6464
const std::string tf_prefix = freedrive_params_.tf_prefix;
65+
timeout_interval_ = std::chrono::seconds(freedrive_params_.inactive_timeout);
6566

6667
// Get the command interfaces needed for freedrive mode from the hardware interface
6768
config.names.emplace_back(tf_prefix + "freedrive_mode/async_success");

ur_controllers/src/freedrive_mode_controller_parameters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ freedrive_mode_controller:
55
default_value: "",
66
description: "Urdf prefix of the corresponding arm"
77
}
8+
inactive_timeout: {
9+
type: int,
10+
default_value: 10,
11+
description: "Time interval (in seconds) of message inactivity after which freedrive is deactivated"
12+
}
813
check_io_successful_retries: {
914
type: int,
1015
default_value: 10,

0 commit comments

Comments
 (0)