mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[commands] HID classes: Add missing methods, tweak return types (#4557)
- Make return type of getHID reflect the specific class - Add getX and getY to CommandJoystick
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.wpilibj2.command.button;
|
||||
|
||||
import edu.wpi.first.wpilibj.GenericHID;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
@@ -33,7 +32,7 @@ public class CommandJoystick extends CommandGenericHID {
|
||||
* @return the wrapped GenericHID object
|
||||
*/
|
||||
@Override
|
||||
public GenericHID getHID() {
|
||||
public Joystick getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
@@ -171,6 +170,24 @@ public class CommandJoystick extends CommandGenericHID {
|
||||
return m_hid.getThrottleChannel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the x position of the HID.
|
||||
*
|
||||
* @return the x position
|
||||
*/
|
||||
public double getX() {
|
||||
return m_hid.getX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the y position of the HID.
|
||||
*
|
||||
* @return the y position
|
||||
*/
|
||||
public double getY() {
|
||||
return m_hid.getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the z position of the HID.
|
||||
*
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.wpilibj2.command.button;
|
||||
|
||||
import edu.wpi.first.wpilibj.GenericHID;
|
||||
import edu.wpi.first.wpilibj.PS4Controller;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||
@@ -34,7 +33,7 @@ public class CommandPS4Controller extends CommandGenericHID {
|
||||
* @return the wrapped GenericHID object
|
||||
*/
|
||||
@Override
|
||||
public GenericHID getHID() {
|
||||
public PS4Controller getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user