Help, Robot turns wrong

We are using 4 CIMS in the KOP toughboxes, and our robot is turning incorrectly. We go forward alright, go backwards just fine, but no matter what PWM or jag we put our motors on, the robot will turn the opposite direction that we tell it to. We program in C++. Is there anything that can help us with this?

Just swap the PWM cables from Left to Right and Right to Left.

If you are using tank drive, make sure your joysticks are ordered correctly on Setup tab of the Driver Station. Typically the left is Joystick 1 and the right is Joystick 2. With the robot disabled, click the trigger on one of the joysticks and you should see green asterisks display in the list. If you need to swap the joysticks, simply click and drag them into the right order.

If your joysticks are already in the right order or you’re using arcade drive, check your PWM setup like Bill mentioned above.

That didn’t work. What did happen though was the robot’s other axis was inverted, making the robot drive perfectly if you hold the joystick backwards.

We’ve had this problem before in C++ I know how to fix it in LabVIEW… Basically you have to invert the control using a boolean. I do not know how to do it in C++ but it is something similar.

Another way to troubleshoot without code is to switch the polarity of the cables on the MOTOR side of the Jaguar/Talon/Victor and switch the PWMs if needed as well. You could make something along the likes of a truth table as well if that helps.

I would suggest switching the polarity of one motor, see if that fixes it and if not put it back to how you originally had it. Next you would try switching the polarity of the other motor.

As always, follow the code.

Carefully.

With a piece of paper and pen.

Write down numbers, and how each line of code changes those numbers. From Joystick to Motor. Somewhere you have a sign going the wrong way, or more likely, not understanding what the joystick is giving you. This is a very common issue.

Have your electrical crew check their wires, to be sure, but this sounds like you have to check your code.