Four Motor Programming

Can someone help me/ show me a sample of a code that would make a four motor robot move? All ive seen is two motor programs, or at least thats all I think ive seen. thanks

if i’m understanding you correctly, all you would need to do is duplicate the output of the left-side motor for the second motor on that side, and the same for the right-side second motor - where the code sets the right-side motor to a certain value, just set both motors on the right side to that value (and by motor, I mean PWM)

That might work, but the back motors are different from the front motors, the front motors are CIM motors and the back motors are drill motors, does that make a difference?

are you using a gearbox so that the motors end up matching spin speeds? if so, it should work fine. if not, you might need to make a function to translate the value going to one set of motors into an appropriate value for the others… i.e. if your chips are on pwms 1 and 2, and the drills on 3 and 4:


pwm01 = leftvalue;
pwm02 = rightvalue;
pwm03 = drillTranslate(leftvalue);
pwm04 = drillTranslate(rightvalue);

the drillTranslate() function might just be a simple curve, or you might need to use a lookup table.

Yes it does matter, especially if you are using the drill motors. If because of gearing or programming you are back driving the drill motors you may do damage to the transmission. You will need to adjust the speed so they run close to the same.

Tim Tedrow

Well the drill motors have gearboxes but the CIM motors are not the same nor can we set them to the same speed, so how would I go about setting different values for the drill motors or vice-versa?

DON"T USE THE DRILL GEAR BOXES!!! Biff can write miles on that.

It’s easier to find the RPMs and build it that way. So in code, you just set each to the same. We’re using CIM and drill motors this way, and it works fine.

So just use the same values for both and it should work fine?

Yes, as long as they are mechanically geared pretty close at their free speed, then just set them both to the smae walue, and it will work well enough. There is always room for improvement, but it will work.