xm430-w350에 아두이노 라이브러리로 사용하고 있습니다.
통신 속도를 115200으로 변경할려고 begin(115200)으로 하고, getPortBaud()를 하면 115200으로 나옵니다.
그러나 setBaudrate()를 하면 fail이 되고, ping을 해도 xm430이 응답하지 않습니다.
xm430-w350에 아두이노 라이브러리로 사용하고 있습니다.
통신 속도를 115200으로 변경할려고 begin(115200)으로 하고, getPortBaud()를 하면 115200으로 나옵니다.
그러나 setBaudrate()를 하면 fail이 되고, ping을 해도 xm430이 응답하지 않습니다.
You’ll also need to change the communication speed on the actuator itself, either by using the DYNAMIXEL Wizard configuration tool or by changing the Baud Rate setting inside your Arduino sketch
dxl.begin(115200);
을 실행하고, dxl.getPortBaud()로 읽어보면 115200이 나옵니다.
그러나 통신은 되지 않습니다.
serial 통신 속도를 57600으로 다시 낮추면 통신이 됩니다.
그래서 dxl.setBaudrate(SERVO_SETUP_ID, 115200)으로 명령어를 주면 false가 리턴 됩니다.
무엇이 문제일까요?
The DXL Baud Rate is an EEPROM parameter
So you need to TorqueOff first, set the baud rate, then turn TorqueOn back to set the new value in EEPROM, something like this
torqueOff 하고 TorqueOn해도 변경아 안됩니다. 제품마다 관련 value를 변경하지 못하도록 설정해서 출하가 되기도 하나요?
What kind of controllers are you using? 904-C or RB-150? Or something else? Can you also share your code?
Below is a picture of my setup using OpenRB-150 and XL-430.
Also enclosed is a complete sketch that I used to convert my current DXL configuration using 1 Mbps to 115.2 Kbps (for your case your DXL is defaulted to 57.6 Kbps right? - so adjust the code as needed). Please note that there is a code section that needs to be used only once (to set it to 115.2 Kbps) - afterwards you need to comment out that code section.
#include <Dynamixel2Arduino.h>
// #define DXL_SERIAL Serial3 //OpenCM9.04 DXL Serial Port (Serial1 for DXL port on OpenCM 9.04 board, Serial3 on 485-EXP)
#define DXL_SERIAL Serial1 //OpenRB-150
#define DEBUG_SERIAL Serial
const int DXL_DIR_PIN = -1; //= -1 for OpenRB-150 - for OpenCM9.04 DIR PIN. (28 for DXL port on the OpenCM 9.04 board, 22 for 485-EXP)
const uint8_t DXL_ID = 1;
const float DXL_PROTOCOL_VERSION = 2.0; // 1.0 for AX-12; 2.0 for X series
Dynamixel2Arduino dxl(DXL_SERIAL, DXL_DIR_PIN);
//This namespace is required to use Control table item names
using namespace ControlTableItem;
void setup() {
// put your setup code here, to run once:
// The below code section is needed only ONCE to set your XL Actuators to 115200
// It is actually easier to use U2D2 and Dynamixel Wizard to do this job
dxl.begin(1000000); // currently my DXL port and actuators are set to 1 Mbps - yours may be set to 57.6 Kbps
// Turn off torque when configuring items in EEPROM area
dxl.torqueOff(DXL_ID);
dxl.setBaudrate(DXL_ID, 115200); // now setting Actuator XL-430 Baud Rate to 115200
dxl.torqueOn(DXL_ID);
delay(1000);
// End of code section needed only ONCE.
// From this point onward is the "normal" set up to be used (once your DXL Comm. Baud Rate is set to 115200)
// Use UART port of DYNAMIXEL Shield to debug.
DEBUG_SERIAL.begin(115200); // USB port - NOT to be confused with DXL Port
// Set DXL Port baudrate - This has to match with "new" DYNAMIXEL baudrate.
dxl.begin(115200); // set DXL Port to 115200
dxl.torqueOff(DXL_ID);
// Set Port Protocol Version. This has to match with DYNAMIXEL protocol version.
dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
dxl.setOperatingMode(DXL_ID, OP_POSITION);
dxl.torqueOn(DXL_ID);
// Get DYNAMIXEL information
// dxl.ping(DXL_ID);
// Limit the maximum velocity in Position Control Mode. Use 0 for Max speed
dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, 70);
}
void loop() {
// put your main code here, to run repeatedly:
// Please refer to e-Manual(http://emanual.robotis.com/docs/en/parts/interface/dynamixel_shield/) for available range of value.
// Set Goal Position in RAW value
dxl.setGoalPosition(DXL_ID, 1000);
int i_present_position = 0;
float f_present_position = 0.0;
while (abs(1000 - i_present_position) > 10)
{
i_present_position = dxl.getPresentPosition(DXL_ID);
DEBUG_SERIAL.print("Present_Position(raw) : ");
DEBUG_SERIAL.println(i_present_position);
}
delay(1000);
// Set Goal Position in DEGREE value
dxl.setGoalPosition(DXL_ID, 5.7, UNIT_DEGREE);
while (abs(5.7 - f_present_position) > 2.0)
{
f_present_position = dxl.getPresentPosition(DXL_ID, UNIT_DEGREE);
DEBUG_SERIAL.print("Present_Position(degree) : ");
DEBUG_SERIAL.println(f_present_position);
}
delay(1000);
}