Skip to content

Commit b981138

Browse files
authored
Merge pull request #28 from ROBOTIS-GIT/feature-omy
Update Torque Disable
2 parents ff75941 + db11262 commit b981138

File tree

12 files changed

+393
-102
lines changed

12 files changed

+393
-102
lines changed

.github/workflows/ros-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ name: CI
44
# Specifies the events that trigger the workflow
55
on:
66
push:
7-
branches: [ main, humble, jazzy ]
7+
branches: [ humble, jazzy, main]
88
pull_request:
9-
branches: [ main, humble, jazzy ]
9+
branches: [ humble, jazzy, main]
1010

1111
# Defines a set of jobs to be run as part of the workflow
1212
jobs:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ CATKIN_IGNORE
505505
AMENT_IGNORE
506506
COLCON_IGNORE
507507

508+
## Dynamixel model files
509+
!*.model
510+
508511

509512
##############################
510513
# ETC.

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog for package dynamixel_hardware_interface
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
1.4.2 (2025-04-05)
6+
------------------
7+
* Added OM-Y dynamixel model files
8+
* Added a function to enable torque
9+
* Fixed the configuration for OM-Y robots
10+
* Contributors: Woojin Wie, Wonho Yun
11+
512
1.4.1 (2025-03-31)
613
------------------
714
* Modified the Model File

include/dynamixel_hardware_interface/dynamixel/dynamixel.hpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <iostream>
2828
#include <cstdarg>
2929
#include <memory>
30+
#include <functional>
3031

3132
namespace dynamixel_hardware_interface
3233
{
@@ -166,7 +167,7 @@ class Dynamixel
166167
DxlError SetMultiDxlWrite();
167168

168169
// Read Item (sync or bulk)
169-
DxlError ReadMultiDxlData();
170+
DxlError ReadMultiDxlData(double period_ms);
170171
// Write Item (sync or bulk)
171172
DxlError WriteMultiDxlData();
172173

@@ -200,12 +201,12 @@ class Dynamixel
200201
// SyncRead
201202
DxlError SetSyncReadItemAndHandler();
202203
DxlError SetSyncReadHandler(std::vector<uint8_t> id_arr);
203-
DxlError GetDxlValueFromSyncRead();
204+
DxlError GetDxlValueFromSyncRead(double period_ms);
204205

205206
// BulkRead
206207
DxlError SetBulkReadItemAndHandler();
207208
DxlError SetBulkReadHandler(std::vector<uint8_t> id_arr);
208-
DxlError GetDxlValueFromBulkRead();
209+
DxlError GetDxlValueFromBulkRead(double period_ms);
209210

210211
// Read - Indirect Address
211212
void ResetIndirectRead(std::vector<uint8_t> id_arr);
@@ -215,6 +216,23 @@ class Dynamixel
215216
uint16_t item_addr,
216217
uint8_t item_size);
217218

219+
// Read - Data Processing
220+
DxlError ProcessReadData(
221+
uint8_t id,
222+
uint16_t indirect_addr,
223+
const std::vector<std::string> & item_names,
224+
const std::vector<uint8_t> & item_sizes,
225+
const std::vector<std::shared_ptr<double>> & data_ptrs,
226+
std::function<uint32_t(uint8_t, uint16_t, uint8_t)> get_data_func);
227+
228+
// Read - Communication
229+
DxlError ProcessReadCommunication(
230+
dynamixel::GroupFastSyncRead * group_sync_read,
231+
dynamixel::GroupFastBulkRead * group_bulk_read,
232+
dynamixel::PortHandler * port_handler,
233+
double period_ms,
234+
bool is_sync);
235+
218236
// SyncWrite
219237
DxlError SetSyncWriteItemAndHandler();
220238
DxlError SetSyncWriteHandler(std::vector<uint8_t> id_arr);

include/dynamixel_hardware_interface/dynamixel_hardware_interface.hpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ class DynamixelHardware : public
191191
bool is_read_in_error_{false};
192192
bool is_write_in_error_{false};
193193

194+
bool global_torque_enable_{true};
195+
194196
bool use_revolute_to_prismatic_{false};
195197
std::string conversion_dxl_name_{""};
196198
std::string conversion_joint_name_{""};
@@ -235,6 +237,9 @@ class DynamixelHardware : public
235237
std::vector<uint8_t> sensor_id_;
236238
std::map<uint8_t /*id*/, std::string /*interface_name*/> sensor_item_;
237239

240+
std::vector<uint8_t> controller_id_;
241+
std::map<uint8_t /*id*/, std::string /*interface_name*/> controller_item_;
242+
238243
///// handler variable
239244
std::vector<HandlerVarType> hdl_trans_states_;
240245
std::vector<HandlerVarType> hdl_trans_commands_;
@@ -245,18 +250,42 @@ class DynamixelHardware : public
245250
std::vector<HandlerVarType> hdl_gpio_sensor_states_;
246251
std::vector<HandlerVarType> hdl_sensor_states_;
247252

253+
bool is_set_hdl_{false};
254+
248255
// joint <-> transmission matrix
249256
size_t num_of_joints_;
250257
size_t num_of_transmissions_;
251258
double ** transmission_to_joint_matrix_;
252259
double ** joint_to_transmission_matrix_;
253260

