This article describes how to let two LEGO MINDSTORMS EV3 motors do the exact same movement in total harmony and synchronization. Even when the motors have different friction and load they will still synchronize. When you know how to do it, it’s simple. It requires only a little math. Here’s some mathematical background after seeing my windscreen wiper motor synchronising video tutorial on YouTube. First, here’s the video:
In the video, after using the regular motor blocks, I first show some kind of block wave. It is generated by alternating the value of a variable and waiting one second in between. Because motors don’t have infinite acceleration it takes a while before the motor is at the requested position. That’s what the green line shows. Because the green line has flat horizontal bits, the movement still looks jerky.
To avoid the horizontal bits in the motor curve I then move to a sine wave. The numbers it generates are visible in the picture below. Because the movement is smooth, the motor has no difficulty of following it more or less exactly. This gives us the nice windscreen wiper movement. If you build this at home, try to play with the different numbers in the advanced math block to get a feel for what they do.
In another video I explain how you can use this technique to make a lizard move it’s legs and body in coordination.
Why do you use the unadjusted motor block but not the regular motor block please?
Because it’s simpler. Under the hood it does nothing but set the duty cycle (voltage) of the motor. The green move blocks have magics under the hood. Intelligence that might interfere with the closed loop feedback system and lead to unclear behavior.
Thanks a lot.
What if, instead of a back and forth motion I just want to sync 4 motors as they go around and around? I have built the spider_robot on rebrickable. Now I need a way to get the legs to be syncronized at least as a starting position. The other problem is that for every 1 rotation of a pair of legs the the motor needs to do 3 rotations.
Mike,
I have made a video about syncing motors here. It should be easy to translate the principles to python. https://youtu.be/DML8F8-4LKk
Check out this video for that specific problem: https://youtu.be/5F2xtwyCiQ4 The lizard’s legs are very similar to Spider legs.
I wanna know that if we are using the sine wave to make motors smooth but how when one motor is held and then left back syncs automatically with the other motor. Pls reply fast as we are participating in wro ²⁰²².So we need to implement this in our robot
Use a pid control with higher d to slow it down in the end.