View Single Post
  #1   Spotlight this post!  
Unread 20-12-2013, 13:17
BlackUnicorns BlackUnicorns is offline
Registered User
FRC #5135
 
Join Date: Dec 2013
Location: Israel
Posts: 3
BlackUnicorns is an unknown quantity at this point
Re: Just began using Java

Quote:
Originally Posted by Jon Stratis View Post
Change this line:

RobotDrive myDrive = new RobotDrive(1, 2);

to:

RobotDrive myDrive = new RobotDrive(2, 1);


Think about what's happening. When you push forwards on the joystick, the RobotDrive tells both motors (1 and 2) to drive forward, which works fine. Likewise, pulling the joystick backwards makes both motors go backwards.

But if you want to turn left (spin in place) then one motor has to go forwards and one has to go backwards. In this case, it picked the wrong ones, and as a result spins in the wrong direction. By switching the order you pass in the motors, you'll switch it's choice and it'll turn in the right direction.
What you say makes a lot of sense, but i remember that we tried doing it today and it didnt work..
I dont have the robot now to try it but i will try it tomorrow and see if it works.

by the way, i remember when we used labview, it had a robot simulator, does java has something like that too?
Reply With Quote