Skip to content

Commit

Permalink
Merge pull request #54 from ROBOTIS-GIT/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ROBOTIS-Will authored Oct 29, 2020
2 parents 981c322 + 8defd3e commit ee03828
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 6 deletions.
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: "
Expand Down
52 changes: 52 additions & 0 deletions src/Dynamixel2Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions src/actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -475,18 +477,21 @@ 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;

case XL330_M288:
case XL330_M077:
case XM430_W210:
case XM430_W350:
case XH430_V210:
case XH430_V350:
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:
Expand Down
7 changes: 7 additions & 0 deletions src/actuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
#define XL320 (uint16_t)350
#endif

#ifndef XL330_M077
#define XL330_M077 (uint16_t)1190
#endif
#ifndef XL330_M288
#define XL330_M288 (uint16_t)1200
#endif

#ifndef XC430_W150
#define XC430_W150 (uint16_t)1070
#endif
Expand Down
1 change: 1 addition & 0 deletions src/utility/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/utility/slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ee03828

Please sign in to comment.