I am using multiple actuators in Position Mode and I want want to make the Velocities of all the actuators to 0 when I press Emergency stop.
I tried using making the Goal position of all the actuators to the present position but it is not that smooth and gives jerky behaviours.
Any suggestions to make all the Velocities to 0 regardless of the Actuator Mode(Position/Velocity control).
All control mode is governed by Goal PWM(100) and you might use this value to implement an emergency feature.
If the Dynamixel is connected to an apparatus with some load, this will have a similar effect to the engine brake.
I've attached a plastic stick to the horn and this looked like a sudden stop.
I prefer this behavior as an Emergency Stop which will damage the system, but saves life :)
But if you need more smooth motion, you can decrease Goal PWM value over the time.
I put below code right after the beginning of do-while loop of the read_write example which created smooth motion.
Please test the code on a separate test bed.
ch = Serial.read();
if (ch == 's') // Emergency Stop
int pwm_value = 885; // default maximum PWM Limit value
packetHandler->write2ByteTxRx(portHandler, DXL_ID, 100, pwm_value, &dxl_error);
pwm_value -= 20;
} while (pwm_value > 10);
packetHandler->write2ByteTxRx(portHandler, DXL_ID, 100, 0, &dxl_error);
else if (ch == 'r') // Resume
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, DXL_ID, 100, 885, &dxl_error);
if (dxl_comm_result != COMM_SUCCESS)
else if (dxl_error != 0)