Skip to content

Commit 1fe5552

Browse files
slimasziommacmacal
andauthored
Pull v0.2.0-humble release to devel (#30)
* 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> * CHG: bumb version * ADD: Kuba to citation * FIX: pre-commit * CHG: repo tag * updated animation * CHG: docs --------- Co-authored-by: Maciej Aleksandrowicz <mac.aleksandrowicz@gmail.com>
1 parent 1ebafe3 commit 1fe5552

File tree

15 files changed

+377
-16
lines changed

15 files changed

+377
-16
lines changed

CITATION.cff

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ authors:
77
- family-names: Klimek
88
given-names: Krzysztof
99
orcid: https://orcid.org/0009-0004-6749-1833
10+
- family-names: Płachno
11+
given-names: Jakub
1012
title: "Robotiq Hand-E ROS 2 Driver"
11-
version: 0.1.0
13+
version: 0.2.0
1214
identifiers:
1315
- type: doi
1416
value: 10.5281/zenodo.15047950
15-
date-released: 2025-03-18
17+
date-released: 2025-08-25

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
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

35
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
46
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

docs/gripper_control.webp

-1.75 MB
Loading

robotiq_hande_driver/CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
### Changed
12+
### Deprecated
13+
### Removed
14+
### Fixed
15+
### Security
16+
17+
## [0.2.0] - 2025-08-25
18+
1019
### Added
1120

1221
* [PR-27](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/27) - Added additional launch arguments and provided better instructions in README.
@@ -32,8 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3241
* Encapsulated whole `Communication` config into `CommunicationConfig` struct.
3342
* renamed `tty` param to `tty_port` for better clarity.
3443

35-
### Deprecated
36-
3744
### Removed
3845

3946
* [PR-24](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/24) - Cleanup of unused variables.
@@ -47,8 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4754
* Fixed typos with wrong values in `GRIPPER_OUTPUT_FIRST_REG` and `GRIPPER_INPUT_FIRST_REG`.
4855
* [PR-16](https://github.com/AGH-CEAI/robotiq_hande_driver/pull/16) - Fixed URDF typos in the `test_load_hw_interface.cpp` file.
4956

50-
### Security
51-
5257
## [0.1.0] - 2025-03-13
5358

5459
### Added

robotiq_hande_driver/bringup/launch/gripper_controller_preview.launch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def prepare_robot_state_publisher_node() -> Node:
142142
# tf_prefix is implicitly used in ParameterValue()
143143
tf_prefix = LaunchConfiguration("tf_prefix", default="") # noqa: F841
144144
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
145+
145146
frequency_hz = LaunchConfiguration("frequency_hz")
146147
tty_port = LaunchConfiguration("tty_port")
147148
create_socat_tty = LaunchConfiguration("create_socat_tty")
Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,324 @@
1+
#ifndef ROBOTIQ_HANDE_DRIVER__APPLICATION_HPP_
2+
#define ROBOTIQ_HANDE_DRIVER__APPLICATION_HPP_
3+
4+
#include <stdint.h>
5+
#include <unistd.h>
6+
7+
#include "protocol_logic.hpp"
8+
9+
namespace robotiq_hande_driver {
10+
11+
static constexpr auto GRIPPER_CURRENT_SCALE = 0.01;
12+
static constexpr auto MAX_SPEED = 255;
13+
static constexpr auto MAX_FORCE = 255;
14+
15+
/**
16+
* @brief This class contains high-level gripper commands and status.
17+
*/
18+
class GripperApplication {
19+
public:
20+
struct Status {
21+
bool is_reset;
22+
bool is_ready;
23+
bool is_moving;
24+
bool is_stopped;
25+
bool is_opened;
26+
bool is_closed;
27+
bool object_detected;
28+
};
29+
30+
struct FaultStatus {
31+
bool is_error;
32+
};
33+
34+
GripperApplication();
35+
36+
~GripperApplication() {};
37+
38+
/**
39+
* @brief Initializes driver parameters.
40+
*
41+
* @param gripper_position_min Minimal gripper position in meters.
42+
* @param gripper_position_max Maximal gripper position in meters.
43+
* @param tty_port Modbus virtual port.
44+
* @param baudrate Modbus serial baudrate.
45+
* @param parity Modbus serial parity.
46+
* @param data_bits Modbus serial data bits.
47+
* @param stop_bit Modbus serial stopbit.
48+
* @param slave_id Modbus slave id.
49+
* @return None.
50+
* @note The status should be checked to verify successful execution. An exception is thrown if
51+
* communication issues occur.
52+
*/
53+
void initialize(
54+
double gripper_position_min,
55+
double gripper_position_max,
56+
const std::string& tty_port,
57+
int baudrate,
58+
char parity,
59+
int data_bits,
60+
int stop_bit,
61+
int slave_id) {
62+
gripper_position_min_ = gripper_position_min;
63+
gripper_position_max_ = gripper_position_max;
64+
gripper_postion_step_ = (gripper_position_max_ - gripper_position_min_) / 255.0;
65+
protocol_logic_.initialize(tty_port, baudrate, parity, data_bits, stop_bit, slave_id);
66+
};
67+
68+
/**
69+
* @brief Configures driver session.
70+
* @return int Connection status code.
71+
* @note The status should be checked to verify successful execution. An exception is thrown if
72+
* communication issues occur.
73+
*/
74+
int configure() {
75+
int result;
76+
77+
result = protocol_logic_.configure();
78+
79+
return result;
80+
};
81+
82+
/**
83+
* @brief Deinitializes driver.
84+
*
85+
* @param none
86+
* @return None.
87+
* @note The status should be checked to verify successful execution. An exception is thrown if
88+
* communication issues occur.
89+
*/
90+
void cleanup() {
91+
protocol_logic_.cleanup();
92+
};
93+
94+
/**
95+
* @brief Stops the gripper movement.
96+
*
97+
* @param none
98+
* @return None.
99+
* @note The status should be checked to verify successful execution. An exception is thrown if
100+
* communication issues occur.
101+
*/
102+
void stop() {
103+
protocol_logic_.stop();
104+
};
105+
106+
/**
107+
* @brief Resets the gripper by deactivating and reactivating it.
108+
*
109+
* @param none
110+
* @return None.
111+
* @note The status should be checked to verify successful execution. An exception is thrown if
112+
* communication issues occur.
113+
*/
114+
void reset() {
115+
protocol_logic_.reset();
116+
};
117+
118+
/**
119+
* Emergency auto-release, gripper fingers are slowly opened, reactivation necessary
120+
*
121+
* @param none
122+
* @return None.
123+
* @note The status should be checked to verify successful execution. An exception is thrown if
124+
* communication issues occur.
125+
*/
126+
void auto_release() {
127+
protocol_logic_.auto_release();
128+
};
129+
130+
/**
131+
* @brief Activates the gripper, making it ready for use.
132+
*
133+
* @return None.
134+
* @note The status should be checked to verify successful execution. An exception is thrown if
135+
* communication issues occur.
136+
*/
137+
void activate() {
138+
protocol_logic_.activate();
139+
};
140+
141+
/**
142+
* @brief Deactivates the gripper.
143+
*
144+
* @param none
145+
* @return None.
146+
* @note The status should be checked to verify successful execution. An exception is thrown if
147+
* communication issues occur.
148+
*/
149+
void deactivate() {
150+
protocol_logic_.reset();
151+
};
152+
153+
/**
154+
* @brief Deactivates the gripper.
155+
*
156+
* @param none
157+
* @return None.
158+
* @note The status should be checked to verify successful execution. An exception is thrown if
159+
* communication issues occur.
160+
*/
161+
void shutdown() {
162+
deactivate();
163+
cleanup();
164+
};
165+
166+
/**
167+
* @brief Opens the gripper.
168+
*
169+
* @param none
170+
* @return None.
171+
* @note The status should be checked to verify successful execution. An exception is thrown if
172+
* communication issues occur.
173+
*/
174+
void open() {
175+
set_position(gripper_position_max_);
176+
};
177+
178+
/**
179+
* @brief Closes the gripper.
180+
*
181+
* @param none
182+
* @return None.
183+
* @note The status should be checked to verify successful execution. An exception is thrown if
184+
* communication issues occur.
185+
*/
186+
void close() {
187+
set_position(gripper_position_min_);
188+
};
189+
190+
/**
191+
* @brief Retrieves the gripper status.
192+
*
193+
* @param none
194+
* @return The current gripper status.
195+
* @note The status should be checked to verify successful execution. An exception is thrown if
196+
* communication issues occur.
197+
*/
198+
Status get_status() {
199+
return status_;
200+
};
201+
202+
/**
203+
* @brief Retrieves the gripper fault status.
204+
*
205+
* @param none
206+
* @return The current gripper fault status.
207+
* @note The status should be checked to verify successful execution. An exception is thrown if
208+
* communication issues occur.
209+
*/
210+
FaultStatus get_fault_status() {
211+
return fault_status_;
212+
};
213+
214+
/**
215+
* @brief Retrieves the requested position of the gripper.
216+
*
217+
* @param none
218+
* @return The requested gripper position in meters.
219+
* @note The status should be checked to verify successful execution. An exception is thrown if
220+
* communication issues occur.
221+
*/
222+
double get_requested_position() {
223+
return requested_position_;
224+
};
225+
226+
/**
227+
* @brief Retrieves the actual position of the gripper.
228+
*
229+
* @param none
230+
* @return The actual gripper position in meters.
231+
* @note The status should be checked to verify successful execution. An exception is thrown if
232+
* communication issues occur.
233+
*/
234+
double get_position() {
235+
return position_;
236+
};
237+
238+
/**
239+
* @brief Moves the gripper to the requested position.
240+
*
241+
* @param position The target position in meters.
242+
* @return None.
243+
* @note The status should be checked to verify successful execution. An exception is thrown if
244+
* communication issues occur.
245+
*/
246+
void set_position(double position, double force = 1.0) {
247+
uint8_t scaled_force = static_cast<uint8_t>(force * MAX_FORCE);
248+
protocol_logic_.go_to(
249+
(uint8_t)((gripper_position_max_ - position) / gripper_postion_step_),
250+
MAX_SPEED,
251+
scaled_force);
252+
};
253+
254+
/**
255+
* @brief Retrieves the electric current drawn by the gripper.
256+
*
257+
* @param none
258+
* @return The electric current in amperes (range: 0–2.55 A)
259+
* @note The status should be checked to verify successful execution. An exception is thrown if
260+
* communication issues occur.
261+
*/
262+
double get_current() {
263+
return current_;
264+
};
265+
266+
/**
267+
* @brief Reads gripper data.
268+
*
269+
* @param none
270+
* @return None.
271+
* @note The status should be checked to verify successful execution. An exception is thrown if
272+
* communication issues occur.
273+
*/
274+
void read();
275+
276+
/**
277+
* @brief Writes gripper data.
278+
*
279+
* @param none
280+
* @return None.
281+
* @note The status should be checked to verify successful execution. An exception is thrown if
282+
* communication issues occur.
283+
*/
284+
void write() {
285+
protocol_logic_.refresh_registers();
286+
};
287+
288+
private:
289+
/**
290+
* Handles protocol logic for mid-level abstraction.
291+
*/
292+
ProtocolLogic protocol_logic_;
293+
294+
/**
295+
* Stores the gripper status bits.
296+
*/
297+
Status status_;
298+
299+
/**
300+
* Stores the fault status bits.
301+
*/
302+
FaultStatus fault_status_;
303+
304+
/**
305+
* Stores the requested position of the gripper in meters.
306+
*/
307+
double requested_position_;
308+
309+
/**
310+
* Stores the actual position of the gripper in meters.
311+
*/
312+
double position_;
313+
314+
/**
315+
* Stores the electric current drawn by the gripper in amperes.
316+
*/
317+
double current_;
318+
319+
double gripper_position_min_;
320+
double gripper_position_max_;
321+
double gripper_postion_step_;
322+
};
323+
} // namespace robotiq_hande_driver
324+
#endif // ROBOTIQ_HANDE_DRIVER__APPLICATION_HPP_

0 commit comments

Comments
 (0)