mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[commands] Add setRumble and isConnected to CommandGenericHID (#6768)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user