Skip to content
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

Initializing the axis values with 0 #266

Closed
wants to merge 3 commits into from

Conversation

padhupradheep
Copy link

As reported in the issue #263, SDL sets the max negative value to the axis during initialization of joystick.

Since it's event based, we had to trigger the gears in order for the axis values to be set to 0, before pressing the deadman button. With this update, the axis values will be initialized with 0, meaning that, there is no requirement of manual calibration.

Of course, when the deadman button or any of the button is pressed for the first time, all the axes values are set to 0 by the SDL. Since it's event based mechanism, those zeros on the axes aren't read, but rather the joy node takes the initial state defined by the SDL. With this PR, the issue is taken care of.

@padhupradheep
Copy link
Author

By the way, this issue is not there in the SDI2 Game controller, just in case if you were planning to pull in #258

@JWhitleyWork
Copy link
Contributor

JWhitleyWork commented Sep 18, 2023

Unfortunately, I don't think there is a "correct" solution to this problem. The issue is that axes represent both triggers (range -1 to 1 with default being -1) and stick axes (-1 to 1 with default being 0) and there is no way to differentiate them. It's an inherent problem in the way that the inputs are represented and can't be solved globally.

@padhupradheep
Copy link
Author

padhupradheep commented Sep 19, 2023

Hmm 🤔

Speaking in terms of the Logitech joystick, the axis are the left analog, the right analog and the D pad. For the D pad, by default, the axes values are already set to 0 and the values of analog sticks are set to 1, which is what is causing the issue.

https://www.logitech.com/assets/34885/3/f710620-002923003403gswamr.pdf

Of course, for the other controllers, there are shoulder buttons like you said, which also acts as a trigger axes and the default value is -1. I understand the problem.

As an alternative, I think SDL allows to read the type of joystick. Would that addition convince you to merge the fix first for the logitech joystick? Maybe later, we can adapt the same strategy for the other joysticks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants