Motor overrun errors

Use the following template to help create your post:

  1. What model(s) of servo are you using?
    3 - MX-28 AT (2.0) motors connected in a daisy chain.

  2. Describe your control environment. Include the controller or interface, operating system (and version #) of your computer, and how you are powering your robot.
    U2D2 controller, Windows 10 OS, SMPS 12 volts by Dynamixel

  3. For programming posts, state any libraries or example code you are using. For software posts, be clear about which version of software! R+ Task 3.0, R+ Task 2.0, and RoboPlus Task (“1.0”) can have very different troubleshooting steps, as just one example.
    I used sync-readwrite code and tweaked it according to my requirement. I will attach a snippet of my code here. The issue is my motors are working fine when I am running the default code whereas when I run my code, one of the motors is showing a lag in the movement.

Following are the equations to control the motors :

alpha = 90/(2tanh(2.7)) * tanh(2.7sin(2pift)); % For motor 1
phi = -140/(2
asin(0.8)) * asin(0.8* cos(2pif*t)) ; % For motor 2 ,3

    q1 =  alpha(1,n)/0.0879 ;
    Q(1,n) = q1 ;
    m_pos(1) = p1 + Q(1,n);

    %motor2
    q1 =  phi(1,n)/0.0879 ;
    Q(2,n) = q1 ;
    m_pos(2) = p2 + Q(2,n);

    %motor3
    q3 = phi(1,n)/0.0879 ;
    Q(3,n) = q3 ;
    m_pos(3) = p3 + Q(3,n);

In this code as shown , motor 1 moves at the end even after other 2 motors came to rest. I am unable to figure out why ?

  1. Remember to mark your post Solved when applicable!

Based on the context, seems that provided SyncRead / Write example is updaiting the position of multiple DYNAMIXEL properly.

As you may know, the feature of Sync Read/Write is to send datas at a time for multiple DYNAMIXEL by packing data. Therefore, If you see the lag of the motor, checkout a code of Sync Instruction packet establishment part. You might pack the data wrongly order or sending data in strange timing.

Reference: Motors generate different motions with same data - #2 by Yogurt_Man

Thank you for the response.
Sorry I said lag in the motor 1 but it is actually crossing the goal position during the last cycle.
Lets say I gave a goal position of A*sin(wt) in a loop then during the last cycle it doesn’t reach its goal position but overshoots and reaches a position higher than the final value.