Motors get out of sync intermittently - Modkit for Vex

I spoke with Eli from tech support today about this problem, and he encouraged me to send in screenshots and post a description here as well. You can find a complete set of screenshots and an example program that exhibits the issue in this folder:

https://drive.google.com/open?id=0B1C-YAbPqy5WfjVhSmMtV3pVd1E1QXcwYlg4dHZzUFBNNERNYTJlX1dacnRYWDU0Z1Joams&authuser=0

Here’s the problem description:

I’m running a large number of Vex IQ kits for Project Lead The Way Launch, using them for the Robotics and Automation Challenge module for 5th grade. We’re using the firmware shown in the screenshot (Robot Brain v1.14, motors up to date).

We’re seeing an issue when running a simple program that makes the 2 motors run forward, then execute a point turn (where one motor turns forward while the other turns in reverse by the same number of degrees). The issue is that the motors sometimes get out of sync.

This problem happens intermittently. Sometimes, the motors will both run forward at the same time, then execute the point turn at the same time. Sometimes, one motor will start running (i.e., the motor running forward for the point turn) and the other motor will start running while the first motor is partway through. Other times, the motors will run forward at the same time, then one motor will run, then the other motor will run. I have not been able to reproduce this behaviour consistently.

I’m seeing this same issue on multiple sets of Vex IQ hardware. The program that is in the folder above is one I wrote myself, and I tried to create the simplest possible test case. I saw this program run successfully once, then start intermittently producing the results described above.

If anyone has ideas on how to resolve this, please let me know. I have 2 full classes of 6th grade students who will quickly become stuck if this isn’t resolved. This seems like it might be similar to the bug posted in general forum about blocks timing out (“Modkit program pauses between steps” - http://www.vexiqforum.com/forum/main-category/main-forum/7306-modkit-program-pauses-between-steps) but I’m not sure.

Thanks,

Bill

Hi billvanloo,

We’re sorry that you have encountered this issue. The most likely cause of this issue comes down to real-life physics (friction) and the way that the VEX IQ Smart Motors behave.

When the Smart Motors are commanded with a specific speed and distance (such as spin 360 degrees at 120 rpm), they have an advanced algorithm inside them to try to keep all motors running exactly as they commanded. While the Smart Motors will overcome most low and moderate amounts of loading or friction, friction or high loads may cause the motor to accelerate slower or cause it to reach it’s destination slightly slower. Normally these slight differences are very small - on the range of milliseconds.

When the Smart Motors are commanded in Modkit using one stack in each Motor tab, that operate indepenntly, what happens is that there is no communication from Motor 1 to Motor 2 (and vice versa) that says “hey wait for a few milliseconds for me to finish before we start to turn”. So these tiny differences can start to add up and cause the robot to get more and more out of sync.

The simplest way to avoid this issue is by using the Drivetrain block in Modkit for making your robot drive in specific shapes. The Drivetrain block handles synchronizing the motors behind the scenes, and waits for all drive train motors to finish before they start the next command.

If the robot Drivetrain block is not available (such as if you specifically want/need to use motor blocks), or if you want to coordinate two actions like drive forward and lift a claw at the same time, then it is possible in your program to make a “traffic controller” style program. The “traffic controller” will basically do something like tell “motor 1 & 2: drive forward and tell me when you are done”. While the motors are spinning, the “traffic controller” will wait until both motor 1 and 2 report that they are done. Once they are done, the “traffic controller” will tell the motors “motor 1 & 2: spin left now”, then wait until the motors say they are done until issuing the next command.

I’ve made a sample program to help illustrate this principle. The code stack in the main Robot Brain tab uses a variable that it sets to 0, then tells both motors to do something. When both motors are finished, they each add one to the variable. When the variable equals 2, that means both motors are finished, and the main stack resets the variable to 0 and tells both motors to do action 2. DRIVEROBOT1 might be drive forward, DRIVEROBOT2 might be turn 90 degrees, etc. You can continue adding more and more broadcast commands as needed.

You can expand this approach by adding more motors, and setting the wait threshold variable equal to the number of variables. E.g. if you want to coordinate 4 motors, the Wait 0.01sec While (robotDone < 4) code would be needed.

Regards,

  • Art

    2015-02-26 - Modkit 1.jpg

    2015-02-26 - Modkit 2.png

    2015-02-26 - Modkit 3.png

    2015-02-26 - Modkit 4.png
1 Like

Hi All,

We wanted to update you that this workaround to solve the “intermittent motor sync” issues will no longer be needed with the next revision of the Motor firmware.

We worked hard along with VEX to identify the root cause of the issue and want to present an early release of the motor fix to anyone suffering from this problem and who has previously needed this workaround.

Anyway you can find a description of the underlying cause and an early fix here: http://help.modkit.com/customer/en/portal/articles/2393260-vex-iq-motor-timing-bug-and-temporary-fix

Best,
Modkit