I'm not able to change the direction of my mx-64 motor when using velocity control with arduino, I've attached the file with the setup but essentially "dxl.setGoalVelocity(DXL_ID, 28);" produces the expected ccw movement but with "dxl.setGoalVelocity(DXL_ID, -28);" the motor doesn't move. Am I missing something with this? Thanks.
|
|
2021-07-02 08:51:41 |
| telfer | |
It seems that the MX series (DYNAMIXEL Protocol 1.0) does not support percentage or direct rpm control, but raw value control only. ( Not guaranteed, This is my personal words based on my test, it could be a bug.)
To achieve your goal, you may want to either manipulate raw values as below code, or use MX(2.0) firmware to fully use the features in the library (Highly recommended),
In the mean time, I will look some code in the library whether it's a bug and report to engineers,
// Raw
if (dxl.setGoalVelocity(DXL_ID, CW+100) == true){
delay (1000);
DEBUG_SERIAL.print("Raw, SetGoalVel Success (CW): ");
DEBUG_SERIAL.println(dxl.getPresentVelocity(1));
}else{
DEBUG_SERIAL.print("Raw, SetGoalVel Failed, Last lib err code:: ");
DEBUG_SERIAL.println(dxl.getLastLibErrCode());
}
for (int i = 0; i <= 0; i++ )
{
DEBUG_SERIAL.print("Wait.. : ");
DEBUG_SERIAL.print(i);DEBUG_SERIAL.print("sec");
DEBUG_SERIAL.println("");
delay (500);
}
if (dxl.setGoalVelocity(DXL_ID, CCW+100) == true){
delay (1000);
DEBUG_SERIAL.print("Raw, SetGoalVel Success (CCW): ");
DEBUG_SERIAL.println(dxl.getPresentVelocity(1));
}else{
DEBUG_SERIAL.print("Raw, SetGoalVel Failed, Last lib err code:: ");
DEBUG_SERIAL.println(dxl.getLastLibErrCode());
}
for (int i = 0; i <= 3; i++ )
{
DEBUG_SERIAL.print("Wait.. : ");
DEBUG_SERIAL.print(i);DEBUG_SERIAL.print("sec");
DEBUG_SERIAL.println("");
delay (1000);
}
|
|
2021-07-05 15:12:58 |
| davidpark | |