Manipulate Joystick Data

Talk about anything concerning the source code.
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Thanks Matlo.

I have a C-Funktion which prints first: The event type, afterwards the array length and finally the value of the axes. Does it work with the printf-statement, that GIMX can understand the report? Or do I need to have a send-function for the report? How can I get my bytes into the report?
Sorry for this many questions :lol:

Thanks in advance

AND_1
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Hi Matlo,

I have a function, which generates the byte array, but now I am not sure how to send this report to GIMX. Is there a specific function from GIMX to send it? Or how I am going to do this? Or do I need to write this function? Maybe you can give me an advice how to do that and what I need to take into account.

Thanks in advance.

AND_1
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Manipulate Joystick Data

Post by Matlo »

GIMX creator
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Hi Matlo,

until now I made a function which builds a String that contains the Linux commands (e.g. gimx --event "rel_axis_0(32767)" --dst 127.0.0.1:51914) and when I start this c-programm it executes the String as a terminal command using the execv-funktion. It works but I have massive latency issues or missing package issues. Is it a problem of the refresh period? Is it possible to get it work without these delays or that it works like using the physical device option instead of the networking option as input? Maybe I can avoid this issue by sending the byte array as you recommended?

Hopefully you can help me with this. Thanks for your help :)

AND_1
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Manipulate Joystick Data

Post by Matlo »

Hi,
Creating a new gimx process for each update adds a massive overhead, which is why you should send the updates over a UDP socket.
I'm sorry but I do not have much time to help on this matter, and helping you without seeing the source code will consume a lot of time.
GIMX creator
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Hi Matlo,

Thank you for your response. I am sorry to take this much time from you. But now I am on a point, that I am not sure if this is a possible solution for me. I made the Byte-Array and I am sending it via UDP-Socket to the IP:Port (127.0.0.1:51914) . But it seems to have the same latency issue like my other method. I think the remote function on the Raspberry Pi is too slow and can't refresh fast enough. Or do I create a new GIMX-Process each time I send the package? I am confused.

Steps I made:

1. Implement Joystick Function like the documentation from the Joystick-API
2. Switch-case for differentiate between all axes and buttons. Also filling the Byte-Array looking at the Network-API and Controller Maps Section.
3. Sending this Array via UDP Socket to the IP:Port recommended from GIMX.

It works, but the latency is a huge problem. How am I able to fix this problem? Or is there any other way to go for me at this point?
If you need the source code you only have to say it. It is just a short and easy program.

Thanks in advance and thanks for your time :)

AND_1
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Manipulate Joystick Data

Post by Matlo »

Post your code and I'll have a look.
GIMX creator
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Hey Matlo,

Am I able to send the code to a private mail for you? Or a GIMX-Support mail?

Thanks in advance

AND_1
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Manipulate Joystick Data

Post by Matlo »

Just post it in a code tag.
GIMX creator
AND_1
Posts: 14
Joined: Wed May 31, 2017 8:20 am

Re: Manipulate Joystick Data

Post by AND_1 »

Hey Matlo,

thank you that you always want to help. But I know you didn't have much time, so I decided to work it out on my own. And I had success on the code part. But at the moment I have some general problems with GIMX. Maybe you can help me with that, because it is more related to your project.
Is it a problem to use a physical device (G27) and the DIY USB-Adapter (bought from your shop) on the RPI3 USB-Hub at the same time? Because I get issues with the forcefeedback and the "libusb failed" messages appear on my screen. I also noticed, that this problem is more frequent when starting GIMX from the command line instead of the GUI. Or is it recommended to build the adapter like in your tutorial on the SPI-Interface? Is there any difference? It also stops working and my G27 Wheel has its Green LED on the H-Shifter blinking.
Is there a solution on this problem? I already read about it, but didn't find a solution for my problems.
Maybe a firmware problem or a power supply issue? I am using a power supply adapter which was included in the RPI3 package. (5V 2,5A).


Thanks in advance,

AND_1
Post Reply