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

axis_l and axis_r: signal for centered position is missing #29

Open
Vrumf0ndel opened this issue Aug 9, 2023 · 4 comments
Open

axis_l and axis_r: signal for centered position is missing #29

Vrumf0ndel opened this issue Aug 9, 2023 · 4 comments

Comments

@Vrumf0ndel
Copy link

Vrumf0ndel commented Aug 9, 2023

Hi everyone. For my application, I need to measure the time a button or stick is pressed or moved.
This works fine for all buttons.
Also the trigger buttons axis range is from 0.000 to 1.000 as expected.

But the axis axis_l and axis_r values are only set if value is above treshold, but never on centered position.
I'm missing the value 0.000 0.000 to detect centered position.
Without I can't distinguish between stick is released or hold on that position.

Axis axis_l moved to 0.000 -0.230
Axis axis_l moved to 0.000 -0.578
Axis axis_l moved to 0.000 -1.000
Axis axis_l moved to 0.000 -0.871
Axis axis_l moved to 0.000 -0.378

Axis axis_l moved to 0.000 0.417
Axis axis_l moved to 0.000 0.702
Axis axis_l moved to 0.000 1.000
Axis axis_l moved to 0.000 0.802
Axis axis_l moved to 0.000 0.513

Axis axis_l moved to -0.255 0.000
Axis axis_l moved to -0.293 0.000
Axis axis_l moved to -0.394 0.000
Axis axis_l moved to -0.455 0.000
Axis axis_l moved to -0.957 0.000
Axis axis_l moved to -1.000 0.000
Axis axis_l moved to -0.959 0.000
Axis axis_l moved to -0.239 0.000

Axis axis_l moved to 0.234 0.000
Axis axis_l moved to 0.368 0.000
Axis axis_l moved to 0.667 0.000
Axis axis_l moved to 0.865 0.000
Axis axis_l moved to 1.000 0.000
Axis axis_l moved to 0.791 0.000
Axis axis_l moved to 0.481 0.000
Axis axis_l moved to 0.268 0.000

Also tried with second controller, but it's the same output.

@Vrumf0ndel Vrumf0ndel changed the title axis_l and axis_r: signal for resting position is missing axis_l and axis_r: signal for centered position is missing Aug 9, 2023
@Vrumf0ndel
Copy link
Author

Vrumf0ndel commented Aug 12, 2023

The issues were found in latest release v1.1.2 from Jul 20, 2018.

Now I've tried the latest files from unreleased master branch, and the issues were solved.
Also the hat/dpad issues with not signaling rest position are solved.

@linusg Please provide an official release with the latest changes.
Thanks in advance.

UPDATE: The issue is not solved.
I experimentally changed the source code but didn't have it in mind when I wrote this post.

@Vrumf0ndel
Copy link
Author

The issue is in controller.py line 300:

    def axis_callback(self, axis, val):
        if (
            axis.when_moved is not None
            and abs(val) > self.axis_threshold
            and callable(axis.when_moved)
        ):
            axis.when_moved(axis)

The callback is only done if the value is above treshold.
So it never signals the rest zone of the stick or the hat/dpad.

@Vrumf0ndel
Copy link
Author

I found an interesting article about implementing deadzones and their different effects:
Understanding thumbstick deadzones

I will try to find a solution by implementing such a deadzone by myself.

@lerrylei
Copy link

Were you ever successful in finding a solution to this problem?

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

No branches or pull requests

2 participants