Using Windriver C++
4 wheel drive mecanum
Jaguars motor controllers (calibrated manually)
PWM
Logitech Extreme 3D Joystick
All electrical has been checked and while there is no such thing as an absolute appears to be wired accurately
We have reimaged the cRio to ensure we do not have garbage code randomly running
Using the mecanum base code provided by FIRST
Behavior we are seeing:
forward works as expected
reverse works as expected
strafe works as expected
Turning either direction (left or right) wheels do not spin in proper directions and fight each other
If anyone has time and is willing could you please help us find our error? I have attached all code and we would appreciate your help as this is interefering with our drive practice and we don’t want to upload broken code on our bot at competiton
Thank you…
I haven’t looked at the code, but could you describe how the wheels are mounted on the robot? do the rollers on the wheels make a diamond or an X on the ground?
When joystick is twisted left:
‘front’ wheels spin backwards (both)
‘back’ wheels spin forward (both)
When joystick is twisted right:
‘front’ wheels spin forward (both)
‘back’ wheels spin backwards (both)
According to the programmer if he changes the code to make turning work properly then it will break strafing…?? Something is not sounding right to me on this…
That strongly suggests that the wheels themselves are installed wrong.
That’s not how they should be. To confirm the problem, try spinning the robot by hand with the power off. If it turns relatively easily, the wheels definitely need to be swapped.
Are the motors inverted in code or physically?
If lefts and rights were set as fronts and backs, and not inverted it would be consistent with what you describe.
I withdraw the ‘and not inverted’ part.
If Left are in front and Rights in the back (or vice versa):
stick forward all turn forward, ditto back
stick to the side and left and right counter rotate so you still strafe (if the front-rear of the two sides are also swapped relatively)
but if you try to turn in place fronts and backs go opposite
Sorry if that isn’t terribly clear, but I would check the order your controllers are in the constructor really match physical L-R/F-R
Assuming the wheels are installed correctly (X pattern viewing from the top), it could be a software issue. The way we software calibrated our mecanum drive train is as the following:
Make sure you put the PWM channels (or CAN IDs) in the correct sequence when instantiating RobotDrive(frontLeft, rearLeft, frontRight, rearRight).
Put the robot on some 2x4’s so the wheels can be freely turning without the robot running away.
In code, execute MecanumDrive_Cartesian(0.0, 0.5, 0.0) and make sure all the wheels are going forward.
If not, note the wheels that are turning backward and add the following line for each wheel that needs correction (need to change kFrontLeftMotor to the corresponding motors):
SetInvertedMotor(kFrontLeftMotor, true);
Now, write the teleop code that uses the joystick(s) to drive the robot.
If tank drive, pushing the left joystick forward should turn the left wheels forward. If not add a minus in front of the joystickLeft.GetY().
Do the same for the tank drive right joystick.
If arcade drive, push the joystick forward should turn all four wheels forward. If they are reversed, put a minus in front of joystick.GetY().
For arcade drive, push the joystick to the right and the robot should turn right (left wheels forward and right wheels reverse). If not, put a minus in front of the joystick.GetX().
*]Similarly, for strafe, correct the corresponding joystick sign if it is not going the direction you want.