|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: How to use JAVADOCS?
Okay, you want to print out the Joystick values right?
I'm assuming you have created a FRC Java project and figured out all the cRIO, Java plugins...etc stuff. I find the Iterative framework the best for us. Joysticks First, you declare a Joystick object, after the place where you declare the class and before your constructor: Code:
Joystick leftStick; Code:
leftStick = new Joystick(1); Code:
System.out.println(leftStick.getX()); System.out.println(leftStick.getY()); Code:
System.out.println(leftStick.getAxis(Joystick.AxisType.kX)); Code:
leftStick.getButton(Joystick.ButtonType.kTrigger) More detailed explanation on the Button stuff and Javadocs: See what getButton() has inside the parenthesis in the docs? It says "Joystick.ButtonType button" which means it takes in one (and only one) parameter with type Joystick.ButtonType. This means that you may NOT use integers, doubles, floats, booleans...etc, and you MUST use Joystick.ButtonType (kTop, kTrigger, kNumButton) If you have a button that's not the trigger or the enumerated buttons in Joystick.ButtonType, you can use the getRawButton() function. So, if you know the button number of what you want, you'd just do (example for button number 4): Code:
leftStick.getRawButton(4); Drive System A simple 2-motor tank drive system (Jaguars plugged into PWM 1 and 2) would look like this: Declaration: Code:
RobotDrive drive; Joystick leftStick, rightStick; Code:
drive = new RobotDrive(1,2); leftStick = new Joystick(1); rightStick = new Joystick(2); Code:
drive.tankDrive(leftStick.getY(),rightStick.getY()); Code:
drive.tankDrive(leftStick, rightStick); ![]() Last edited by Patrick Chiang : 20-01-2011 at 00:06. |
|
#2
|
|||
|
|||
|
Re: How to use JAVADOCS?
Javadocs are the bible of java there are 3 main sections.
1 Constructors 2 Fields 3 Methods Constructors explain what parameters (if any) are needed to be passed to create the object. From the example above ... Code:
Joystick joy = new Joystick(1); Code:
Joystick public Joystick(int$@#port) Construct an instance of a joystick. The joystick index is the usb port on the drivers station. Parameters: port - The port on the driver station that the joystick is plugged into. Also note that if you run into a method or field that is declared static then you do not need to construct an object to use those methods or fields. An example of static call would be Code:
System.out.println("Something");
Code:
System.out = new ... |
|
#3
|
||||
|
||||
|
Re: How to use JAVADOCS?
As to your other question about sunspot for win7, there is no reason it shouldn't work. The file which installs the SDK now also recognizes 64-bit systems as valid. This is true whether you are using the NetBeans plug-ins or the Eclipse plug-ins (since the SDK for both is the same).
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|