• Welcome to PiBoSo Official Forum. Please login or sign up.
 
December 06, 2024, 04:35:57 AM

News:

World Racing Series beta14 available! :)


Trying to understand how plugin works

Started by Gurchur, July 12, 2018, 07:03:37 PM

Previous topic - Next topic

Gurchur

Hi everyone!! I am new in the forum and a new user of GPB.

I am doing a simulator of 3 axis but before knowing that GPB exists I only has in mind to create the analog signals from the encoders and sensors and make a bypass thow a joystick to control MotoGP. Now that I played GPB, the new potencial is huge and I woul like to get the data from the simulator to a program to control the motors.

The problem is that I do not understand well how comunicate with the .dll I created using the GPB_example.c

This is what I have done for the moment:

    1) I just created the .dll using labview CVI (is very similar to visual studio) using the GPB_example.c and creating a new .h with all the function names (but removing the "_declspec(dllexport)" .With both files I could create the .dll, copy it in the PlugIn folder of GPB and renamed as .DLO.
       When I go to the track the game suddenlly exit then I expect I am missing something (or all!! :).

       Regarding the custom program I need to do to get the data,  do I just make calls to the functions of the .dll or how I do that??, I really do not understand it, if anyone has any example of a program communicating continueslly with the GPB in .C and getting for example the spped of the bike would be a huge help and I believe I could start.

Many thanks for your help!!!





speedfr

Hello,

this kind of question is either for h106frp (who did the exact same process for catching FFB) and/or HornetMax who is the author of MaxHUD (overlay ingame) and MaxTM (telemetry).

Keep up  !!
Missing Gp500 (Microprose)  Testing EDTracker Pro on YT   R7-3800X/32Go/RX6800/1440p/Full WC

Gurchur

Many thanks Speedfr, I hope they (the master programmers  8) 8))  read the post and guide me a little  ;D


HornetMaX

Why are you removing the "_declspec(dllexport)" ? Without that I'm not sure the .dll will be correctly built.

I'm not familiar with the compiler you are using, it may have a different syntax to declare the function to export, but you'll have to do this one way or the other.
I use Visual Studio.

Also, assuming you want to send GPB output values (e.g. bike lean and pitch) to your external device, I'd probably think about using the proxy approach (proxy.dlo writes to a memory area and your external program can read from that from outside GPB, not from "inside" as with an output plugin).

Maybe h106frp can be of more help on this.

h106frp

I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device

HornetMaX

Quote from: h106frp on July 13, 2018, 09:57:49 AM
I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device
Curiosity: why do you need to compile proxy.dlo ? It comes with GPB no ?

Gurchur

Many thanks!!! for your answers.

I will use the proxy example as I did not know that in the other way was internal. I will try this afternoon checking the handle to the memory area. I will feedback you very soon.

Again +1000!!  ;D ;D

HornetMaX

Last comment: if your device needs to send signals to GPB, you may have to look at an input plugin too.

h106frp

Quote from: HornetMaX on July 13, 2018, 10:03:52 AM
Quote from: h106frp on July 13, 2018, 09:57:49 AM
I built my interface using the Proxy dlo.
The compiled proxy.dlo (I used codeblocks C for this) returns a handle to the shared memory area that you have created and I then used Visual Studio C++ to read from the shared memory space and manipulate the values before I sent them to my device
Curiosity: why do you need to compile proxy.dlo ? It comes with GPB no ?

I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo

It did not take long to do anyway.

HornetMaX

Quote from: h106frp on July 13, 2018, 01:27:17 PM
I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo
Had this doubt too but Pib confirmed the .dlo comes from the source code he publishes.
But why the different compiler ?


Gurchur

I am trying to create the proxi dll but  "direct.h"  file is missing, do you know from where I can get it?

Many thanks!!

HornetMaX

Quote from: Gurchur on July 13, 2018, 04:02:40 PM
I am trying to create the proxi dll but  "direct.h"  file is missing, do you know from where I can get it?

Many thanks!!
It's a windows/microsoft file. If your compiler does not provide it, it may use a different header for the very same functions. Google around.

h106frp

Quote from: HornetMaX on July 13, 2018, 01:34:29 PM
Quote from: h106frp on July 13, 2018, 01:27:17 PM
I guess I just wanted to be sure my data structures would agree and was not completely sure if the demo code was a direct example of the current proxy.dlo
Had this doubt too but Pib confirmed the .dlo comes from the source code he publishes.
But why the different compiler ?

It was just very easy to build it in codeblocks  :)

Gurchur

Hi Guys!!

I found some time and I finally developed the Code to interface with GPBikes. Thanks to all you its working great but I have some questions and doubts that maybe you have the answer:

1: Pitch-Yaw-Roll angles: they seems to be changed as Pitch is giving me the suposed Roll angle (lean) and the Yaw is giving me the Picth.  Also the Roll is giving me back huge angles (similar yo the Picth data), do you know why could be?
2: the speed: I tried to take the bike speed from Xvelocity and YVelocity but do not macth the one the game is marking. Then I used the FWheelSpeed and the speed seems to be similar but 10% lower, strange.
3: Gear: the m_iGear integer gives me a number that its changing all the time, no matter the Gear used (10950188675 and similar)
4: Steer: this variable changes from 0 to 1 and some times It's value is between (0,1) do It relates with the Steer forces or position?
5: Steer Torque: its always giving 1,4238. This should be moving?

Thats all!!! Many thanks for your help!!! In 1 month I Will start with the hardware, I am really exited about It!!

Many thanks!!


h106frp

Are you using shared memory space? if so it is most likely that the variable sizes (bytes) that you have declared do not match the ones defined.