Skip to content

Commit abb2a16

Browse files
slimasziommacmacal
andauthored
Humble release v0.1.0 (#12)
* Initial ros2_control architecture (#1) * updated pre-commit with ruff, cmake & clang formatters * pre-commit fmt * added -Werror compile flag * clang & cmake format config * fmt * Disabled -Werror flag, linked issue#5 * ModbusRTU serial communication with Hand-E (#7) * Feature/serial communication (#2) * ADD: initial communication abstraction * ADD: libmodbus-dev to dependency * ADD: modbus+gripper communication test * CHG: run communication test in .c; fixes included * ADD: full communication layer to modbus * ADD: log folder to gitignore * FIX: initializers * REF: refactor to fit google style * ADD: position and current scaling to application layer * FIX: precommit formatting * FIX: precommit formatting 2 * FIX: precommit formatting 3 * FIX: protocolLogic -> GoTo byte select * ADD: cmakelists update * FIX: modbus read write register swap * FIX: open and close parameters * ADD: how to test in readme * FIX: position '0' is when opened and '255' when closed (calculation) * FIX: position to position raw in application::goto * CHG: function camelcase to snakecase * CHG: changelog * CHG: remove hardcoded values and handle reigsters without iterators * CHG: move write action bit to communication file * CHG: remove hardcoded values from protocol logic * ADD: connection confirmation and remove bit shift in communication * FIX: connection error message * FIX: connection error message result * Apply suggestions from code review CHG: use scoped enums with first element set to 0u Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Apply suggestions from code review CHG: update readme and changelog Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * CHG: class comment in protocol_logic.hpp * CHG: code according to review * CHG: code according to review - position bits, getters * CHG: move most definitions to header files * CHG: constant values in screaming case * CHG: testing split into functions, variable values as const * CHG: comments * CHG: static cast * CHG: pre-commit errors * CHG: add missing casts * ADD: register word length based on bytes in frames * CMake - check for libmodbus --------- Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * CHG: move file directories to fit ros2 control * CHG: update cmakelists and config layer for modbus session * ADD: parametrization * ADD: parameters to test_load_hw_interface * ADD: activation based on is_ready flag * FIX: pre-commit * CHG: initialize cmd and state position to gripper position max * FIX: unify namespace tag * ADD: max iterations for activation * ADD: return config result to hardware layer * FIX: string pointer pass to modbus * FIX: issues just before successful run * CHG: precommit-fixes * Update robotiq_hande_driver/CHANGELOG.md Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update README.md Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/CMakeLists.txt Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/CMakeLists.txt Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * CHG: review suggestions * CHG: return connection status code to hardware info * ADD: modbus failure status code * CHG: activation logic moved to hardware_interface * FIX: wait_100ms declaration * CHG: print modbus config in hardware_interface * CHG: remove obsolete logger_ * ADD: log throttled when activating * CHG: move clock init to on_init * CHG: replace constexpr with static constexpr * ADD: ignore modbus connection check --------- Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * ADD: reconnecting to modbus on configure * CHG: docs * Update robotiq_hande_driver/CHANGELOG.md Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/CHANGELOG.md Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update documentation in communication.hpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * Update robotiq_hande_driver/hardware/src/hande_hardware_interface.cpp Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com> * FIX: missing iter outside for-loop * CHG: update changelog and docs * updated robotiq_hande_description to v0.1.0-humble * added Krzysztof as an author * CHG: bumb version to 0.1.0 in package.xml * README: connection setup info * fmt * DEL: remove logging from export_state_interface * updated rviz preview * added example commands to readme * preview animation * added citation * ADD: update repo hash --------- Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com>
1 parent a5a884c commit abb2a16

26 files changed

+2141
-35
lines changed

.clang-format

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
5+
ColumnLimit: 100
6+
IndentWidth: 4
7+
8+
AccessModifierOffset: -1
9+
AlignAfterOpenBracket: AlwaysBreak
10+
AllowShortFunctionsOnASingleLine: Empty
11+
BinPackArguments: false
12+
BinPackParameters: false
13+
BreakBeforeBinaryOperators: NonAssignment
14+
DerivePointerAlignment: false
15+
IncludeBlocks: Preserve
16+
IndentPPDirectives: BeforeHash
17+
PenaltyBreakAssignment: 21
18+
19+
SpaceBeforeParens: Custom
20+
SpaceBeforeParensOptions:
21+
AfterControlStatements: false
22+
AfterForeachMacros: false
23+
AfterFunctionDeclarationName: false
24+
AfterFunctionDefinitionName: false
25+
AfterIfMacros: false
26+
AfterOverloadedOperator: false
27+
AfterPlacementOperator: true
28+
AfterRequiresInClause: false
29+
AfterRequiresInExpression: false
30+
BeforeNonEmptyParentheses: false

.cmake-format.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with section("format"): # noqa F821
2+
line_width = 100
3+
tab_size = 2
4+
command_case = "lower"
5+
max_subgroups_hwrap = 2
6+
max_pargs_hwrap = 4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
devel/
22
logs/
3+
log/
34
build/
45
bin/
56
install/

.pre-commit-config.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.5
4+
hooks:
5+
- id: ruff
6+
args:
7+
- --fix
8+
- --exit-non-zero-on-fix
9+
- id: ruff-format
10+
11+
- repo: https://github.com/cheshirekow/cmake-format-precommit
12+
rev: v0.6.13
13+
hooks:
14+
- id: cmake-format
15+
- id: cmake-lint
16+
17+
- repo: https://github.com/pre-commit/mirrors-clang-format
18+
rev: v19.1.7
19+
hooks:
20+
- id: clang-format
21+
types_or: [c++, c]
22+
args:
23+
- --style=file
24+
225
- repo: https://github.com/pre-commit/pre-commit-hooks
326
rev: v5.0.0
427
hooks:
528
- id: check-added-large-files
29+
- id: check-ast
630
- id: check-case-conflict
31+
- id: check-executables-have-shebangs
732
- id: check-json
833
- id: check-merge-conflict
934
- id: check-symlinks
1035
- id: check-toml
1136
- id: check-xml
37+
- id: check-yaml
1238
- id: debug-statements
1339
- id: destroyed-symlinks
1440
- id: detect-private-key
1541
- id: end-of-file-fixer
42+
- id: fix-byte-order-marker
1643
- id: mixed-line-ending
1744
- id: pretty-format-json
1845
- id: trailing-whitespace
19-
- id: check-yaml
2046

2147
- repo: https://github.com/codespell-project/codespell
2248
rev: v2.2.6

CITATION.cff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- family-names: Aleksandrowicz
5+
given-names: Maciej
6+
orcid: https://orcid.org/0000-0003-3388-5653
7+
- family-names: Klimek
8+
given-names: Krzysztof
9+
orcid: https://orcid.org/0009-0004-6749-1833
10+
title: "Robotiq Hand-E ROS 2 Driver"
11+
version: 0.1.0
12+
identifiers:
13+
date-released: 2025-03-18

README.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,59 @@
11
# robotiq_hande_driver
2+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
24

3-
Package for controlling the [Robotiq Hand-E gripper](https://robotiq.com/products/adaptive-grippers#Hand-E) from the [ROS 2 Control](https://control.ros.org/humble/doc/getting_started/getting_started.html) framework.
5+
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!**
46

5-
Work is still in progress.
67

7-
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
8+
![Control preview](docs/gripper_control.webp)
89

910
---
1011

11-
## Quick start
12+
## Quick Start
13+
14+
### Connection Setup
15+
16+
#### Without Physical Hardware
17+
* You are ready to go - just remember to pass the `use_fake_hardware:=true` argument.
18+
19+
#### Modbus RTU
20+
* Connect the serial port to your system and locate the TTY device (typically `/dev/ttyX`).
21+
* You will need to configure the serial connection in your `.xacro.urdf` file ([example](https://github.com/AGH-CEAI/robotiq_hande_description/blob/humble/urdf/robotiq_hande_gripper.urdf.xacro) in `robotiq_hande_description`).
22+
23+
#### Modbus TCP
24+
* You can create a local `TCP` <-> `Virtual Serial Port` server with the `socat` command.
25+
* An example usage (in the form of a Python ROS 2 wrapper) can be found in `ur_robot_driver`'s [scripts/tool_communication.py](https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/blob/204e215c8a7371f6357e6a09f7e106364e566931/ur_robot_driver/scripts/tool_communication.py#L64).
26+
* Example: `socat pty,link=/tmp/ttyUR,raw,ignoreeof,waitslave tcp:192.168.1.2:54321`
27+
* For the UR's `ur_robot_driver`, the default path to the virtual serial port is `/tmp/ttyUR`.
28+
1229

13-
### Setup
30+
### Package setup
1431
```bash
1532
cd ~/ceai_ws/src
1633
git clone git@github.com:AGH-CEAI/robotiq_hande_driver.git ./src
34+
vcs import src < src/robotiq_hande_driver/robotiq_hande_driver.repos &&
1735
colcon build --symlink-install --packages-select robotiq_hande_driver
1836
source ./install/local_setup.sh
1937
```
38+
> [!NOTE]
39+
> **Configuration is split between two packages:**
40+
> * `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).
41+
> * `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).
2042
21-
### Run
43+
44+
### Launch preview
2245
```bash
23-
ros2 run robotiq_hande_driver hande_driver
46+
ros2 launch robotiq_hande_driver gripper_controller_preview.launch.py use_fake_hardware:=true
47+
# In other terminal
48+
ros2 action send_goal /gripper_action_controller/gripper_cmd control_msgs/action/GripperCommand \
49+
"command:
50+
position: 0.0
51+
max_effort: 0.0
52+
"
2453
```
2554

55+
### Examples
56+
**An example integration usage can be find** in the [AGH-CEAI/aegis_ros](https://github.com/AGH-CEAI/aegis_ros) repository.
2657

2758
---
2859
## Development notes
@@ -33,6 +64,17 @@ This project uses various tools for aiding the quality of the source code. Curre
3364
pre-commit install
3465
```
3566

67+
### Test Serial Connection
68+
69+
There is an additional test tool with hardcoded parameters to test the connection with the Hand-E without any ROS dependencies.
70+
Before build, change the hardcoded parameters in the beginning of the `robotiq_hande_driver/test/communication_test.cpp` file.
71+
72+
To run test:
73+
```bash
74+
cd cd ~/ceai_ws/src/robotiq_hande_driver/build/robotiq_hande_driver/
75+
./communication_test
76+
```
77+
3678
---
3779
## License
3880
This repository is licensed under the Apache 2.0, see LICENSE for details.

docs/gripper_control.webp

4.5 MB
Binary file not shown.

robotiq_hande_driver/CHANGELOG.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ All notable changes to the `robotiq_hande_driver` package will be documented in
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [0.1.0] - 2025-03-13
99

1010
### Added
1111

12-
### Changed
13-
14-
### Deprecated
15-
16-
### Removed
12+
* [PR-11](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/11) - Added automatic reconnection to Modbus during configuration.
13+
* [PR-7](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/7) - Integration of ModbusRTU communication with ros2_control Hardware Interface
14+
* [PR-2](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/2) - ModbusRTU communication
15+
* [PR-2](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/2) - Protocol abstraction
16+
* [PR-1](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/1) - Prepared ros2_control Hardware Interface.
1717

1818
### Fixed
1919

20-
### Security
20+
* [PR-11](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/11) - Fixed an issue where the Modbus connection check always failed.

robotiq_hande_driver/CMakeLists.txt

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,71 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.16)
22
project(robotiq_hande_driver)
33

4-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
4+
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
5+
# TODO(issue#5) Fix warnings to enable the -Werror flag
56
add_compile_options(-Wall -Wextra -Wpedantic)
67
endif()
78

9+
include(FindPkgConfig)
10+
pkg_check_modules(LIBMODBUS REQUIRED libmodbus)
11+
12+
set(DEPENDS modbus)
13+
14+
set(HW_IF_INCLUDE_DEPENDS
15+
hardware_interface
16+
pluginlib
17+
rclcpp
18+
rclcpp_lifecycle
19+
rcpputils)
20+
821
find_package(ament_cmake REQUIRED)
922

10-
add_executable(hande_driver src/hande_driver.cpp)
11-
target_include_directories(hande_driver PUBLIC
12-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
13-
$<INSTALL_INTERFACE:include>)
14-
target_compile_features(hande_driver PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
23+
foreach(dependency IN ITEMS ${HW_IF_INCLUDE_DEPENDS})
24+
find_package(${dependency} REQUIRED)
25+
endforeach()
26+
27+
add_library(
28+
${PROJECT_NAME} SHARED hardware/src/hande_hardware_interface.cpp hardware/src/application.cpp
29+
hardware/src/communication.cpp hardware/src/protocol_logic.cpp)
30+
31+
target_link_libraries(${PROJECT_NAME} PUBLIC ${DEPENDS})
32+
33+
# TODO(issue#8) Build the communication_test only with BUILD_TESTING flag
34+
add_executable(communication_test test/communication_test.cpp)
35+
target_link_libraries(communication_test ${catkin_LIBRARIES} ${DEPENDS})
36+
37+
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
38+
target_include_directories(
39+
robotiq_hande_driver PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/hardware/include>
40+
$<INSTALL_INTERFACE:include>)
41+
ament_target_dependencies(${PROJECT_NAME} PUBLIC ${HW_IF_INCLUDE_DEPENDS})
1542

16-
install(TARGETS hande_driver
17-
DESTINATION lib/${PROJECT_NAME})
43+
pluginlib_export_plugin_description_file(hardware_interface ros2_control_plugin.xml)
44+
45+
install(DIRECTORY hardware/include/ DESTINATION include/)
46+
install(DIRECTORY bringup DESTINATION share/${PROJECT_NAME})
47+
48+
install(
49+
TARGETS ${PROJECT_NAME}
50+
EXPORT export_${PROJECT_NAME}
51+
ARCHIVE DESTINATION lib
52+
LIBRARY DESTINATION lib
53+
RUNTIME DESTINATION bin)
54+
55+
if(BUILD_TESTING)
56+
find_package(ament_cmake_gmock REQUIRED)
57+
# find_package(ament_cmake_pytest REQUIRED)
58+
find_package(hardware_interface REQUIRED)
59+
60+
ament_add_gmock(test_load_hw_interface test/test_load_hw_interface.cpp)
61+
target_link_libraries(test_load_hw_interface ${PROJECT_NAME})
62+
63+
# TODO(issue#8) Build the communication_test only with BUILD_TESTING flag
64+
# ament_add_gmock(application_test test/application_test.cpp )
65+
# target_link_libraries(application_test ${PROJECT_NAME})
66+
endif()
1867

68+
# EXPORTS
69+
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
70+
ament_export_dependencies(${HW_IF_INCLUDE_DEPENDS})
1971
ament_package()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is an example configuration file for the controller_manager node.
2+
# YOU CAN NOT USE IT IN YOUR APPLICATION WITHOUT CHANGES
3+
/**:
4+
controller_manager:
5+
ros__parameters:
6+
update_rate: 10 # Hz
7+
8+
joint_state_broadcaster:
9+
type: joint_state_broadcaster/JointStateBroadcaster
10+
11+
gripper_action_controller:
12+
type: position_controllers/GripperActionController
13+
14+
gripper_action_controller:
15+
ros__parameters:
16+
action_monitor_rate: 20.0 # Hz
17+
joint: $(var tf_prefix)robotiq_hande_left_finger_joint
18+
max_effort: 10.0 # N
19+
goal_tolerance: 0.01 # m
20+
allow_stalling: false
21+
stall_velocity_threshold: 0.001 #m/s
22+
stall_timeout: 1.0 # s
23+
state_interfaces:
24+
- position

0 commit comments

Comments
 (0)