Sending axis values via UDP don't work as expected (straight axis movement not possible)

Need help? Ask here and someone will help
Post Reply
cataz
Posts: 14
Joined: Thu Dec 05, 2019 12:04 pm

Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by cataz »

Hi all :)

My application is reading my input hardware left stick x, y inputs (xbox one elite) via xinput. The input values are in the range of [-1.0f, 1.0f]. It converts them by multiplying 32767 to comply to the gimx values and sends them to gimx via network as described by http://gimx.fr/wiki/index.php?title=Net ... end_report
If I try to press my input hardware stick straight to the right, left, up or down on console it results in diagonal movement.
What are possible reasons for that issue?

Note: If I click on gimx launcher -> file -> edit it says "cannot open conf file: ip:port". I thought this is ok since I want gimx to interpret the values as they are. Is that why minimal axis values cause diagonal movement?
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by Matlo »

Please post a log file as requested in forum rules: viewtopic.php?f=5&t=691
Make sure to reproduce the issue while generating the log file.
GIMX creator
cataz
Posts: 14
Joined: Thu Dec 05, 2019 12:04 pm

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by cataz »

My bad for not following the rules Matlo, I'm sorry.

Cronus device
PS4 pro
Its not game relevant I guess but e.g. fifa 20

Full log file:
https://pastebin.com/kPCta28D

Interesting parts in my view:

Code: Select all

0 1576347777.335010, lstick x (32765), lstick y (282)
0 1576347777.347642, lstick x (32766), lstick y (185)
0 1576347777.360153, lstick x (32766), lstick y (39)
0 1576347777.372750, lstick x (32766), lstick y (39)
0 1576347777.385533, lstick x (32766), lstick y (-95)
0 1576347777.397202, lstick x (32766), lstick y (-192)
As you can see I'm trying to walk straight right but the little y values seem to cause diagonal movement. Of course I could add a treshhold and set the y values 0 in my app but I'm guessing from a native controller these values wouldn't cause diagonal movement do they?
cataz
Posts: 14
Joined: Thu Dec 05, 2019 12:04 pm

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by cataz »

Will there be any support for this issue please?
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by Matlo »

GIMX forwards what the client sends.

The issue is due to the joystick and/or your code. In both cases the only way to fix it is to tweak your code to add a dead zone, or a non-linear sensitivity.

Did you try using GIMX as a client? Does it show the same issue?
GIMX creator
cataz
Posts: 14
Joined: Thu Dec 05, 2019 12:04 pm

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by cataz »

Hi Matlo, thx for answering I greatly appreciate your time.

Gimx is working fine. It was naive to think I could just pass the xinput values to the gimx and the game will behave like manual input. My thought was: if I use a similar joystick as the ds4 sending the values from the axis as I read them would be the same as pushing the analog stick with my thumb.

As you can see I don't have much knowledge about this. Since you are experienced I'm sure you know what knowledge is missing here. Are there any links in your mind or tips how I should proceed? I quickly added something like a "deadzone" and straight movements are now possible. Thanks! I now have a problem when I'm trying to do slight diagonal movements they look like stairs :lol:
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by Matlo »

Something to check is if xinput provides raw or modified events.

List xinput devices using:

Code: Select all

xinput --list
Then show xinput events using:

Code: Select all

xinput test "device name"
(replace "device name" with the name of your joystick)

Install evtest and jstest:

Code: Select all

sudo apt install evtest joystick
List event devices using:

Code: Select all

evtest
Then show joystick events using:

Code: Select all

jstest /dev/input/eventX
(replace X with whatever your joystick device number is)

Then have a look at xinput and joystick events simultaneously. Check if they are the same or not. If they are not the same, don't use xinput.
GIMX creator
cataz
Posts: 14
Joined: Thu Dec 05, 2019 12:04 pm

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by cataz »

Thank you very much matlo.

I have been reading the source code for the past 2 days with my very little C knowledge and I'm amazed by your work! Really appreciate all the effort you put into this. Also I wanted to start the donations for 2020 with a little contribution ;)

For now all my questions are gone and I have a plan to continue my work. See you soon in the forums :lol: ❤️
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Sending axis values via UDP don't work as expected (straight axis movement not possible)

Post by Matlo »

Thanks for the donation :)
GIMX creator
Post Reply