From 7145368a3784737b56d0218a17a20e12b0739710 Mon Sep 17 00:00:00 2001 From: Paul Gesel Date: Tue, 2 Apr 2024 15:06:32 -0600 Subject: [PATCH] add detail userdoc and configurable state interface Signed-off-by: Paul Gesel --- antipodal_gripper_controller/doc/userdoc.rst | 5 +++++ .../antipodal_gripper_action_controller_impl.hpp | 13 +++++++------ ...ipodal_gripper_action_controller_parameters.yaml | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/antipodal_gripper_controller/doc/userdoc.rst b/antipodal_gripper_controller/doc/userdoc.rst index 35e426c4e7..8c76db6227 100644 --- a/antipodal_gripper_controller/doc/userdoc.rst +++ b/antipodal_gripper_controller/doc/userdoc.rst @@ -6,6 +6,11 @@ Antipodal Gripper Action Controller ----------------------------------- Controller for executing a ``AntipodalGripperCommand`` action for simple antipodal grippers. +This controller supports grippers that offer position only control as well as grippers that allow configuring the velocity and effort. +By default, the controller will only claim the `{joint}/position` interface for control. +The velocity and effort interfaces can be optionally claimed by setting the `max_velocity_interface` and `max_effort_interface` parameter, respectively. +By default, the controller will try to claim position and velocity state interfaces. +The claimed state interfaces can be configured by setting the `state_interfaces` parameter. Parameters ^^^^^^^^^^^ diff --git a/antipodal_gripper_controller/include/antipodal_gripper_controller/antipodal_gripper_action_controller_impl.hpp b/antipodal_gripper_controller/include/antipodal_gripper_controller/antipodal_gripper_action_controller_impl.hpp index eb660739c7..fac6be6974 100644 --- a/antipodal_gripper_controller/include/antipodal_gripper_controller/antipodal_gripper_action_controller_impl.hpp +++ b/antipodal_gripper_controller/include/antipodal_gripper_controller/antipodal_gripper_action_controller_impl.hpp @@ -108,8 +108,7 @@ void GripperActionController::accepted_callback( // This is the non-realtime command_struct // We use command_ for sharing command_struct_.position_cmd_ = goal_handle->get_goal()->command.position[0]; - if ( - !params_.max_velocity_interface.empty() && !goal_handle->get_goal()->command.velocity.empty()) + if (!params_.max_velocity_interface.empty() && !goal_handle->get_goal()->command.velocity.empty()) { command_struct_.max_velocity_ = goal_handle->get_goal()->command.velocity[0]; } @@ -380,10 +379,12 @@ GripperActionController::command_interface_configuration() const controller_interface::InterfaceConfiguration GripperActionController::state_interface_configuration() const { - return { - controller_interface::interface_configuration_type::INDIVIDUAL, - {params_.joint + "/" + hardware_interface::HW_IF_POSITION, - params_.joint + "/" + hardware_interface::HW_IF_VELOCITY}}; + std::vector interface_names; + for (const auto & interface : params_.state_interfaces) + { + interface_names.push_back(params_.joint + "/" + interface); + } + return {controller_interface::interface_configuration_type::INDIVIDUAL, interface_names}; } GripperActionController::GripperActionController() diff --git a/antipodal_gripper_controller/src/antipodal_gripper_action_controller_parameters.yaml b/antipodal_gripper_controller/src/antipodal_gripper_action_controller_parameters.yaml index 03aa65742a..5c3fcf8e1e 100644 --- a/antipodal_gripper_controller/src/antipodal_gripper_action_controller_parameters.yaml +++ b/antipodal_gripper_controller/src/antipodal_gripper_action_controller_parameters.yaml @@ -12,6 +12,10 @@ antipodal_gripper_action_controller: type: string, read_only: true, } + state_interfaces: { + type: string_array, + default_value: [position, velocity], + } goal_tolerance: { type: double, default_value: 0.01,