@@ -191,6 +191,8 @@ class DynamixelHardware : public
191
191
bool is_read_in_error_{false };
192
192
bool is_write_in_error_{false };
193
193
194
+ bool global_torque_enable_{true };
195
+
194
196
bool use_revolute_to_prismatic_{false };
195
197
std::string conversion_dxl_name_{" " };
196
198
std::string conversion_joint_name_{" " };
@@ -235,6 +237,9 @@ class DynamixelHardware : public
235
237
std::vector<uint8_t > sensor_id_;
236
238
std::map<uint8_t /* id*/ , std::string /* interface_name*/ > sensor_item_;
237
239
240
+ std::vector<uint8_t > controller_id_;
241
+ std::map<uint8_t /* id*/ , std::string /* interface_name*/ > controller_item_;
242
+
238
243
// /// handler variable
239
244
std::vector<HandlerVarType> hdl_trans_states_;
240
245
std::vector<HandlerVarType> hdl_trans_commands_;
@@ -245,18 +250,42 @@ class DynamixelHardware : public
245
250
std::vector<HandlerVarType> hdl_gpio_sensor_states_;
246
251
std::vector<HandlerVarType> hdl_sensor_states_;
247
252
253
+ bool is_set_hdl_{false };
254
+
248
255
// joint <-> transmission matrix
249
256
size_t num_of_joints_;
250
257
size_t num_of_transmissions_;
251
258
double ** transmission_to_joint_matrix_;
252
259
double ** joint_to_transmission_matrix_;
253
260
254
261
/* *
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.
256
279
* @return True if initialization was successful, false otherwise.
257
280
*/
258
281
bool InitDxlItems ();
259
282
283
+ /* *
284
+ * @brief Initializes the controller items.
285
+ * @return True if initialization was successful, false otherwise.
286
+ */
287
+ bool InitControllerItems ();
288
+
260
289
/* *
261
290
* @brief Initializes the read items for Dynamixel.
262
291
* @return True if initialization was successful, false otherwise.
0 commit comments