• Welcome to PiBoSo Official Forum. Please login or sign up.
 
March 28, 2024, 09:10:39 PM

News:

GP Bikes beta21c available! :)


Output plugins

Started by PiBoSo, June 06, 2013, 08:06:33 PM

Previous topic - Next topic

PiBoSo

June 06, 2013, 08:06:33 PM Last Edit: July 13, 2018, 03:16:38 PM by PiBoSo
It is possible to write a DLL that receives data from the simulated bike in realtime.

Example source code can be downloaded at http://www.gp-bikes.com/?page=downloads

Please note that all function calls are blocking, so control should be returned to simulation as soon as possible to avoid framerate issues.

The DLL must be compiled for 64 bit.

The plugin must have the file extension renamed to DLO and it must be copied to the "gpbikes/plugins" directory in GP Bikes installation folder.

NOTE: a license is not needed to add plugins.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

PiBoSo

Example source code updated to the latest interface.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

HornetMaX

What has changed ? I've seen the GetModDataVersion has been moved to 2 (from 1), but is there anything else ?

I don't see the centerline stuff.

MaX.

PiBoSo

Quote from: HornetMaX on December 15, 2013, 03:21:12 PM
What has changed ? I've seen the GetModDataVersion has been moved to 2 (from 1), but is there anything else ?

I don't see the centerline stuff.

MaX.

m_szEngineMapping has been added.
Example source code updated to include the TrackCenterline definition.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

HornetMaX

Quote from: PiBoSo on December 15, 2013, 05:06:16 PM
Example source code updated to include the TrackCenterline definition.
Can't see it yet in the download section: gpb_example.c is still as before (nothing related to the centerline).

MaX.

HornetMaX

Got the centerline stuff now, thanks !

MaX.

HornetMaX

Now that I try to play with it, I do think that it would have been much better to have the centerline stuff (int _iNumSegments, SPluginsTrackSegment_t *_pasSegment) passed as extra arguments of EventInit instead of introducing a new function (TrackCenterline). As the info is track-related, it makes sense for it to be in EventInit.

MaX.

PiBoSo

Quote from: HornetMaX on December 16, 2013, 02:02:21 AM
Now that I try to play with it, I do think that it would have been much better to have the centerline stuff (int _iNumSegments, SPluginsTrackSegment_t *_pasSegment) passed as extra arguments of EventInit instead of introducing a new function (TrackCenterline). As the info is track-related, it makes sense for it to be in EventInit.

MaX.

It makes sense to have different functions, because those writing a dash plugin, or a telemetry plugin, can completely skip the centerline.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

HornetMaX

Quote from: PiBoSo on December 16, 2013, 09:43:21 AM
Quote from: HornetMaX on December 16, 2013, 02:02:21 AM
Now that I try to play with it, I do think that it would have been much better to have the centerline stuff (int _iNumSegments, SPluginsTrackSegment_t *_pasSegment) passed as extra arguments of EventInit instead of introducing a new function (TrackCenterline). As the info is track-related, it makes sense for it to be in EventInit.

MaX.

It makes sense to have different functions, because those writing a dash plugin, or a telemetry plugin, can completely skip the centerline.
Well, ignoring two extra arguments doesn't seem very complicate.
On the other hand, as the number of quads will be only known once TrackCenterline is called, one has to defer the allocation until then (previously I was allocating everything at EventInit).

This is not a bug deal, but is TrackCenterLine called always ? Even when a track has no centerline ?

MaX.

HornetMaX

March 01, 2014, 01:12:30 AM #9 Last Edit: March 01, 2014, 02:26:42 PM by HornetMaX
Quote from: PiBoSo on December 15, 2013, 05:06:16 PM
Quote from: HornetMaX on December 15, 2013, 03:21:12 PM
What has changed ? I've seen the GetModDataVersion has been moved to 2 (from 1), but is there anything else ?
m_szEngineMapping has been added.

Hmm, I'm working on some telemetry stuff (plugin to log data in binary format and external app to visualize it).

I'm not sure that having "char m_szEngineMapping[100];" in each Telemetry data point is a good idea ... 100 bytes at each point when a simple integer (index of the mapping) could do the same work (more or less). Maybe the Mapping names (strings) can be provided in ther Event structure, so that the int can directly reference them.

No big deal, as most likely I'll write out individual values instead of the entire structure.

MaX.

PiBoSo


Example source code updated to the latest interface.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

PiBoSo


Example source code updated to add info about track centerline data.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

janaucarre


PiBoSo


Example source code updated to the latest interface.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

h106frp

Bit confused, but am i right in understanding GPB should make the call to this function 'Startup' when the program starts?

FILE *g_hTestLog;

/* called when software is started */
__declspec(dllexport) int Startup(char *_szSavePath)
{
   g_hTestLog = fopen("gpbikes_log.txt","wt");
   if (g_hTestLog)
   {
      fprintf(g_hTestLog,"Startup\n");
   }

   /*
   return value is requested rate
   0 = 100hz; 1 = 50hz; 2 = 20hz; 3 = 10hz; -1 = disable
   */
   return 3;
}

I cannot see the file 'gpbikes_log.txt' on my system which suggest this never executes. As it also sets the data rate for GPB output i cannot see any reason to call it from my host.
Where would the default path for log file be?

Am i right jn assuming the rate the is how often the shared memory area information is refreshed?

Thanks