Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Coding for CIM Motor help (http://www.chiefdelphi.com/forums/showthread.php?t=99998)

korsuk19 12-01-2012 23:20

Coding for CIM Motor help
 
1 Attachment(s)
Hello, I am the new programmer for my team, but I'm not all that great yet.
Right now I have to code to make our CIM motor's drive. I have to make it so that the left motors are controlled by the left joystick and right motors to be controlled by the right joy stick. This is my question.

I've been coding for tank drive, but would arcade be easier?

This is the code I have.

ProgrammerMatt 13-01-2012 09:18

Re: Coding for CIM Motor help
 
Typically teams use tank drive but it is really personal choice, i belive you could simplify your code a bit to by using:

Your Mainclass:

Code:

RobotDrive drive;
Joystick left, right;

robotInit:
Code:

drive = new RobotDrive(1,2,3,4); // Four motors on pwm You can replace with CANJaguars too.
right = new Joystick(1);
left = new Joystick(2);

operatorControl:
Code:

drive.tankDrive(left.getY(), right.getY());
For arcade:
Code:

drive.arcadeDrive(left.getY(), left.getX()); // your Y val is your speed and the X value is your turning
You may have to import classes if so just right click the underlined errors and click fix imports

Patrickwhite 13-01-2012 10:28

Re: Coding for CIM Motor help
 
Quote:

Originally Posted by ProgrammerMatt (Post 1104307)
You may have to import classes if so just right click the underlined errors and click fix imports

If you're using NetBeans, there is a shortcut (default Ctrl+Shift+I) which automatically fixes imports. VERY handy.

ProgrammerMatt 13-01-2012 14:34

Re: Coding for CIM Motor help
 
Quote:

Originally Posted by Patrickwhite (Post 1104362)
If you're using NetBeans, there is a shortcut (default Ctrl+Shift+I) which automatically fixes imports. VERY handy.

Yes true and i <3 netbeans


All times are GMT -5. The time now is 22:21.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi