I was setting up a four-motor drive train (with jaguars) recently, and made sure the ports were correct and all of the hardware was right (it was). However, when I drove it forward, the jaguars controlling the two left-most motors lit up red, signifying that they were going ‘backwards’. They were going in the correct direction, but normally when we set up drive trains like this, they flash green because they know that the direction they’re turning in is actually forward.
Those two motors only spun at half speed, and I assumed this was because jaguars can’t go full speed in reverse, so to fix it I did setInvertedMotor(…), and flipped the polarity of the motor which it was connected to. That did the job.
Could this be a bug in the new wpilib distribution?
The speed difference between forward and backwards should be very minimal. You probably need to calibrate the Jaguars to get them to spin the correct speed.
The motors on the left vs. right side of the drive train are rotated 180deg out from one another. To make both sides cause the wheels on the drivetrain to go in the same direction, one side of the drivetrain has to be driven in the opposite direction of the other.* The motor controllers have no notion of the forward/reverse direction relative to your robot. They can only indicate the polarity of their output voltage relative to the M+ and M- markings on their output pins.
I’m not sure why you saw the motor operating at half speed. setInvertedMotor() shouldn’t affect max speed. How did you determine this was the case? Are you sure that the motors in each gear box are spinning in the same direction relative to one another?
** I’m making the assumption that voltage applied in the same polarity to all drive motors causes them all to rotate in the same direction. This isn’t always true. Last year two of our 6 CIMs spun opposite the rest when the same polarity voltage was applied to their wires.*
If it were a calibration problem, I would have expected the speed problem to be observed in the opposite direction of travel after the setInvertedMotor() was added to the code. Was this the case?