Author Topic: Output plugins  (Read 9600 times)

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Output plugins
« on: June 06, 2013, 08:06:33 PM »
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.
« Last Edit: July 13, 2018, 03:16:38 PM by PiBoSo »
Obviously your ambition outweighs your talent

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #1 on: December 15, 2013, 02:58:08 PM »
Example source code updated to the latest interface.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #2 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.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #3 on: December 15, 2013, 05:06:16 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.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #4 on: December 15, 2013, 05:41:27 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

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #5 on: December 16, 2013, 12:40:20 AM »
Got the centerline stuff now, thanks !

MaX.

HornetMaX

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #6 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.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #7 on: December 16, 2013, 09:43: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.
Obviously your ambition outweighs your talent

HornetMaX

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #8 on: December 16, 2013, 02:12:11 PM »
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

  • Hero Member
  • *****
  • Posts: 5871
    • View Profile
Re: Output plugins
« Reply #9 on: March 01, 2014, 01:12:30 AM »
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.
« Last Edit: March 01, 2014, 02:26:42 PM by HornetMaX »

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #10 on: June 21, 2014, 08:38:47 AM »

Example source code updated to the latest interface.
Obviously your ambition outweighs your talent

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #11 on: September 17, 2014, 01:07:39 PM »

Example source code updated to add info about track centerline data.
Obviously your ambition outweighs your talent

janaucarre

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1022
    • View Profile
Re: Output plugins
« Reply #12 on: September 17, 2014, 02:51:13 PM »
Thx.

PiBoSo

  • Administrator
  • Hero Member
  • *****
  • Posts: 2439
    • View Profile
Re: Output plugins
« Reply #13 on: October 29, 2014, 07:36:19 PM »

Example source code updated to the latest interface.
Obviously your ambition outweighs your talent

h106frp

  • Hero Member
  • *****
  • Posts: 1811
    • View Profile
Re: Output plugins
« Reply #14 on: August 09, 2015, 08:43:41 AM »
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