xbox360controller icon indicating copy to clipboard operation
xbox360controller copied to clipboard

axis_l and axis_r: signal for centered position is missing

Open Vrumf0ndel opened this issue 10 months ago • 4 comments

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 avatar Aug 09 '23 07:08 Vrumf0ndel

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 avatar Aug 12 '23 22:08 Vrumf0ndel

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 avatar Aug 13 '23 10:08 Vrumf0ndel

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.

Vrumf0ndel avatar Aug 13 '23 11:08 Vrumf0ndel

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

lerrylei avatar Mar 16 '24 18:03 lerrylei