Our robot goes forward and backwards fine, but right=left and left=right. It appears the speed controllers are wired properly, if did notice however that the LED on the speed controller is flashing green on one and red on one when the stick is pushed forward and the robot is going forward. To verify that it was not an electrical problem i reversed the leads from one of the motors then forward and backward = turn and vice versa.
This is for 2 motor drive, left = PWM 1, right = PWM 2. This is with the simple robot template.
I did verify that the speed controller’s + and - are wired correctly and the motor’s are wired in the same direction (+ to red and - to black)
I just don’t know whats going on. Any help is appreciated, I just got the camera to work and here we are another problem…
I did swap them to test, and instead of inverting the turning it inverted forward and backward. I tried this in both software and hardware (rebooting the cRIO in between to be sure the code changed, also verified that by changing something in autonomous to confirm the code made it. ).
I’ll give it another try tmrw, I just got home, internet at school was a bit funky.
I find that it’s a lot easier to diagnose these issues in tank drive rather then arcade, because it’s easier to see the input directly affect the output. In tank mode, once the correct side goes forward at the correct time, then arcade mode will work properly.
Don’t just blindly start swapping things around. Look at how the program has the left and right motors defined, and make sure those are the motors actually being controlled by the relevant PWM outputs. You have to make the code consistent with physical reality.
Then, when you find that a motor is going in the direction opposite the way you think it should, change the “Invert” constant for that motor on the Drive Open vi.
(If you have wired the motors the way I think is most natural, the left motor should not be inverted and the right one should be. It’s possible that your wiring is backwards from the way I expect, or perhaps your gearboxes are doing an extra reversal from the actual motor direction. It’s not really important which one is which, only that the wheels go in the direction you want them to.)
Think about which way the motors turn in order for the robot to move forwards. Drivetrain designs with both motors going the same direction are vanishingly rare. Almost invariably, one spins clockwise and the other spins counterclockwise.
When you swap the motor control, you’re telling each motor to turn the way the other one used to. That runs the robot in the other direction.
Just look at the code, and at the robot wiring, and make sure that the PWM signal configured as the left motor is the same one physically connected to the left motor. Do the same for the right motor. Then if either side of the robot runs in the wrong direction, invert that motor’s control in the code.
If you’re confident that the wiring is correct, then let’s go ahead and look at the programming. Have you changed anything from the defaults? Show us how you’re initializing the drive motors, and how you’re controlling them.
s1 = new Solenoid(1);
s2 = new Solenoid(2);
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time