Rotate synchronized wheel

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

New User
Posts: 14
Joined: Mon Feb 27, 2017 8:50 pm

Rotate synchronized wheel

Postby hflores » Fri Jul 07, 2017 5:07 am

I have the following code to make a 90 degree turn, but increase or decrease 3 degrees.

Code: Select all

      int tachoRow = 0;

       RIGHT_MOTOR.setSpeed(120);// 2 RPM
       // perform four repetitions of the test
       for (int i = 0; i < 2; i++) {
          // wait for 200 milliseconds

         // turn back
          RIGHT_MOTOR.synchronizeWith(new EV3LargeRegulatedMotor[] { LEFT_MOTOR });
          LEFT_MOTOR.rotate(-278, true);
          RIGHT_MOTOR.rotate(278, true);
         while (RIGHT_MOTOR.isMoving() && LEFT_MOTOR.isMoving())
          // display the tacho counts and reset the // max, if changed
          currTachoCountDiff = displayTachoCounts(tachoRow++);
          if (currTachoCountDiff > maxTachoCountDiff)
             maxTachoCountDiff = currTachoCountDiff;
       // stop the motors


User avatar
leJOS Team Member
Posts: 5995
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Rotate synchronized wheel

Postby gloomyandy » Fri Jul 07, 2017 8:29 am

I'm sorry I don't understand your question. What is the problem? Are you saying that the tacho readings after the move has completed are not 278 and -278? If so what are they? Are you saying that your robot does not rotate as you expect?

A few things...
1. To use the motor synchronization feature you must call the startSyncheonization/endSYnchronization method using the same motor that you created the sync group with. So in your code you should be using RIGHT_MOTOR not LEFT_MOTOR. See: ... ms-part-2/
2. Do not call resetTachCount() this is not a good idea. The motor driver keeps track of things like slight errors in the motor position and will try and correct them on the next move. you will lose this correction if you reset the tacho count.
3. What is the acceleration value you are using? Using high acceleration values may result in motor position overshoot at the end of a move, this is not a good idea. Try different acceleration values to see if that helps.
4. Can you post a picture of your robot (or even better a video of it during this test).
5. It is better to call waitComplete on the two motors (see the example in the above link) rather than polling isMoving
leJOS news

Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 7 guests