Closed AddictArts closed 5 years ago
We were able to test and found we could switch between the two types of sticks. The robot "disables" if you don't when usb stick is changed. When the DualAction is plugged in you press "start" and that enables the stick, pressing "back" disables it switching to default stick config. I needed to update handling the common buttons, so each type has a COMMON in their namespace, a "map". This is returned as a reference in the subclass implementation of GetJoystickCommon.
constexpr JoystickBase::JoystickCommon COMMON{
DualAction::LeftXAxis, DualAction::LeftYAxis, DualAction::RightXAxis,
DualAction::RightYAxis, DualAction::LeftBumper, DualAction::RightBumper,
DualAction::LeftTrigger, DualAction::RightTrigger,
};
I've updated the branch it is ready for testing
See branch driver_live_dual_action_support
Here is what we have:
What remains ...
This new version can accomplish the remains at runtime. I implemented a base class for Poofs, DA, and XBox which inherits from Joystick. This was so that we could use polymorphism to handle the call to GetRawAxisWithDeadband from the periodic to get stick x and y. I also implemented a POD struct for the button assignment. So, the base looks like this:
Teleop etc gets a ObservableJoystickBase, instead of the concrete class DualAction... or XBox...
Runtime
Now Robot could use detection to change which instance Teleop uses or it could use the "start" button on the Dual Action if we don't have a detection method.