Skip to content

Commit

Permalink
[commands] HID classes: Add missing methods, tweak return types (#4557)
Browse files Browse the repository at this point in the history
- Make return type of getHID reflect the specific class
- Add getX and getY to CommandJoystick
  • Loading branch information
ohowe1 authored Nov 3, 2022
1 parent 1831ef3 commit 102344e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -33,7 +32,7 @@ public CommandJoystick(int port) {
* @return the wrapped GenericHID object
*/
@Override
public GenericHID getHID() {
public Joystick getHID() {
return m_hid;
}

Expand Down Expand Up @@ -171,6 +170,24 @@ public int getThrottleChannel() {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -34,7 +33,7 @@ public CommandPS4Controller(int port) {
* @return the wrapped GenericHID object
*/
@Override
public GenericHID getHID() {
public PS4Controller getHID() {
return m_hid;
}

Expand Down

0 comments on commit 102344e

Please sign in to comment.