Keyboard + Mouse Controls for Swerve?

Hey guys!

I’ve been thinking about different ways of controlling the robot for our team’s drivers, obviously thought of the pros and cons of joysticks and controllers, but then I thought of keyboard and mouse. I feel like that would be pretty unique and it would make it easier to drive especially to those who like playing FPS games with a keyboard and mouse.

Is it possible and/or competition legal? Has a team already done this before? I’m thinking that there is a default speed that the robot moves at, and moves slower when shift is pressed, and faster when ctrl is pressed, and the mouse is used to rotate the robot. These controls are similar to minecraft, and since that game is quite popular, I decided it would be a good idea to mimic those commands. I’d like to use these controls with a swerve drive, we don’t have a swerve chassis yet, but it is planned to be built over the summer.

2 Likes

Cool idea! You should suggest this to NI as a new input device for the Driver Station over here: Feedback for Driver Station - NI Community

I’ve been trying to get more folks to comment over there on changes to the driver station.

I’m not sure how this could be done without some serious work on either the DS or a very customized device to take input from a mouse and keyboard and pipe them into something the DS can understand.

1 Like

Perhaps send the mouse & keyboard input over NetworkTables?

The problem with using a keyboard as a “joystick” is that the buttons are…well…buttons. They’re either pressed or not pressed. As opposed to a joystick or gamepad which has analog inputs that can vary smoothly from 0 to 100%. And while the mouse does provide a non-boolean input, it doesn’t self-center so it will be difficult getting the robot to drive straight or stop.

Of course this isn’t to say that it’s impossible, or not worth exploring. Just some problems you’ll have to deal with to make it work.

5 Likes

I’ve driven a robot with keyboard before using some sort of keyboard-to-HID software. I forget which one, but it was pretty easy to get up and running. (edit: I think it was vJoy).

I even used a speech-to-keyboard program to drive by voice commands. (edit: Think it was VoiceAttack)

I wouldn’t suggest using either of those methods to drive in a competition or non-controlled setting.

Now I want to do this by inputting Keyboard and Mouse to a Raspberry PI and emulating a controller lol.

I guess mouse speed could be converted to right joystick? Definitely would have to add some limits to avoid burning motors/breaking things.

Rotationally, I guess you could have the mouse start at the origin and track it’s current x/y, then have the robot try to adjust to that as well.

Inb4 someone starts hitting some nasty flicks at competition next year.

The reason a mouse is usually the best input for an FPS game is because there’s no maximum speed that your camera can move, and no (practical) maximum speed the mouse can move. For a mouse to feel like a viable input for anything other than moving a camera around, it can take quite a bit of work. I’d love to see a robot being controlled by a mouse though, whether or not it was competition viable.

Our team originally landed on the control scheme that we did by copying the Halo Warthog controls, and copying a popular video game’s controls can be a good idea to reduce the learning curve of driving a robot. That being said, Minecraft controls (and all FPS games) do very different things than driving a robot, so it might be difficult to translate the inputs in a way that makes sense.

1 Like

Y’all out here trying to come up with new swerve control methods when the ideal is obvious and decently simple.

Infinite rotation paddle control, like the spinner wheel on Breakout or Tempest arcade cabinets that’s tied to field-oriented robot orientation (perhaps with a finger dimple for locating the “front”), and a standard flight stick for translation.

Fantastically intuitive, and the driver can set the robot orientation directly instead of sort of memorizing the timings on tilting or partially twisting the rotation joystick. You can even put indents and a light stopping mechanism (similar to a washing machine knob) on the spinner wheel for common orientations, like aligning with the rocket faces in 2019.

8 Likes

Perfect use for optical keyboard switches with analog control https://www.razer.com/technology/razer-analog-optical-switch

Keyboard to XInput app

A 3D CAD mouse would probably work. You push on the “knob” in both X and Y axis to create motion in X and Y and then you rotate the knob to produce rotation. So, this would actually reduce the swerve control to a single handed operation. The mouse actually has some buttons that could be programmed for something as well.

Something like this would give you a lot more buttons to program/play with for single handed operation of the robot.

The big downside to both of these is the need to have them resting on a work surface (as opposed to gamepad style controllers that you can hold at any position in the drivers area) so it becomes more difficult to move around to get better viewing angles if you line of sight is obstructed. And they are pretty expensive.

Of course, a flight simulator joystick and throttle style controller would also give you the X/Y translation and rotation controls on the stick plus a couple of buttons on the stick for controlling things like shooting. There is a slider and bunch of buttons for mechanisms on the throttle controller for everything else. So a setup like this would allow a single driver to control a fairly complex robot without needing everything to be automated.

1 Like

no

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.