How to synchronize two motors in Master Slave Configuration with an Offset value?

Hello Everyone,

I am trying to synchronize two different XL430 W250T servos in Master and slave configuration, where the angular difference between these two motors are always 90 degrees. i.e. When Master Servo is at 90 degree position (Encoder position 1024), the slave servo should be at 0 degree (Encoder position 0). In this way angular difference between the servo should always be 90 degrees. I am trying to operate both the servo in extended position control mode. How can I achieve this?

I have tried shadow ID function, but in shadow ID feature, both servos will be synchronized, i.e. the encoder position will be same for both servos.

I am using Dynamixel SDK and coding is being done in Python. Can anyone help me with this issue?

Shanu,

The best way to achieve this sort of offset synchronization is to set the goal position of the secondary servo in relation to the primary. Something like:

secondaryGoal = (primaryGoal - 1024)

Would probably be the simplest way to implement this with the least moving pieces.

@shanu

I also would add SyncWrite to the approach mentioned by @Jonathon.

I have another idea that after setting shadow ID, set the slave servo’s Homing Offset (20) to 1024.
Then this no need calculation and SyncWrite in the main program.

I think this also can solve the issue but I never test it out. Please try and share with us. ^^

1 Like

@Robotclub - Great idea! :grinning:
I just tried it out and it worked great! The surprisingly thing is that both servos can stay in the Regular Position Control mode, there is no need to change any of them into Extended Position Control mode.

As usual, watch out when you go from 4095 to 1, both servos will “take the long way back” to 1, i.e., clock-wise, even when they are in “Extended Position Control”.

1 Like

@Jonathon

Thanks for the suggestion, I have tried this approach in the extended position mode. The both motors start fine with 90 degree offset, but during motion this offset changes and the 90 degree offset is not maintained, however at the end both the motors reach the goal with the offset maintained.

The problem is how to ensure the 90 degree angular difference between both motors throughout?

Thanks, I will test with SyncWrite and let you know what happened.

@Jonathon I was wondering what would be the reason for the drifting of one of the motors, If I adjust PID values will the problem be resolved?

Maybe you can try to use Time Control in addition to Shadow ID or SyncWrite so they will reach the goal destinations at the same time? And can you change Goal Positions only a little bit at a time?

If all options fail can you use some kind of mechanical coupling also?

Shanu,

I apologize for my delay in response. I spent the end of last week away from the ROBOTIS office attending the ANA AVATAR XPRIZE Finals.

To answer your question, the 90 degree offset isn’t maintained during the motion as the two actuators are moving independently to their separate goal positions. Without a rigid mechanical linkage there really isn’t a way to perfectly maintain that 90 degree offset during the movements.

There are a couple of options that might help get you closer to holding that offset though:

  1. Splitting the large movements into a series of smaller movements of 1 or 2 degrees at a time, and stepping through them at the speed you need your application to move will likely give you pretty good results at maintaining your offset
  2. PID tuning and slowing down the motion may allow you to get the actuators to move more in sync with one another, but this will likely require a lot of tuning and may not be perfectly synchronized