View Single Post
  #4   Spotlight this post!  
Unread 22-01-2015, 09:06
MamaSpoldi's Avatar
MamaSpoldi MamaSpoldi is offline
Programming Mentor
AKA: Laura Spoldi
FRC #0230 (Gaelhawks)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Shelton, CT
Posts: 307
MamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant futureMamaSpoldi has a brilliant future
Re: Programming Java help.

If it turns the wrong direction when given commands... like it turns left when you tell it to turn right, then this is not an inverted motor problem. If one side needed to be inverted it would turn when you told it to go straight.

Instead I suspect that it is very likely that you mixed up the PWM order when you create the RobotDrive object (presuming that you are using that class). The documentation defines the interface to the constructor as:
Quote:
RobotDrive (final int frontLeftMotor, final int rearLeftMotor, final int frontRightMotor, final int rearRightMotor)
Based on the info you provided about your robot motor configuration here:
Quote:
Originally Posted by CavbotRyche View Post
Currently using ports 1,2,3,4 for the outputs from the roborio to the motor controllers. Motor 1 is the front left, motor 2 in front right, motor 3 is rear left, and motor 4 is rear right.
The proper way to create that object would be RobotDrive(1,3,2,4). If you have the PWM numbers in a different order it would send the wrong commands to the motors and would not drive as expected.

Of course, it could also be a combination of both the order of the PWMs and inverted motors. I would suggest that you make sure the PWM numbers are in the right order first, then if it is acting incorrectly put the robot up on blocks so that you can watch the wheels move and see which ones are turning the wrong direction when you command it to drive forward.

Hope this helps.
__________________