-
Notifications
You must be signed in to change notification settings - Fork 0
Allow use of keyboard for control in sim #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I understand making a default keyboard map, which I assume simgui-ds.json is doing. Can you confirm? However, I hesitate forcing it on by default. What if a someone does have an XBox controller? What is inconvenient about the current method of dragging the joystick/keyboard on the Sim GUI? |
Yes, In my testing, dragging the keyboard to the joystick 0 slot doesn't work. I think the XBoxController class doesn't accept keyboard even if its bindings match an XBox controller. I also expect we'll be using sim without an Xbox controller on hand more frequently than with one. |
i dont see an issue merging this, but i do want to comment that configuring a keyboard control scene in sim gui is very trivial, so this may be an overcomplication |
On my computer (MacOS), the keyboard sim control (as described in docs) does not seem to work with the XboxController class. With joystick 0 being set to keyboard 0 and with the keybindings being set to match the inputs of an Xbox controller, all keyboard inputs are ignored by the simulated robot. Do other devices behave differently in this regard? |
@@ -48,6 +48,9 @@ public final class Constants { | |||
? Mode.REAL | |||
: Mode.SIM; // You need to manually switch betweeen SIM and REPLAY. | |||
|
|||
/** If true and in sim, use keyboard bindings instead of XBox controller. */ | |||
public static final Boolean useKeyboard = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you unable to find something that detected if an XBox controller was connected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think the CommandXboxController.isConnected
method will work.
…re is an xbox controller connected
…controller bindings)
Using sim to develop without a real robot is currently difficult, as it requires an Xbox controller.
This PR adds a boolean in constants titled
useKeyboard
. IfuseKeyboard
is true andcurrentMode
isSIM
, use keyboard bindings instead of Xbox controller bindings.Tested in sim with changes on #17.