@@ -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.
0 commit comments