Skip to content

Commit 5b1514e

Browse files
authored
Merge pull request #26 from AGH-CEAI/feature/jazzy-port
ROS 2 Jazzy support
2 parents 1ebafe3 + 90a29c7 commit 5b1514e

File tree

8 files changed

+59
-21
lines changed

8 files changed

+59
-21
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
55
[![DOI](https://zenodo.org/badge/898628878.svg)](https://doi.org/10.5281/zenodo.15047949)
66

7-
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!**
7+
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!**
88

99

1010
![Control preview](docs/gripper_control.webp)
@@ -25,7 +25,7 @@ source ./install/local_setup.sh
2525
```
2626
> [!NOTE]
2727
> **Configuration is split between two packages:**
28-
> * `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).
28+
> * `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).
2929
> * `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).
3030
3131

@@ -40,8 +40,17 @@ Send a command to the gripper in another terminal:
4040
```bash
4141
ros2 action send_goal /gripper_action_controller/gripper_cmd control_msgs/action/GripperCommand \
4242
"command:
43+
header:
4344
position: 0.0
45+
stamp:
4446
max_effort: 0.0
47+
sec: 0
48+
nanosec: 0
49+
frame_id: ''
50+
name: []
51+
position: [0.0]
52+
velocity: []
53+
effort: []
4554
"
4655
```
4756

@@ -120,17 +129,17 @@ socat pty,link=/tmp/ttyUR,raw,ignoreeof,waitslave tcp:192.168.100.10:54321
120129
121130
## Integration with (other) robots
122131

123-
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.
132+
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.
124133

125-
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.
134+
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.
126135

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

129-
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).
138+
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).
130139

131140
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.
132141

133-
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)
142+
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)
134143

135144
> [!IMPORTANT]
136145
> The `robotiq_hande_driver` currently provides only a **hardware component** (i.e. _hardware interface_) to control the fingers' joints.

robotiq_hande_driver/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
### Changed
2323

24+
* [PR-26](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/26) - Migration from ROS 2 Humble to ROS 2 Jazzy.
2425
* [PR-27](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/27) - Renamed `ip_adress` to `socat_ip_address` and `port` to `socat_port`.
25-
2626
* [PR-21](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/21) - Refactored the modbus communication to use multithreads:
2727
* Renamed `application.hpp/cpp` to `hande_gripper.hpp/cpp`.
2828
* Changed plain arrays `uint8_t bytes_[]` into `std::array<uint8_t, *>`.

