Possible Robot Simulation GUI Bug: Logitech F310 Axis Switched

All:

As we have been porting our code to the new command API, I have found the Robot Simulation invaluable in making sure that the correct buttons/axis create the desired action on PWM ports, PCM outputs, etc.

However, today I was stumped why a part of the program that had worked before was not working. As our rookie year in 2019, we used the Logitech F310, and we started with that in 2020. Before we figured out we could use multiple joysticks, we were controlling a motor output with the left and right triggers on the 1st joystick. When we added a second joystick (another F310), we just kept the mapping to use the left and right triggers on the 2nd F310.

Here’s the problem: According to the documentation I have seen, and from the FRC driver station, here are the axis for the F310:

LogitechF310.h


/** The left thumbstick X axis channel /
constexpr int k_F310_leftThumbstick_X_axis = 0;
/
* The left thumbstick Y axis channel /
constexpr int k_F310_leftThumbstick_Y_axis = 1;
/
* The left trigger Y axis channel /
constexpr int k_F310_leftTrigger_Y_axis = 2;
/
* The right trigger Y axis channel /
constexpr int k_F310_rightTrigger_Y_axis = 3;
/
* The right thumbstick X axis channel /
constexpr int k_F310_rightThumbstick_X_axis = 4;
/
* The right thumbstick Y axis channel */
constexpr int k_F310_rightThumbstick_Y_axis = 5;

However, when I crank up the Robot Simulator, it appears to have the following mapping:


/** The left thumbstick X axis channel /
constexpr int k_F310_leftThumbstick_X_axis = 0;
/
* The left thumbstick Y axis channel /
constexpr int k_F310_leftThumbstick_Y_axis = 1;
/
* The left trigger Y axis channel /
constexpr int k_F310_leftTrigger_Y_axis = 4;
/
* The right trigger Y axis channel /
constexpr int k_F310_rightTrigger_Y_axis = 5;
/
* The right thumbstick X axis channel /
constexpr int k_F310_rightThumbstick_X_axis = 2;
/
* The right thumbstick Y axis channel */
constexpr int k_F310_rightThumbstick_Y_axis = 3;

So, I was getting no PWM output for the motor controller I was expecting, when I used the left and right triggers. When I used the right thumbstick, at least I got the controller to activate.

For some reason, it is also showing the Logitech F310 as an XBox Controller.

Any clues why the confused axis and mis-labeled controller?

STOP THE PRESSES!!!

In confirming this “bug”, I saw there is a checkbox called “Map Gamepad” in the Joysticks windows. When I checked this box, everything worked as expected, with the proper axis mapping.

So what does the “Map Gamepad” checkbox do?

I was going to delete this post, and then I thought I would leave it in case somebody else had the same “problem”.

Thanks in advance.

The simulation GUI uses a different implementation than the real DS does for accessing system joysticks. The “Map Gamepad” checkbox does exactly the behavior you describe: it tries to map the axes in the same way the real DS does for gamepads. The simulation GUI doesn’t have as robust of a detection mechanism for gamepads vs other types of joysticks, especially cross-platform, so it doesn’t automatically do this, but has a checkbox instead. The code that the “Map Gamepad” checkbox does is here: allwpilib/DriverStationGui.cpp at master · wpilibsuite/allwpilib · GitHub

1 Like

Thank you sir. Appreciate the response and the help!

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