From 88ee22900dd22dd7a6a86f2c2634ed4355cf4177 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 25 Feb 2025 13:02:33 +0900 Subject: [PATCH 01/12] Fix for Arduino Uno R4 build error --- src/actuator.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/actuator.h b/src/actuator.h index ef22371..b448e40 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -7,6 +7,11 @@ #define DXL_TORQUE_ON 1 #define DXL_TORQUE_OFF 0 +#if defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_MINIMA) +#undef LED_RED +#undef LED_BLUE +#endif + // The reason for checking #ifndef here is to avoid conflict with Dynamixel SDK. #ifndef AX12A #define AX12A (uint16_t)12 From 022a601020e7dc4aafc89aaaec1d9b8767ce4c3e Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 25 Feb 2025 13:54:41 +0900 Subject: [PATCH 02/12] Fix for STM32 based arduino build error --- src/actuator.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/actuator.h b/src/actuator.h index b448e40..52f2a26 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -7,8 +7,9 @@ #define DXL_TORQUE_ON 1 #define DXL_TORQUE_OFF 0 -#if defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_MINIMA) +#if defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_MINIMA) || defined(ARDUINO_ARCH_STM32) #undef LED_RED +#undef LED_GREEN #undef LED_BLUE #endif From fd013614b1b85f4f028e463c5dd5f328c2b8731b Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 18 Mar 2025 16:12:08 +0900 Subject: [PATCH 03/12] Fixed build error on ARM Cortex-M based Arduino boards. --- src/Dynamixel2Arduino.cpp | 6 +++--- src/actuator.cpp | 12 ++++++------ src/actuator.h | 12 +++--------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index 2592292..67ecfec 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -610,10 +610,10 @@ bool Dynamixel2Arduino::setLedState(uint8_t id, bool state) case PRO_M54P_040_S250_R: case PRO_M54P_060_S250_R: if (state == false) { - writeControlTableItem(ControlTableItem::LED_GREEN, id, state); - writeControlTableItem(ControlTableItem::LED_BLUE, id, state); + writeControlTableItem(ControlTableItem::DXL_LED_GREEN, id, state); + writeControlTableItem(ControlTableItem::DXL_LED_BLUE, id, state); } - ret = writeControlTableItem(ControlTableItem::LED_RED, id, state); + ret = writeControlTableItem(ControlTableItem::DXL_LED_RED, id, state); break; default: diff --git a/src/actuator.cpp b/src/actuator.cpp index 59a5319..6f3450b 100644 --- a/src/actuator.cpp +++ b/src/actuator.cpp @@ -319,9 +319,9 @@ const ModelControlTableInfo_t pro_r_control_table[] PROGMEM = { {ControlTableItem::SHUTDOWN, 48, 1}, {ControlTableItem::TORQUE_ENABLE, 562, 1}, - {ControlTableItem::LED_RED, 563, 1}, - {ControlTableItem::LED_GREEN, 564, 1}, - {ControlTableItem::LED_BLUE, 565, 1}, + {ControlTableItem::DXL_LED_RED, 563, 1}, + {ControlTableItem::DXL_LED_GREEN, 564, 1}, + {ControlTableItem::DXL_LED_BLUE, 565, 1}, {ControlTableItem::VELOCITY_I_GAIN, 586, 2}, {ControlTableItem::VELOCITY_P_GAIN, 588, 2}, {ControlTableItem::POSITION_P_GAIN, 594, 2}, @@ -377,9 +377,9 @@ const ModelControlTableInfo_t pro_ra_pro_plus_control_table[] PROGMEM = { {ControlTableItem::SHUTDOWN, 63, 1}, {ControlTableItem::TORQUE_ENABLE, 512, 1}, - {ControlTableItem::LED_RED, 513, 1}, - {ControlTableItem::LED_GREEN, 514, 1}, - {ControlTableItem::LED_BLUE, 515, 1}, + {ControlTableItem::DXL_LED_RED, 513, 1}, + {ControlTableItem::DXL_LED_GREEN, 514, 1}, + {ControlTableItem::DXL_LED_BLUE, 515, 1}, {ControlTableItem::STATUS_RETURN_LEVEL, 516, 1}, {ControlTableItem::REGISTERED_INSTRUCTION, 517, 1}, {ControlTableItem::HARDWARE_ERROR_STATUS, 518, 1}, diff --git a/src/actuator.h b/src/actuator.h index 52f2a26..83fdbbb 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -7,12 +7,6 @@ #define DXL_TORQUE_ON 1 #define DXL_TORQUE_OFF 0 -#if defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_MINIMA) || defined(ARDUINO_ARCH_STM32) -#undef LED_RED -#undef LED_GREEN -#undef LED_BLUE -#endif - // The reason for checking #ifndef here is to avoid conflict with Dynamixel SDK. #ifndef AX12A #define AX12A (uint16_t)12 @@ -338,9 +332,9 @@ namespace ControlTableItem{ TORQUE_ENABLE, LED, - LED_RED, - LED_GREEN, - LED_BLUE, + DXL_LED_RED, + DXL_LED_GREEN, + DXL_LED_BLUE, REGISTERED_INSTRUCTION, HARDWARE_ERROR_STATUS, VELOCITY_P_GAIN, From a5782fd09ddba79efad9a784f613d2631ae7c634 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 18 Mar 2025 16:23:55 +0900 Subject: [PATCH 04/12] Fixed naming inconsistency between LED and DXL_LED_* items --- src/Dynamixel2Arduino.cpp | 2 +- src/actuator.cpp | 10 +++++----- src/actuator.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index 67ecfec..6222112 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -617,7 +617,7 @@ bool Dynamixel2Arduino::setLedState(uint8_t id, bool state) break; default: - ret = writeControlTableItem(ControlTableItem::LED, id, state); + ret = writeControlTableItem(ControlTableItem::DXL_LED, id, state); break; } diff --git a/src/actuator.cpp b/src/actuator.cpp index 6f3450b..7cd1dbc 100644 --- a/src/actuator.cpp +++ b/src/actuator.cpp @@ -33,7 +33,7 @@ const ModelControlTableInfo_t control_table_1_0[] PROGMEM = { {ControlTableItem::SHUTDOWN, 18, 1}, {ControlTableItem::TORQUE_ENABLE, 24, 1}, - {ControlTableItem::LED, 25, 1}, + {ControlTableItem::DXL_LED, 25, 1}, {ControlTableItem::CW_COMPLIANCE_MARGIN, 26, 1}, {ControlTableItem::CCW_COMPLIANCE_MARGIN, 27, 1}, {ControlTableItem::CW_COMPLIANCE_SLOPE, 28, 1}, @@ -85,7 +85,7 @@ const ModelControlTableInfo_t control_table_1_1[] PROGMEM = { {ControlTableItem::RESOLUTION_DIVIDER, 22, 1}, {ControlTableItem::TORQUE_ENABLE, 24, 1}, - {ControlTableItem::LED, 25, 1}, + {ControlTableItem::DXL_LED, 25, 1}, {ControlTableItem::D_GAIN, 26, 1}, {ControlTableItem::I_GAIN, 27, 1}, {ControlTableItem::P_GAIN, 28, 1}, @@ -144,7 +144,7 @@ const ModelControlTableInfo_t xl320_control_table[] PROGMEM = { {ControlTableItem::SHUTDOWN, 18, 1}, {ControlTableItem::TORQUE_ENABLE, 24, 1}, - {ControlTableItem::LED, 25, 1}, + {ControlTableItem::DXL_LED, 25, 1}, {ControlTableItem::D_GAIN, 27, 1}, {ControlTableItem::I_GAIN, 28, 1}, {ControlTableItem::P_GAIN, 29, 1}, @@ -197,7 +197,7 @@ const ModelControlTableInfo_t control_table_2_0[] PROGMEM = { {ControlTableItem::SHUTDOWN, 63, 1}, {ControlTableItem::TORQUE_ENABLE, 64, 1}, - {ControlTableItem::LED, 65, 1}, + {ControlTableItem::DXL_LED, 65, 1}, {ControlTableItem::STATUS_RETURN_LEVEL, 68, 1}, {ControlTableItem::REGISTERED_INSTRUCTION, 69, 1}, {ControlTableItem::HARDWARE_ERROR_STATUS, 70, 1}, @@ -475,7 +475,7 @@ const ModelControlTableInfo_t y_control_table[] PROGMEM = { {ControlTableItem::PROFILE_ACCELERATION_TIME, 248, 4}, {ControlTableItem::PROFIIE_TIME, 252, 4}, {ControlTableItem::TORQUE_ENABLE, 512, 1}, - {ControlTableItem::LED, 513, 1}, + {ControlTableItem::DXL_LED, 513, 1}, {ControlTableItem::PWM_OFFSET, 516, 2}, {ControlTableItem::CURRENT_OFFSET, 518, 2}, {ControlTableItem::VELOCITY_OFFSET, 520, 4}, diff --git a/src/actuator.h b/src/actuator.h index 83fdbbb..be37d48 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -331,7 +331,7 @@ namespace ControlTableItem{ SHUTDOWN, TORQUE_ENABLE, - LED, + DXL_LED, DXL_LED_RED, DXL_LED_GREEN, DXL_LED_BLUE, From 7d72cc6c01851c11ef7bf3de56a5864632c04ec6 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Thu, 27 Mar 2025 10:54:44 +0900 Subject: [PATCH 05/12] [Feature] Added API for HardwareError Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.cpp | 14 ++++++++++++++ src/Dynamixel2Arduino.h | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index 6222112..39bbf97 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -915,6 +915,20 @@ bool Dynamixel2Arduino::getTorqueEnableStat(uint8_t id) return ret; } +uint8_t Dynamixel2Arduino::getHardwareError(uint8_t id) +{ + uint16_t model_num = getModelNumberFromTable(id); + + if(model_num == AX12A || model_num == AX12W || model_num == AX18A || model_num == DX113 || model_num == DX116 || model_num == DX117 || model_num == RX10 || model_num == RX24F || model_num == RX28 || model_num == RX64 || model_num == EX106 || model_num == MX12W || model_num == MX28 || model_num == MX64 || model_num == MX106 || model_num == XL320) + { + setLastLibErrCode(DXL_LIB_ERROR_INVAILD_PROTOCOL_VERSION); + + return 0; + } + + return readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id); +} + int32_t Dynamixel2Arduino::readControlTableItem(uint8_t item_idx, uint8_t id, uint32_t timeout) { int32_t ret = 0; diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index 29a6b52..168a662 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -385,7 +385,20 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master * @return It returns the Torque Enable data read from DXL control table item. * If the Torque is On, true(1) is returned. Otherwise false(0) is returned. */ - bool getTorqueEnableStat(uint8_t id); + bool getTorqueEnableStat(uint8_t id); + + /** + * @brief It is API for getting hardware error status of DYNAMIXEL. + * @code + * const int DXL_DIR_PIN = 2; + * Dynamixel2Arduino dxl(Serial1, DXL_DIR_PIN); + * Serial.print(dxl.getHardwareError(1)); + * @endcode + * @param id DYNAMIXEL Actuator's ID. + * @return It returns 0 on no error, value any other than 0 on hardware error. + * If the read fails, 0 is returned. Whether or not this is an actual value can be confirmed with @getLastLibErrCode(). + */ + uint8_t getHardwareError(uint8_t id); /** * @brief It is API for getting data of a DYNAMIXEL control table item. @@ -441,8 +454,6 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master bool setPositionPIDGain(uint8_t id, uint16_t p_gain, uint16_t i_gain, uint16_t d_gain); bool setVelocityPIGain(uint8_t id, uint16_t p_gain, uint16_t i_gain); bool setFeedForwardGain(uint8_t id, uint16_t fisrt_gain, uint16_t second_gain); - - uint8_t getHardwareError(uint8_t id); // https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/issues/73 uint8_t getOperatingMode(uint8_t id); From 2c28dbe9c8f1e7c735b3de2fdbf4658a9e90efe3 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Thu, 27 Mar 2025 10:58:30 +0900 Subject: [PATCH 06/12] [Fix] Fixed library error code for not supported models for getHardwareError() Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index 39bbf97..4fd2cd7 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -918,15 +918,18 @@ bool Dynamixel2Arduino::getTorqueEnableStat(uint8_t id) uint8_t Dynamixel2Arduino::getHardwareError(uint8_t id) { uint16_t model_num = getModelNumberFromTable(id); + uint8_t ret = 0; if(model_num == AX12A || model_num == AX12W || model_num == AX18A || model_num == DX113 || model_num == DX116 || model_num == DX117 || model_num == RX10 || model_num == RX24F || model_num == RX28 || model_num == RX64 || model_num == EX106 || model_num == MX12W || model_num == MX28 || model_num == MX64 || model_num == MX106 || model_num == XL320) { - setLastLibErrCode(DXL_LIB_ERROR_INVAILD_PROTOCOL_VERSION); - - return 0; + setLastLibErrCode(DXL_LIB_ERROR_NOT_SUPPORTED); + } + else + { + ret = (uint8_t)readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id); } - return readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id); + return ret; } int32_t Dynamixel2Arduino::readControlTableItem(uint8_t item_idx, uint8_t id, uint32_t timeout) From 7e7ef367a82e2a17a0891d477d4877a688439f26 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Thu, 27 Mar 2025 11:25:01 +0900 Subject: [PATCH 07/12] [Fix] Added model identification logic and DYNAMIXEL-Y support for getHardwareError() Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index 4fd2cd7..bd36e5c 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -920,10 +920,20 @@ uint8_t Dynamixel2Arduino::getHardwareError(uint8_t id) uint16_t model_num = getModelNumberFromTable(id); uint8_t ret = 0; + if(model_num == UNREGISTERED_MODEL){ + if(setModelNumber(id, getModelNumber(id)) == true){ + model_num = getModelNumberFromTable(id); + } + } + if(model_num == AX12A || model_num == AX12W || model_num == AX18A || model_num == DX113 || model_num == DX116 || model_num == DX117 || model_num == RX10 || model_num == RX24F || model_num == RX28 || model_num == RX64 || model_num == EX106 || model_num == MX12W || model_num == MX28 || model_num == MX64 || model_num == MX106 || model_num == XL320) { setLastLibErrCode(DXL_LIB_ERROR_NOT_SUPPORTED); } + else if(model_num == YM070_210_M001_RH || model_num == YM070_210_B001_RH || model_num == YM070_210_R051_RH || model_num == YM070_210_R099_RH || model_num == YM070_210_A051_RH || model_num == YM070_210_A099_RH || model_num == YM080_230_M001_RH || model_num == YM080_230_B001_RH || model_num == YM080_230_R051_RH || model_num == YM080_230_R099_RH || model_num == YM080_230_A051_RH || model_num == YM080_230_A099_RH) + { + ret = (uint8_t)readControlTableItem(ControlTableItem::ERROR_CODE, id); + } else { ret = (uint8_t)readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id); From 39b041b1ccb65a72e4e0fd834127148a4491b6d5 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 13 May 2025 11:22:38 +0900 Subject: [PATCH 08/12] [Fix] Added error code identifiers Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index 168a662..8265b26 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -48,6 +48,37 @@ enum D2ALibErrorCode D2A_LIB_ERROR_UNKNOWN_MODEL_NUMBER }; +enum HardwareErrorCode +{ + INPUT_VOLTAGE_ERROR = 0x80, + OVERHEATING_ERROR = 0x20, + MOTOR_ENCODER_ERROR = 0x10, + ELECTRICAL_SHOCK_ERROR = 0x08, + OVERLOAD_ERROR = 0x04 +}; + +enum DYErrorCode +{ + NO_ERROR = 0, + OVER_VOLTAGE_ERROR, + LOW_VOLTAGE_ERROR, + INVERTER_OVERHEATING_ERROR, + MOTOR_OVERHEATING_ERROR, + OVERLOAD_ERROR, + INVERTER_ERROR, + BATTERY_WARNING, + BATTERY_ERROR, + MAGNET_ERROR, + MULTI_TURN_ERROR, + ENCODER_ERROR, + HALL_SENSOR_ERROR, + CALIBRATION_ERROR, + FOLLOWING_ERROR, + BUS_WATCHDOG_ERROR, + OVER_SPEED_ERROR, + POSITION_LIMIT_REACHED_ERROR +}; + class Dynamixel2Arduino : public DYNAMIXEL::Master { public: From 43a0622f441cff572a35ec03b30e9e122dd9c165 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 13 May 2025 12:35:33 +0900 Subject: [PATCH 09/12] [Fix] Fixed error code identifier overlap Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index 8265b26..f2e1a15 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -59,24 +59,24 @@ enum HardwareErrorCode enum DYErrorCode { - NO_ERROR = 0, - OVER_VOLTAGE_ERROR, - LOW_VOLTAGE_ERROR, - INVERTER_OVERHEATING_ERROR, - MOTOR_OVERHEATING_ERROR, - OVERLOAD_ERROR, - INVERTER_ERROR, - BATTERY_WARNING, - BATTERY_ERROR, - MAGNET_ERROR, - MULTI_TURN_ERROR, - ENCODER_ERROR, - HALL_SENSOR_ERROR, - CALIBRATION_ERROR, - FOLLOWING_ERROR, - BUS_WATCHDOG_ERROR, - OVER_SPEED_ERROR, - POSITION_LIMIT_REACHED_ERROR + DY_NO_ERROR = 0, + DY_OVER_VOLTAGE_ERROR, + DY_LOW_VOLTAGE_ERROR, + DY_INVERTER_OVERHEATING_ERROR, + DY_MOTOR_OVERHEATING_ERROR, + DY_OVERLOAD_ERROR, + DY_INVERTER_ERROR, + DY_BATTERY_WARNING, + DY_BATTERY_ERROR, + DY_MAGNET_ERROR, + DY_MULTI_TURN_ERROR, + DY_ENCODER_ERROR, + DY_HALL_SENSOR_ERROR, + DY_CALIBRATION_ERROR, + DY_FOLLOWING_ERROR, + DY_BUS_WATCHDOG_ERROR, + DY_OVER_SPEED_ERROR, + DY_POSITION_LIMIT_REACHED_ERROR }; class Dynamixel2Arduino : public DYNAMIXEL::Master From e052572c7a12985f6e8e2a9eebc1d9f8d588ba4b Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 13 May 2025 12:38:15 +0900 Subject: [PATCH 10/12] [Fix] Fixed bit orientation for HardwareErrorCode identifier Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index f2e1a15..b70b046 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -50,11 +50,11 @@ enum D2ALibErrorCode enum HardwareErrorCode { - INPUT_VOLTAGE_ERROR = 0x80, - OVERHEATING_ERROR = 0x20, - MOTOR_ENCODER_ERROR = 0x10, - ELECTRICAL_SHOCK_ERROR = 0x08, - OVERLOAD_ERROR = 0x04 + INPUT_VOLTAGE_ERROR = 0x01, + OVERHEATING_ERROR = 0x04, + MOTOR_ENCODER_ERROR = 0x08, + ELECTRICAL_SHOCK_ERROR = 0x10, + OVERLOAD_ERROR = 0x20 }; enum DYErrorCode From 486642edbbce645f568067f9588d00e659145786 Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 13 May 2025 12:41:42 +0900 Subject: [PATCH 11/12] [Fix] Fixed example code sniffet for getHardwareError for better representation of its use Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index b70b046..7a50570 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -423,7 +423,9 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master * @code * const int DXL_DIR_PIN = 2; * Dynamixel2Arduino dxl(Serial1, DXL_DIR_PIN); - * Serial.print(dxl.getHardwareError(1)); + * if (dxl.getHardwareError(1) & INPUT_VOLTAGE_ERROR == INPUT_VOLTAGE_ERROR) { + * Serial.println("Input Voltage Error"); + * } * @endcode * @param id DYNAMIXEL Actuator's ID. * @return It returns 0 on no error, value any other than 0 on hardware error. From 521de0ca55f5b20601f985af7570969cc9aa71fd Mon Sep 17 00:00:00 2001 From: Jonghee Son Date: Tue, 13 May 2025 12:46:20 +0900 Subject: [PATCH 12/12] [Fix] Fixed example code sniffet for getHardwareError Signed-off-by: Jonghee Son --- src/Dynamixel2Arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dynamixel2Arduino.h b/src/Dynamixel2Arduino.h index 7a50570..45bfbb0 100644 --- a/src/Dynamixel2Arduino.h +++ b/src/Dynamixel2Arduino.h @@ -423,7 +423,7 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master * @code * const int DXL_DIR_PIN = 2; * Dynamixel2Arduino dxl(Serial1, DXL_DIR_PIN); - * if (dxl.getHardwareError(1) & INPUT_VOLTAGE_ERROR == INPUT_VOLTAGE_ERROR) { + * if ((dxl.getHardwareError(1) & INPUT_VOLTAGE_ERROR) == INPUT_VOLTAGE_ERROR) { * Serial.println("Input Voltage Error"); * } * @endcode