robotiq_hande_driver/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ install(
6060
if(BUILD_TESTING)
6161
find_package(ament_cmake_gmock REQUIRED)
6262
# find_package(ament_cmake_pytest REQUIRED)
63+
find_package(ros2_control_test_assets REQUIRED)
6364
find_package(hardware_interface REQUIRED)
6465

6566
ament_add_gmock(test_load_hw_interface test/test_load_hw_interface.cpp)
6667
target_link_libraries(test_load_hw_interface ${PROJECT_NAME})
68+
ament_target_dependencies(test_load_hw_interface ros2_control_test_assets)
6769

6870
# TODO(issue#8) Build the communication_test only with BUILD_TESTING flag
6971
# ament_add_gmock(application_test test/application_test.cpp )

robotiq_hande_driver/bringup/config/hande_controller.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99
type: joint_state_broadcaster/JointStateBroadcaster
1010

1111
gripper_action_controller:
12-
type: position_controllers/GripperActionController
12+
type: parallel_gripper_action_controller/GripperActionController
1313

1414
gripper_action_controller:
1515
ros__parameters:
1616
action_monitor_rate: 20.0 # Hz
1717
joint: $(var tf_prefix)robotiq_hande_left_finger_joint
18-
max_effort: 10.0 # N
1918
goal_tolerance: 0.01 # m
2019
allow_stalling: false
21-
stall_velocity_threshold: 0.001 #m/s
20+
stall_velocity_threshold: 0.001 # m/s
2221
stall_timeout: 1.0 # s
22+
max_effort_interface: ""
23+
max_effort: 10.0 # N
24+
max_velocity_interface: ""
25+
max_velocity: 0.1 # m/s
2326
state_interfaces:
2427
- position
28+
- velocity

robotiq_hande_driver/hardware/include/robotiq_hande_driver/hande_hardware_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RobotiqHandeHardwareInterface : public HWI::SystemInterface {
2525

2626
~RobotiqHandeHardwareInterface();
2727

28-
HWI::CallbackReturn on_init(const HWI::HardwareInfo& info) override;
28+
HWI::CallbackReturn on_init(const HWI::HardwareComponentInterfaceParams& info) override;
2929
HWI::CallbackReturn on_configure(const rlccp_lc::State& previous_state) override;
3030
HWI::CallbackReturn on_cleanup(const rlccp_lc::State& previous_state) override;
3131
std::vector<HWI::StateInterface> export_state_interfaces() override;

robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ RobotiqHandeHardwareInterface::~RobotiqHandeHardwareInterface() {
1717
if(socat_ && socat_->is_alive()) socat_->stop();
1818
}
1919

20-
HWI::CallbackReturn RobotiqHandeHardwareInterface::on_init(const HWI::HardwareInfo& info) {
20+
HWI::CallbackReturn RobotiqHandeHardwareInterface::on_init(
21+
const HWI::HardwareComponentInterfaceParams& info) {
2122
if(HWI::SystemInterface::on_init(info) != CallbackReturn::SUCCESS) {
2223
return HWI::CallbackReturn::ERROR;
2324
}

robotiq_hande_driver/robotiq_hande_driver.repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ repositories:
22
robotiq_hande_description:
33
type: git
44
url: https://github.com/AGH-CEAI/robotiq_hande_description
5-
version: 2190af7c85569fc9a85f4b78096edd433c0dbad1
5+
version: v0.2.0-jazzy

robotiq_hande_driver/test/test_load_hw_interface.cpp

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
#include <cmath>
44
#include <string>
55

6-
#include "hardware_interface/loaned_command_interface.hpp"
6+
#pragma GCC diagnostic push
7+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
78
#include "hardware_interface/loaned_state_interface.hpp"
9+
#include "hardware_interface/types/lifecycle_state_names.hpp"
10+
#pragma GCC diagnostic pop
11+
812
#include "hardware_interface/resource_manager.hpp"
913
#include "hardware_interface/types/lifecycle_state_names.hpp"
1014
#include "lifecycle_msgs/msg/state.hpp"
15+
#include "rclcpp/node.hpp"
1116
#include "rclcpp_lifecycle/state.hpp"
12-
#include "ros2_control_test_assets/components_urdfs.hpp"
13-
#include "ros2_control_test_assets/descriptions.hpp"
1417

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

2124
class TestHWInterface : public ::testing::Test {
2225
protected:
26+
static void SetUpTestCase() {
27+
rclcpp::init(0, nullptr);
28+
}
29+
30+
static void TearDownTestCase() {
31+
rclcpp::shutdown();
32+
}
33+
2334
void SetUp() override {
2435
hw_system_gripper_1dof_ =
2536
R"(
@@ -50,6 +61,7 @@ class TestHWInterface : public ::testing::Test {
5061
}
5162

5263
std::string hw_system_gripper_1dof_;
64+
rclcpp::Node node_ = rclcpp::Node("TestGenericSystem");
5365
};
5466

5567
// Forward declaration
@@ -61,15 +73,25 @@ class TestableResourceManager : public hardware_interface::ResourceManager {
6173
public:
6274
friend TestHWInterface;
6375

64-
TestableResourceManager() : hardware_interface::ResourceManager() {}
76+
explicit TestableResourceManager(rclcpp::Node& node)
77+
: hardware_interface::ResourceManager(
78+
node.get_node_clock_interface(), node.get_node_logging_interface()) {}
6579

66-
TestableResourceManager(
67-
const std::string& urdf, bool validate_interfaces = true, bool activate_all = false)
68-
: hardware_interface::ResourceManager(urdf, validate_interfaces, activate_all) {}
80+
explicit TestableResourceManager(
81+
rclcpp::Node& node,
82+
const std::string& urdf,
83+
bool activate_all = false,
84+
unsigned int cm_update_rate = 100)
85+
: hardware_interface::ResourceManager(
86+
urdf,
87+
node.get_node_clock_interface(),
88+
node.get_node_logging_interface(),
89+
activate_all,
90+
cm_update_rate) {}
6991
};
7092

7193
TEST_F(TestHWInterface, load_robotiq_hande_hardware_interface) {
7294
auto urdf = ros2_control_test_assets::urdf_head + hw_system_gripper_1dof_
7395
+ ros2_control_test_assets::urdf_tail;
74-
ASSERT_NO_THROW(TestableResourceManager rm(urdf));
96+
ASSERT_NO_THROW(TestableResourceManager rm(node_, urdf));
7597
}

0 commit comments

Comments
 (0)