diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java index fadff92261..423d88ea14 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java @@ -252,4 +252,24 @@ public class CommandGenericHID { public double getRawAxis(int axis) { return m_hid.getRawAxis(axis); } + + /** + * Set the rumble output for the HID. The DS currently supports 2 rumble values, left rumble and + * right rumble. + * + * @param type Which rumble value to set + * @param value The normalized value (0 to 1) to set the rumble to + */ + public void setRumble(GenericHID.RumbleType type, double value) { + m_hid.setRumble(type, value); + } + + /** + * Get if the HID is connected. + * + * @return true if the HID is connected + */ + public boolean isConnected() { + return m_hid.isConnected(); + } } diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/CommandGenericHID.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/CommandGenericHID.cpp index b7f1d5a28a..cfe12cd25d 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/button/CommandGenericHID.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/button/CommandGenericHID.cpp @@ -74,3 +74,12 @@ Trigger CommandGenericHID::AxisGreaterThan(int axis, double threshold, return m_hid.GetRawAxis(axis) > threshold; }); } + +void CommandGenericHID::SetRumble(frc::GenericHID::RumbleType type, + double value) { + m_hid.SetRumble(type, value); +} + +bool CommandGenericHID::IsConnected() const { + return m_hid.IsConnected(); +} diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/button/CommandGenericHID.h b/wpilibNewCommands/src/main/native/include/frc2/command/button/CommandGenericHID.h index 56fb377f1d..563a4b2b5c 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/button/CommandGenericHID.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/button/CommandGenericHID.h @@ -230,6 +230,23 @@ class CommandGenericHID { frc::EventLoop* loop = CommandScheduler::GetInstance().GetDefaultButtonLoop()) const; + /** + * Set the rumble output for the HID. + * + * The DS currently supports 2 rumble values, left rumble and right rumble. + * + * @param type Which rumble value to set + * @param value The normalized value (0 to 1) to set the rumble to + */ + void SetRumble(frc::GenericHID::RumbleType type, double value); + + /** + * Get if the HID is connected. + * + * @return true if the HID is connected + */ + bool IsConnected() const; + private: frc::GenericHID m_hid; };