From 8fbf33b9626c87208c847a10af2c5d0f8a91ce23 Mon Sep 17 00:00:00 2001 From: yewon24 Date: Mon, 17 Aug 2020 11:46:40 +0900 Subject: [PATCH 1/5] add xl330 --- src/Dynamixel2Arduino.cpp | 52 +++++++++++++++++++++++++++++++++++++++ src/actuator.cpp | 10 +++++--- src/actuator.h | 7 ++++++ src/utility/config.h | 1 + 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/src/Dynamixel2Arduino.cpp b/src/Dynamixel2Arduino.cpp index f3660be..dd03307 100644 --- a/src/Dynamixel2Arduino.cpp +++ b/src/Dynamixel2Arduino.cpp @@ -31,6 +31,8 @@ const uint16_t model_number_table[] PROGMEM = { MX28_2, MX64_2, MX106_2, XL320, + XL330_M288, + XL330_M077, XL430_W250, XXL430_W250, XC430_W150, XC430_W240, @@ -297,6 +299,36 @@ bool Dynamixel2Arduino::setBaudrate(uint8_t id, uint32_t baudrate) } break; + case XL330_M288: + case XL330_M077: + switch(baudrate) + { + case 9600: + baud_idx = 0; + break; + case 57600: + baud_idx = 1; + break; + case 115200: + baud_idx = 2; + break; + case 1000000: + baud_idx = 3; + break; + case 2000000: + baud_idx = 4; + break; + case 3000000: + baud_idx = 5; + break; + case 4000000: + baud_idx = 6; + break; + default: + return false; + } + break; + case MX28_2: case MX64_2: case MX106_2: @@ -618,6 +650,8 @@ bool Dynamixel2Arduino::setOperatingMode(uint8_t id, uint8_t mode) case MX64_2: case MX106_2: + case XL330_M288: + case XL330_M077: case XM430_W210: case XM430_W350: case XH430_V210: @@ -1053,6 +1087,7 @@ const ModelDependencyFuncItemAndRangeInfo_t dependency_ctable_2_0_common[] PROGM #if (ENABLE_ACTUATOR_MX28_PROTOCOL2 \ || ENABLE_ACTUATOR_MX64_PROTOCOL2 \ || ENABLE_ACTUATOR_MX106_PROTOCOL2 \ + || ENABLE_ACTUATOR_XL330 \ || ENABLE_ACTUATOR_XC430 \ || ENABLE_ACTUATOR_XL430 \ || ENABLE_ACTUATOR_XM430 || ENABLE_ACTUATOR_XH430 \ @@ -1085,6 +1120,17 @@ const ModelDependencyFuncItemAndRangeInfo_t dependency_mx106_2[] PROGMEM = { {LAST_DUMMY_FUNC, ControlTableItem::LAST_DUMMY_ITEM, UNIT_RAW, 0, 0, 0} }; +const ModelDependencyFuncItemAndRangeInfo_t dependency_xl330_M288_M077[] PROGMEM = { +#if (ENABLE_ACTUATOR_XL330) + {SET_CURRENT, GOAL_CURRENT, UNIT_MILLI_AMPERE, -1150, 1150, 1}, + {GET_CURRENT, PRESENT_CURRENT, UNIT_MILLI_AMPERE, -1150, 1150, 1}, + + {SET_VELOCITY, GOAL_VELOCITY, UNIT_RPM, -2047, 2047, 0.229}, + {GET_VELOCITY, PRESENT_VELOCITY, UNIT_RPM, -2047, 2047, 0.229}, +#endif + {LAST_DUMMY_FUNC, ControlTableItem::LAST_DUMMY_ITEM, UNIT_RAW, 0, 0, 0} +}; + const ModelDependencyFuncItemAndRangeInfo_t dependency_xm430_w210_w350[] PROGMEM = { #if (ENABLE_ACTUATOR_XM430) {SET_CURRENT, GOAL_CURRENT, UNIT_MILLI_AMPERE, -1193, 1193, 2.69}, @@ -1374,6 +1420,12 @@ static ItemAndRangeInfo_t getModelDependencyFuncInfo(uint16_t model_num, uint8_t p_dep_ctable = dependency_mx106_2; break; + case XL330_M288: + case XL330_M077: + p_common_ctable = dependency_ctable_2_0_common; + p_dep_ctable = dependency_xl330_M288_M077; + break; + case XM430_W210: case XM430_W350: p_common_ctable = dependency_ctable_2_0_common; diff --git a/src/actuator.cpp b/src/actuator.cpp index 0dbc020..477245e 100644 --- a/src/actuator.cpp +++ b/src/actuator.cpp @@ -168,6 +168,7 @@ const ModelControlTableInfo_t control_table_2_0[] PROGMEM = { #if (ENABLE_ACTUATOR_MX28_PROTOCOL2 \ || ENABLE_ACTUATOR_MX64_PROTOCOL2 \ || ENABLE_ACTUATOR_MX106_PROTOCOL2 \ + || ENABLE_ACTUATOR_XL330 \ || ENABLE_ACTUATOR_XL430 \ || ENABLE_ACTUATOR_XC430 \ || ENABLE_ACTUATOR_XM430 || ENABLE_ACTUATOR_XH430 \ @@ -253,8 +254,9 @@ const ModelControlTableInfo_t xc430_xl430_control_table[] PROGMEM = { {ControlTableItem::LAST_DUMMY_ITEM, 0, 0} }; -const ModelControlTableInfo_t xmh430_control_table[] PROGMEM = { -#if (ENABLE_ACTUATOR_XM430 \ +const ModelControlTableInfo_t xmh430_xl330_control_table[] PROGMEM = { +#if (ENABLE_ACTUATOR_XL330 \ + || ENABLE_ACTUATOR_XM430 \ || ENABLE_ACTUATOR_XH430) {ControlTableItem::CURRENT_LIMIT, 38, 2}, {ControlTableItem::GOAL_CURRENT, 102, 2}, @@ -479,6 +481,8 @@ ControlTableItemInfo_t DYNAMIXEL::getControlTableItemInfo(uint16_t model_num, ui p_dep_ctable = xc430_xl430_control_table; break; + case XL330_M288: + case XL330_M077: case XM430_W210: case XM430_W350: case XH430_V210: @@ -486,7 +490,7 @@ ControlTableItemInfo_t DYNAMIXEL::getControlTableItemInfo(uint16_t model_num, ui case XH430_W210: case XH430_W350: p_common_ctable = control_table_2_0; - p_dep_ctable = xmh430_control_table; + p_dep_ctable = xmh430_xl330_control_table; break; case XM540_W150: diff --git a/src/actuator.h b/src/actuator.h index 030801c..aa20e3b 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -72,6 +72,13 @@ #define XL320 (uint16_t)350 #endif +#ifndef XL330_M288 +#define XL330_M288 (uint16_t)1190 +#endif +#ifndef XL330_M077 +#define XL330_M077 (uint16_t)1200 +#endif + #ifndef XC430_W150 #define XC430_W150 (uint16_t)1070 #endif diff --git a/src/utility/config.h b/src/utility/config.h index a38060b..bc28166 100644 --- a/src/utility/config.h +++ b/src/utility/config.h @@ -16,6 +16,7 @@ #define ENABLE_ACTUATOR_MX106_PROTOCOL2 1 #define ENABLE_ACTUATOR_XL320 1 +#define ENABLE_ACTUATOR_XL330 1 #define ENABLE_ACTUATOR_XL430 1 //Includes 2XL430 #define ENABLE_ACTUATOR_XC430 1 //Includes 2XC430 #define ENABLE_ACTUATOR_XM430 1 From 23bb7553d3fbeb22b8050d1954370ade94940bb5 Mon Sep 17 00:00:00 2001 From: yewon24 Date: Mon, 17 Aug 2020 12:00:13 +0900 Subject: [PATCH 2/5] add xl330 modified --- src/actuator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/actuator.h b/src/actuator.h index aa20e3b..38d4f02 100644 --- a/src/actuator.h +++ b/src/actuator.h @@ -72,11 +72,11 @@ #define XL320 (uint16_t)350 #endif -#ifndef XL330_M288 -#define XL330_M288 (uint16_t)1190 -#endif #ifndef XL330_M077 -#define XL330_M077 (uint16_t)1200 +#define XL330_M077 (uint16_t)1190 +#endif +#ifndef XL330_M288 +#define XL330_M288 (uint16_t)1200 #endif #ifndef XC430_W150 From 522f9a44f2cb63bc79eb05e044102cf72fa98d37 Mon Sep 17 00:00:00 2001 From: ROBOTIS-Will Date: Tue, 29 Sep 2020 21:43:12 +0900 Subject: [PATCH 3/5] fix missing 2xc info --- src/actuator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/actuator.cpp b/src/actuator.cpp index 0dbc020..b67f698 100644 --- a/src/actuator.cpp +++ b/src/actuator.cpp @@ -475,6 +475,7 @@ ControlTableItemInfo_t DYNAMIXEL::getControlTableItemInfo(uint16_t model_num, ui case XC430_W240: case XL430_W250: case XXL430_W250: + case XXC430_W250: p_common_ctable = control_table_2_0; p_dep_ctable = xc430_xl430_control_table; break; From 862adf7d0bd454f123d3048fd972d32346696a01 Mon Sep 17 00:00:00 2001 From: Kei Date: Tue, 13 Oct 2020 11:59:59 +0900 Subject: [PATCH 4/5] Fixed variable typo. --- src/utility/slave.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility/slave.cpp b/src/utility/slave.cpp index 55442cb..c3d0289 100644 --- a/src/utility/slave.cpp +++ b/src/utility/slave.cpp @@ -55,7 +55,7 @@ Slave::Slave(const uint16_t model_num, float protocol_ver) bool Slave::setPacketBuffer(uint8_t* p_buf, uint16_t buf_capacity) { - if(p_packet_buf_ == nullptr){ + if(p_buf == nullptr){ last_lib_err_ = DXL_LIB_ERROR_NULLPTR; return false; } From 1377d2e63582826440d3a94da40de0584a783575 Mon Sep 17 00:00:00 2001 From: ROBOTIS-Will Date: Mon, 26 Oct 2020 17:11:57 +0900 Subject: [PATCH 5/5] update ci environment --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 673fe8c..98a120a 100644 --- a/install.sh +++ b/install.sh @@ -10,7 +10,7 @@ fi # this will be eval'd in the functions below because arrays can't be exported # For creating a new main platform, please refer to https://arduino.github.io/arduino-cli/latest/platform-specification/#hardware-folders-structure # and https://arduino.github.io/arduino-cli/latest/platform-specification/#boardstxt -export MAIN_PLATFORMS='declare -A main_platforms=([uno]="arduino:avr:uno" [mega2560]="arduino:avr:mega:cpu=atmega2560" [leonardo]="arduino:avr:leonardo" [due]="arduino:sam:arduino_due_x" [zero]="arduino:samd:arduino_zero_native" [mzero]="arduino:samd:mzero_bl" [mzeropro]="arduino:samd:mzero_pro_bl" [mkrzero]="arduino:samd:mkrzero" [mkr1000]="arduino:samd:mkr1000" [mkrwifi1010]="arduino:samd:mkrwifi1010" [opencr]="OpenCR:OpenCR:OpenCR" [portenta]="arduino-beta:mbed:envie_m7")' +export MAIN_PLATFORMS='declare -A main_platforms=([uno]="arduino:avr:uno" [mega2560]="arduino:avr:mega:cpu=atmega2560" [leonardo]="arduino:avr:leonardo" [due]="arduino:sam:arduino_due_x" [zero]="arduino:samd:arduino_zero_native" [mzero]="arduino:samd:mzero_bl" [mzeropro]="arduino:samd:mzero_pro_bl" [mkrzero]="arduino:samd:mkrzero" [mkr1000]="arduino:samd:mkr1000" [mkrwifi1010]="arduino:samd:mkrwifi1010" [opencr]="OpenCR:OpenCR:OpenCR" [portenta]="arduino:mbed:envie_m7")' # make display available for arduino CLI /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 @@ -55,7 +55,7 @@ DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1) if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi echo -n "INSTALL Portenta H7: " -DEPENDENCY_OUTPUT=$(arduino --install-boards arduino-beta:mbed 2>&1) +DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:mbed 2>&1) if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi echo -n "INSTALL OpenCR: "