Thread: Java Code Help
View Single Post
  #2   Spotlight this post!  
Unread 13-09-2011, 23:19
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
Re: Java Code Help

Personally, I would say that you are trying to do too much right now. It is better to KEEP THINGS SIMPLE!!!!
Using multiple files is great, but to a large degree, it is more clutter than it is helpful, espcially at the stage you are in. You could combine all of your code into Main.java and it would make life simpler IMO.

On a different note, this code:
Code:
 Joystick stick = (lstick.getRawButton(1));
           if (stick.getRawButton(1)) arm.raiseLowArm();
is not doing what you want to (which I am assuming is to raise the arm when you press the trigger.) I think you are looking for something closer to:
Code:
 if (lstick.getRawButton(1)))
			  *relay_obj*.set(Relay.Value.kForward);
when *relay_obj* is a relay object created in the Main.java file. It really helps to look at the documentation for this stuff, which is included locally with the netbeans plugin at C:\Users\*username*\sunspotfrcsdk\doc\javadoc\edu\ wpi\first\wpilibj.

Concerning your ArcadeDrive class, it is already defined for you in RobotDrive, so there is no point in rewriting it. Also, you never call a method that would set the wheel speeds or change the state of the relay, so the code will do nothing visible to the operator. Try creating a robotDrive object and calling the arcadeDrive method on that object.....again, read the documentation here.

Feel free to PM me if you need anything else!
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote