Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![DOI](https://zenodo.org/badge/898628878.svg)](https://doi.org/10.5281/zenodo.15047949)

Package for controlling the [Robotiq Hand-E gripper](https://robotiq.com/products/adaptive-grippers#Hand-E) using the [ROS 2 Control](https://control.ros.org/humble/doc/getting_started/getting_started.html) framework. It uses the [robotiq_hande_description](https://github.com/AGH-CEAI/robotiq_hande_description) package for URDF definitions. Originally developed for integration with Universal Robots e-Series (UR5e) and ROS 2 Humble, it is possible to modify this repository to fit your needs. **PRs are welcome!**
Package for controlling the [Robotiq Hand-E gripper](https://robotiq.com/products/adaptive-grippers#Hand-E) using the [ROS 2 Control](https://control.ros.org/jazzy/doc/getting_started/getting_started.html) framework. It uses the [robotiq_hande_description](https://github.com/AGH-CEAI/robotiq_hande_description) package for URDF definitions. Originally developed for integration with Universal Robots e-Series (UR5e) and ROS 2 Humble, it is possible to modify this repository to fit your needs. **PRs are welcome!**


![Control preview](docs/gripper_control.webp)
Expand All @@ -25,7 +25,7 @@ source ./install/local_setup.sh
```
> [!NOTE]
> **Configuration is split between two packages:**
> * `robotiq_hande_description`: Hardware connection parameters are set in the URDF file. [Example config file](https://github.com/AGH-CEAI/robotiq_hande_description/blob/humble/urdf/robotiq_hande_gripper.urdf.xacro).
> * `robotiq_hande_description`: Hardware connection parameters are set in the URDF file. [Example config file](https://github.com/AGH-CEAI/robotiq_hande_description/blob/jazzy/urdf/robotiq_hande_gripper.urdf.xacro).
> * `robotiq_hande_driver`: The controller configuration is set by launch parameters for the `controller_node`. [Example config file](robotiq_hande_driver/bringup/config/hande_controller.yaml).


Expand All @@ -40,8 +40,17 @@ Send a command to the gripper in another terminal:
```bash
ros2 action send_goal /gripper_action_controller/gripper_cmd control_msgs/action/GripperCommand \
"command:
header:
position: 0.0
stamp:
max_effort: 0.0
sec: 0
nanosec: 0
frame_id: ''
name: []
position: [0.0]
velocity: []
effort: []
"
```

Expand Down Expand Up @@ -120,17 +129,17 @@ socat pty,link=/tmp/ttyUR,raw,ignoreeof,waitslave tcp:192.168.100.10:54321

## Integration with (other) robots

To integrate the Robotiq Hand-E gripper into your existing robot, you first need to create a [Xacro (URDF) file](https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html) that includes the Hand-E macros and defines all necessary parameters.
To integrate the Robotiq Hand-E gripper into your existing robot, you first need to create a [Xacro (URDF) file](https://docs.ros.org/en/jazzy/Tutorials/Intermediate/URDF/URDF-Main.html) that includes the Hand-E macros and defines all necessary parameters.

A working example of such a file can be found [here](https://github.com/AGH-CEAI/aegis_ros/blob/humble-devel/aegis_description/urdf/modules/robotiq_hande_gripper.xacro). You can use this file as a starting point for your own integration.
A working example of such a file can be found [here](https://github.com/AGH-CEAI/aegis_ros/blob/jazzy-devel/aegis_description/urdf/modules/robotiq_hande_gripper.xacro). You can use this file as a starting point for your own integration.

Next, include this Xacro file in your main robot description tree at the appropriate tool link.

An example of including it in a robot Xacro can be found [here](https://github.com/AGH-CEAI/aegis_ros/blob/humble-devel/aegis_description/urdf/aegis.xacro).
An example of including it in a robot Xacro can be found [here](https://github.com/AGH-CEAI/aegis_ros/blob/jazzy-devel/aegis_description/urdf/aegis.xacro).

The included robotiq_hande_gripper macro automatically sets up the `<ros2_control>` block pointing to the Robotiq Hand-E driver plugin. This ensures that your robot can control the gripper via the standard ROS 2 control interfaces.

You can easliy dig into the `ros2_control` concepts with [its documentation](https://control.ros.org/rolling/doc/ros2_control/doc/index.html#concepts). There is also a [plenty of examples](https://control.ros.org/humble/doc/ros2_control_demos/doc/index.html#examples)
You can easliy dig into the `ros2_control` concepts with [its documentation](https://control.ros.org/jazzy/doc/ros2_control/doc/index.html#concepts). There is also a [plenty of examples](https://control.ros.org/jazzy/doc/ros2_control_demos/doc/index.html#examples)

> [!IMPORTANT]
> The `robotiq_hande_driver` currently provides only a **hardware component** (i.e. _hardware interface_) to control the fingers' joints.
Expand Down
2 changes: 1 addition & 1 deletion robotiq_hande_driver/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* [PR-26](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/26) - Migration from ROS 2 Humble to ROS 2 Jazzy.
* [PR-27](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/27) - Renamed `ip_adress` to `socat_ip_address` and `port` to `socat_port`.

* [PR-21](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/21) - Refactored the modbus communication to use multithreads:
* Renamed `application.hpp/cpp` to `hande_gripper.hpp/cpp`.
* Changed plain arrays `uint8_t bytes_[]` into `std::array<uint8_t, *>`.
Expand Down
2 changes: 2 additions & 0 deletions robotiq_hande_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ install(
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
# find_package(ament_cmake_pytest REQUIRED)
find_package(ros2_control_test_assets REQUIRED)
find_package(hardware_interface REQUIRED)

ament_add_gmock(test_load_hw_interface test/test_load_hw_interface.cpp)
target_link_libraries(test_load_hw_interface ${PROJECT_NAME})
ament_target_dependencies(test_load_hw_interface ros2_control_test_assets)

# TODO(issue#8) Build the communication_test only with BUILD_TESTING flag
# ament_add_gmock(application_test test/application_test.cpp )
Expand Down
10 changes: 7 additions & 3 deletions robotiq_hande_driver/bringup/config/hande_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@
type: joint_state_broadcaster/JointStateBroadcaster

gripper_action_controller:
type: position_controllers/GripperActionController
type: parallel_gripper_action_controller/GripperActionController

gripper_action_controller:
ros__parameters:
action_monitor_rate: 20.0 # Hz
joint: $(var tf_prefix)robotiq_hande_left_finger_joint
max_effort: 10.0 # N
goal_tolerance: 0.01 # m
allow_stalling: false
stall_velocity_threshold: 0.001 #m/s
stall_velocity_threshold: 0.001 # m/s
stall_timeout: 1.0 # s
max_effort_interface: ""
max_effort: 10.0 # N
max_velocity_interface: ""
max_velocity: 0.1 # m/s
state_interfaces:
- position
- velocity
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RobotiqHandeHardwareInterface : public HWI::SystemInterface {

~RobotiqHandeHardwareInterface();

HWI::CallbackReturn on_init(const HWI::HardwareInfo& info) override;
HWI::CallbackReturn on_init(const HWI::HardwareComponentInterfaceParams& info) override;
HWI::CallbackReturn on_configure(const rlccp_lc::State& previous_state) override;
HWI::CallbackReturn on_cleanup(const rlccp_lc::State& previous_state) override;
std::vector<HWI::StateInterface> export_state_interfaces() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RobotiqHandeHardwareInterface::~RobotiqHandeHardwareInterface() {
if(socat_ && socat_->is_alive()) socat_->stop();
}

HWI::CallbackReturn RobotiqHandeHardwareInterface::on_init(const HWI::HardwareInfo& info) {
HWI::CallbackReturn RobotiqHandeHardwareInterface::on_init(
const HWI::HardwareComponentInterfaceParams& info) {
if(HWI::SystemInterface::on_init(info) != CallbackReturn::SUCCESS) {
return HWI::CallbackReturn::ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion robotiq_hande_driver/robotiq_hande_driver.repos
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ repositories:
robotiq_hande_description:
type: git
url: https://github.com/AGH-CEAI/robotiq_hande_description
version: 2190af7c85569fc9a85f4b78096edd433c0dbad1
version: v0.2.0-jazzy
38 changes: 30 additions & 8 deletions robotiq_hande_driver/test/test_load_hw_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
#include <cmath>
#include <string>

#include "hardware_interface/loaned_command_interface.hpp"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "hardware_interface/loaned_state_interface.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#pragma GCC diagnostic pop

#include "hardware_interface/resource_manager.hpp"
#include "hardware_interface/types/lifecycle_state_names.hpp"
#include "lifecycle_msgs/msg/state.hpp"
#include "rclcpp/node.hpp"
#include "rclcpp_lifecycle/state.hpp"
#include "ros2_control_test_assets/components_urdfs.hpp"
#include "ros2_control_test_assets/descriptions.hpp"

// Based on tutorial
// https://control.ros.org/rolling/doc/ros2_controllers/doc/writing_new_controller.html
Expand All @@ -20,6 +23,14 @@

class TestHWInterface : public ::testing::Test {
protected:
static void SetUpTestCase() {
rclcpp::init(0, nullptr);
}

static void TearDownTestCase() {
rclcpp::shutdown();
}

void SetUp() override {
hw_system_gripper_1dof_ =
R"(
Expand Down Expand Up @@ -50,6 +61,7 @@ class TestHWInterface : public ::testing::Test {
}

std::string hw_system_gripper_1dof_;
rclcpp::Node node_ = rclcpp::Node("TestGenericSystem");
};

// Forward declaration
Expand All @@ -61,15 +73,25 @@ class TestableResourceManager : public hardware_interface::ResourceManager {
public:
friend TestHWInterface;

TestableResourceManager() : hardware_interface::ResourceManager() {}
explicit TestableResourceManager(rclcpp::Node& node)
: hardware_interface::ResourceManager(
node.get_node_clock_interface(), node.get_node_logging_interface()) {}

TestableResourceManager(
const std::string& urdf, bool validate_interfaces = true, bool activate_all = false)
: hardware_interface::ResourceManager(urdf, validate_interfaces, activate_all) {}
explicit TestableResourceManager(
rclcpp::Node& node,
const std::string& urdf,
bool activate_all = false,
unsigned int cm_update_rate = 100)
: hardware_interface::ResourceManager(
urdf,
node.get_node_clock_interface(),
node.get_node_logging_interface(),
activate_all,
cm_update_rate) {}
};

TEST_F(TestHWInterface, load_robotiq_hande_hardware_interface) {
auto urdf = ros2_control_test_assets::urdf_head + hw_system_gripper_1dof_
+ ros2_control_test_assets::urdf_tail;
ASSERT_NO_THROW(TestableResourceManager rm(urdf));
ASSERT_NO_THROW(TestableResourceManager rm(node_, urdf));
}