| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.wpi.first.wpilibj.GenericHID
edu.wpi.first.wpilibj.Joystick
public class Joystick
Handle input from standard Joysticks connected to the Driver Station. This class handles standard input that comes from the Driver Station. Each time a value is requested the most recent value is returned. There is a single class instance for each joystick and the mapping of ports to hardware buttons depends on the code in the driver station.
| Nested Class Summary | |
|---|---|
| static class | Joystick.AxisTypeRepresents an analog axis on a joystick. | 
| static class | Joystick.ButtonTypeRepresents a digital button on the JoyStick | 
| Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.GenericHID | 
|---|
| GenericHID.Hand | 
| Constructor Summary | |
|---|---|
|   | Joystick(int port)Construct an instance of a joystick. | 
| protected  | Joystick(int port,
                 int numAxisTypes,
                 int numButtonTypes)Protected version of the constructor to be called by sub-classes. | 
| Method Summary | |
|---|---|
|  double | getAxis(Joystick.AxisType axis)For the current joystick, return the axis determined by the argument. | 
|  int | getAxisChannel(Joystick.AxisType axis)Get the channel currently associated with the specified axis. | 
|  boolean | getBumper(GenericHID.Hand hand)This is not supported for the Joystick. | 
|  boolean | getButton(Joystick.ButtonType button)Get buttons based on an enumerated type. | 
|  double | getDirectionDegrees()Get the direction of the vector formed by the joystick and its origin in degrees uses acos(-1) to represent Pi due to absence of readily accessable Pi constant in C++ | 
|  double | getDirectionRadians()Get the direction of the vector formed by the joystick and its origin in radians | 
|  double | getMagnitude()Get the magnitude of the direction vector formed by the joystick's current position relative to its origin | 
|  double | getRawAxis(int axis)Get the value of the axis. | 
|  boolean | getRawButton(int button)Get the button value for buttons 1 through 12. | 
|  double | getThrottle()Get the throttle value of the current joystick. | 
|  boolean | getTop(GenericHID.Hand hand)Read the state of the top button on the joystick. | 
|  boolean | getTrigger(GenericHID.Hand hand)Read the state of the trigger on the joystick. | 
|  double | getTwist()Get the twist value of the current joystick. | 
|  double | getX(GenericHID.Hand hand)Get the X value of the joystick. | 
|  double | getY(GenericHID.Hand hand)Get the Y value of the joystick. | 
|  double | getZ(GenericHID.Hand hand)Get the Z value of the joystick. | 
|  void | setAxisChannel(Joystick.AxisType axis,
                             int channel)Set the channel associated with a specified axis. | 
| Methods inherited from class edu.wpi.first.wpilibj.GenericHID | 
|---|
| getBumper, getTop, getTrigger, getX, getY, getZ | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public Joystick(int port)
port - The port on the driver station that the joystick is plugged into.
protected Joystick(int port,
                   int numAxisTypes,
                   int numButtonTypes)
port - The port on the driver station that the joystick is plugged into.numAxisTypes - The number of axis types in the enum.numButtonTypes - The number of button types in the enum.| Method Detail | 
|---|
public double getX(GenericHID.Hand hand)
getX in class GenericHIDhand - Unused
public double getY(GenericHID.Hand hand)
getY in class GenericHIDhand - Unused
public double getZ(GenericHID.Hand hand)
getZ in class GenericHIDhand - Unused
public double getTwist()
getTwist in class GenericHIDpublic double getThrottle()
getThrottle in class GenericHIDpublic double getRawAxis(int axis)
getRawAxis in class GenericHIDaxis - The axis to read [1-6].
public double getAxis(Joystick.AxisType axis)
axis - The axis to read.
public boolean getTrigger(GenericHID.Hand hand)
getTrigger in class GenericHIDhand - This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
public boolean getTop(GenericHID.Hand hand)
getTop in class GenericHIDhand - This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
public boolean getBumper(GenericHID.Hand hand)
getBumper in class GenericHIDhand - This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
public boolean getRawButton(int button)
getRawButton in class GenericHIDbutton - The button number to be read.
public boolean getButton(Joystick.ButtonType button)
button - The type of button to read.
public double getMagnitude()
public double getDirectionRadians()
public double getDirectionDegrees()
public int getAxisChannel(Joystick.AxisType axis)
axis - The axis to look up the channel for.
public void setAxisChannel(Joystick.AxisType axis,
                           int channel)
axis - The axis to set the channel for.channel - The channel to set the axis to.| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||