Synchronizing two motors?

My team is working on a game-object intake system, we have two conveyor belts, each going on a different side of the game-object. The issue is, we need to run the belts at the same speed, as the gray conveyor-belt inserts on each belt have to line up in order to lift the object (and they must stay lined up). We’re also attempting to put all the controls on Btn6U and Btn6D on the remote control (so the upwards back right bumper moves the belts one way, while the downwards back left bumper moves the belts the other way).

We’re attempting to use encoders, but no matter what we do, we can’t get it to work. How should we go about synchronizing these two motors in ROBOTC?

Have you tried using gears? That would be perfectly synced and would require no programming.

Get the new motors with IMEs.

Seriously though, you should be able to do this with encoders - if you can write a PID loop, and (for example) basically drive the left motor and then try to keep the right motor as close to the left motor as possible, that should do the job.

So for example,


if (VexRT[Btn6U] == 1) {
  motor[leftIntake] = 100; //If you run it at 127, then the right motor will never //be able to catch up if it lags behind.
  if (pidRunning == 0) {
    startTask(IntakePID);
    pidRunning = 1;
  }
} else if (vexRT[Btn6D] == 1) {
  motor[leftIntake] = -100;
  if (pidRunning == 0) {
    startTask(IntakePID);
    pidRunning = 1;
  }
} else {
  if (pidRunning == 1) {
  StopTask(IntakePID);
  pidRunning = 0;
  }
motor[leftIntake] = 0;
motor[rightIntake] = 0;
}

The IntakePID task is the hard bit. I would suggest reading https://vexforum.com/t/pid-speed-control-motor-synchronizing/18635/1.
If you’re still stuck, I can post some code here later.

Software solutions are theoretically workable, but there is no substitute for linking them mechanically via a long axle, gears, or chain.