Robot Core Documentation
|
Classes | |
enum | AxisType |
enum | ButtonType |
Public Member Functions | |
Joystick (final int port) | |
void | setXChannel (int channel) |
void | setYChannel (int channel) |
void | setZChannel (int channel) |
void | setThrottleChannel (int channel) |
void | setTwistChannel (int channel) |
int | getXChannel () |
int | getYChannel () |
int | getZChannel () |
int | getTwistChannel () |
int | getThrottleChannel () |
final double | getX () |
final double | getY () |
final double | getZ () |
final double | getTwist () |
final double | getThrottle () |
boolean | getTrigger () |
boolean | getTriggerPressed () |
boolean | getTriggerReleased () |
BooleanEvent | trigger (EventLoop loop) |
boolean | getTop () |
boolean | getTopPressed () |
boolean | getTopReleased () |
BooleanEvent | top (EventLoop loop) |
double | getMagnitude () |
double | getDirectionRadians () |
double | getDirectionDegrees () |
Static Public Attributes | |
static final byte | kDefaultXChannel = 0 |
static final byte | kDefaultYChannel = 1 |
static final byte | kDefaultZChannel = 2 |
static final byte | kDefaultTwistChannel = 2 |
static final byte | kDefaultThrottleChannel = 3 |
Handle input from Flight 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.
edu.wpi.first.wpilibj.Joystick.Joystick | ( | final int | port | ) |
Construct an instance of a joystick.
port | The port index on the Driver Station that the joystick is plugged into. |
double edu.wpi.first.wpilibj.Joystick.getDirectionDegrees | ( | ) |
Get the direction of the vector formed by the joystick and its origin in degrees.
double edu.wpi.first.wpilibj.Joystick.getDirectionRadians | ( | ) |
Get the direction of the vector formed by the joystick and its origin in radians.
double edu.wpi.first.wpilibj.Joystick.getMagnitude | ( | ) |
Get the magnitude of the direction vector formed by the joystick's current position relative to its origin.
final double edu.wpi.first.wpilibj.Joystick.getThrottle | ( | ) |
Get the throttle value of the current joystick. This depends on the mapping of the joystick connected to the current port.
int edu.wpi.first.wpilibj.Joystick.getThrottleChannel | ( | ) |
Get the channel currently associated with the throttle axis.
boolean edu.wpi.first.wpilibj.Joystick.getTop | ( | ) |
Read the state of the top button on the joystick.
boolean edu.wpi.first.wpilibj.Joystick.getTopPressed | ( | ) |
Whether the top button was pressed since the last check.
boolean edu.wpi.first.wpilibj.Joystick.getTopReleased | ( | ) |
Whether the top button was released since the last check.
boolean edu.wpi.first.wpilibj.Joystick.getTrigger | ( | ) |
Read the state of the trigger on the joystick.
boolean edu.wpi.first.wpilibj.Joystick.getTriggerPressed | ( | ) |
Whether the trigger was pressed since the last check.
boolean edu.wpi.first.wpilibj.Joystick.getTriggerReleased | ( | ) |
Whether the trigger was released since the last check.
final double edu.wpi.first.wpilibj.Joystick.getTwist | ( | ) |
Get the twist value of the current joystick. This depends on the mapping of the joystick connected to the current port.
int edu.wpi.first.wpilibj.Joystick.getTwistChannel | ( | ) |
Get the channel currently associated with the twist axis.
final double edu.wpi.first.wpilibj.Joystick.getX | ( | ) |
Get the X value of the joystick. This depends on the mapping of the joystick connected to the current port.
int edu.wpi.first.wpilibj.Joystick.getXChannel | ( | ) |
Get the channel currently associated with the X axis.
final double edu.wpi.first.wpilibj.Joystick.getY | ( | ) |
Get the Y value of the joystick. This depends on the mapping of the joystick connected to the current port.
int edu.wpi.first.wpilibj.Joystick.getYChannel | ( | ) |
Get the channel currently associated with the Y axis.
final double edu.wpi.first.wpilibj.Joystick.getZ | ( | ) |
Get the z position of the HID.
int edu.wpi.first.wpilibj.Joystick.getZChannel | ( | ) |
Get the channel currently associated with the Z axis.
void edu.wpi.first.wpilibj.Joystick.setThrottleChannel | ( | int | channel | ) |
Set the channel associated with the throttle axis.
channel | The channel to set the axis to. |
void edu.wpi.first.wpilibj.Joystick.setTwistChannel | ( | int | channel | ) |
Set the channel associated with the twist axis.
channel | The channel to set the axis to. |
void edu.wpi.first.wpilibj.Joystick.setXChannel | ( | int | channel | ) |
Set the channel associated with the X axis.
channel | The channel to set the axis to. |
void edu.wpi.first.wpilibj.Joystick.setYChannel | ( | int | channel | ) |
Set the channel associated with the Y axis.
channel | The channel to set the axis to. |
void edu.wpi.first.wpilibj.Joystick.setZChannel | ( | int | channel | ) |
Set the channel associated with the Z axis.
channel | The channel to set the axis to. |
BooleanEvent edu.wpi.first.wpilibj.Joystick.top | ( | EventLoop | loop | ) |
Constructs an event instance around the top button's digital signal.
loop | the event loop instance to attach the event to. |
BooleanEvent edu.wpi.first.wpilibj.Joystick.trigger | ( | EventLoop | loop | ) |
Constructs an event instance around the trigger button's digital signal.
loop | the event loop instance to attach the event to. |
|
static |
Default throttle axis channel.
|
static |
Default twist axis channel.
|
static |
Default X axis channel.
|
static |
Default Y axis channel.
|
static |
Default Z axis channel.