Added Joystick::GetAxisType() (#98)

This commit is contained in:
Tyler Veness
2016-08-07 08:19:19 -07:00
committed by Peter Johnson
parent 62a980d3c8
commit 6ef4745d86
4 changed files with 37 additions and 5 deletions

View File

@@ -436,6 +436,25 @@ public class DriverStation implements RobotState.Interface {
return retVal;
}
/**
* Returns the types of Axes on a given joystick port.
*
* @param stick The joystick port number
* @param axis The target axis
* @return What type of axis the axis is reporting to be
*/
public int getJoystickAxisType(int stick, int axis) {
if (stick < 0 || stick >= kJoystickPorts) {
throw new RuntimeException("Joystick index is out of range, should be 0-5");
}
int retVal = -1;
synchronized (m_joystickMutex) {
retVal = HAL.getJoystickAxisType((byte) stick, (byte) axis);
}
return retVal;
}
/**
* Gets a value indicating whether the Driver Station requires the robot to be enabled.
*

View File

@@ -387,6 +387,15 @@ public class Joystick extends GenericHID {
return m_port;
}
/**
* Get the axis type of a joystick axis.
*
* @return the axis type of a joystick axis.
*/
public int getAxisType(int axis) {
return m_ds.getJoystickAxisType(m_port, axis);
}
/**
* Set the rumble output for the joystick. The DS currently supports 2 rumble values, left rumble
* and right rumble.