mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpilib,cmd2] Fix up issues with generated gamepads (#8985)
There were a few issues with the generated classes. Python had a __getattr__ forwarder that we defintely did not want. C++ was using a struct with constexpr values, and not an enum class for button types. In all 3, the forwarders from gamepad didn't exist on the generated types. This fixes all 3. --------- Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.DualSenseController;
|
||||
@@ -31,6 +32,16 @@ public class CommandDualSenseController {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The DualSenseController object to use for this controller.
|
||||
*/
|
||||
public CommandDualSenseController(DualSenseController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
@@ -43,6 +54,19 @@ public class CommandDualSenseController {
|
||||
m_controller = new DualSenseController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The DualSenseController object to use for this controller.
|
||||
*/
|
||||
public CommandDualSenseController(Scheduler scheduler, DualSenseController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided DualSenseController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.XboxController;
|
||||
@@ -31,6 +32,16 @@ public class CommandXboxController {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The XboxController object to use for this controller.
|
||||
*/
|
||||
public CommandXboxController(XboxController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
@@ -43,6 +54,19 @@ public class CommandXboxController {
|
||||
m_controller = new XboxController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The XboxController object to use for this controller.
|
||||
*/
|
||||
public CommandXboxController(Scheduler scheduler, XboxController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided XboxController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user