254261
/**
255-
* @brief Initializes the Dynamixel items.
262+
* @brief Helper function to initialize items for a specific type.
263+
* @param type_filter The type of items to initialize ("controller" or "dxl" or "sensor").
264+
* @return True if initialization was successful, false otherwise.
265+
*/
266+
bool initItems(const std::string & type_filter);
267+
268+
/**
269+
* @brief Helper function to retry writing an item to a Dynamixel device.
270+
* @param id The ID of the Dynamixel device.
271+
* @param item_name The name of the item to write.
272+
* @param value The value to write.
273+
* @return True if write was successful, false if timeout occurred.
274+
*/
275+
bool retryWriteItem(uint8_t id, const std::string & item_name, uint32_t value);
276+
277+
/**
278+
* @brief Initializes Dynamixel items.
256279
* @return True if initialization was successful, false otherwise.
257280
*/
258281
bool InitDxlItems();
259282

283+
/**
284+
* @brief Initializes the controller items.
285+
* @return True if initialization was successful, false otherwise.
286+
*/
287+
bool InitControllerItems();
288+
260289
/**
261290
* @brief Initializes the read items for Dynamixel.
262291
* @return True if initialization was successful, false otherwise.

package.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<?xml version='1.0' encoding='UTF-8'?>
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
23
<package format="3">
34
<name>dynamixel_hardware_interface</name>
4-
<version>1.4.1</version>
5+
<version>1.4.2</version>
56
<description>
67
ROS 2 package providing a hardware interface for controlling Dynamixel motors via the ROS 2 control framework.
78
</description>
@@ -10,6 +11,7 @@
1011
<author email="[email protected]">Hye-Jong KIM</author>
1112
<author email="[email protected]">Sungho Woo</author>
1213
<author email="[email protected]">Woojin Wie</author>
14+
<author email="[email protected]">Wonho Yun</author>
1315
<buildtool_depend>ament_cmake</buildtool_depend>
1416
<depend>rclcpp</depend>
1517
<depend>hardware_interface</depend>

param/dxl_model/dynamixel.model

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ Number Name
4444
4150 ym080_230_r099.model
4545
4170 ym080_230_a099.model
4646
35074 rh_p12_rn.model
47+
220 omy_hat.model
48+
230 omy_end.model

param/dxl_model/omy_end.model

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[type info]
2+
name value
3+
value_of_zero_radian_position 0
4+
value_of_max_radian_position 740
5+
value_of_min_radian_position -740
6+
min_radian -1.099
7+
max_radian 1.099
8+
9+
[control table]
10+
Address Size Data Name
11+
0 2 Model Number
12+
2 4 Model Information
13+
6 1 Firmware Version
14+
7 1 ID
15+
8 1 Baud Rate (Bus)
16+
10 1 Tool Analog Enable
17+
11 1 Tool Baud Rate
18+
12 1 Tool Protocol
19+
13 1 Tool ID
20+
14 1 Tool Status
21+
30 1 Button Status
22+
32 1 R LED
23+
33 1 G LED
24+
34 1 B LED
25+
36 2 Realtime Tick
26+
40 1 Digital Input
27+
41 1 Digital Output
28+
42 2 Analog Input1
29+
44 2 Analog Input2
30+
46 1 SyncTable Enable
31+
48 2 SyncTable Read Address
32+
52 2 SyncTable Read Size
33+
56 2 SyncTable Write Address
34+
60 2 SyncTable Write Size
35+
378 2 Indirect Address
36+
634 1 Indirect Data
37+
72 1 Hardware Error Status
38+
73 1 Moving
39+
74 2 Present Current
40+
76 4 Present Velocity
41+
80 4 Present Position
42+
84 4 Position Trajectory
43+
200 1 Torque Enable
44+
202 2 Goal Current
45+
204 4 Goal Velocity
46+
208 4 Goal Position
47+
378 2 Indirect Address 1
48+
634 1 Indirect Data 1
49+
378 2 Indirect Address Write
50+
634 1 Indirect Data Write
51+
402 2 Indirect Address Read
52+
646 1 Indirect Data Read

param/dxl_model/omy_hat.model

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[control table]
2+
Address Size Data Name
3+
0 2 Model Number
4+
2 4 Model Information
5+
6 1 Firmware Version
6+
7 1 ID
7+
8 1 Baud Rate (Bus)
8+
9 1 DXL Baud Rate
9+
10 2 DB Voltage
10+
12 1 DB Voltage Thresh
11+
14 2 DB Voltage D Gain
12+
16 2 DB Voltage I Gain
13+
18 2 DB Voltage P Gain
14+
20 1 SyncTable ID
15+
30 2 SyncTable Read Address
16+
50 2 SyncTable Read Size
17+
70 2 SyncTable Write Address
18+
90 2 SyncTable Write Size
19+
110 2 SyncTable Period
20+
112 2 Indirect Address
21+
512 1 Power Enable
22+
513 1 Voltage Control Enable
23+
514 1 Table Sync Enable
24+
515 1 R LED
25+
516 1 G LED
26+
517 1 B LED
27+
518 1 Status
28+
519 1 EMG Power Ctrl
29+
520 2 Realtime Tick
30+
522 2 Present Input Voltage
31+
524 2 Present Input Current
32+
550 1 Status Return Level
33+
560 1 SyncTable Read Data
34+
688 1 SyncTable Write Data
35+
816 1 Indirect Data

param/dxl_model/rh_p12_rn.model

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
name value
33
value_of_zero_radian_position 0
44
value_of_max_radian_position 740
5-
value_of_min_radian_position 0
6-
min_radian 0.0
5+
value_of_min_radian_position -740
6+
min_radian -1.099
77
max_radian 1.099
88

99
[control table]

0 commit comments

Comments
 (0)