• Welcome to Kart Racing Pro Official Forum. Please login or sign up.
 
May 10, 2024, 10:36:16 PM

News:

Please read the FORUM RULES


Visual C++ Telemetry Sample Project

Started by SimRacer, January 07, 2011, 02:23:10 AM

Previous topic - Next topic

SimRacer

January 07, 2011, 02:23:10 AM Last Edit: January 09, 2011, 10:59:43 PM by BanjoDubs
Here is a sample project for those who would find it useful. It basically wraps up the sample code provided by Piboso into visual c++ and compiles the dll.

I was thinking that this could be modified/contributed to by other members to create some sort of proxy so that the sim only has to serve one dll, then other callers can grab it at their own rate from a memory map or other suitable device. This has a few advantages, firstly it would reduce the possibility that somebody writes a dll that is not right and causes a drop in frame rate, and also it means KRP only has to process the task of passing the telemetry to one dll which would have a good effect if there ends up being a lot of plugins made for the software over time.

Would like to hear other people thoughts.

maxhurtz

Many thanks SimRacer, just what I was looking for.

SimRacer

Your welcome! Hope you find it useful!

maxhurtz

OK, I've got around to trying it, but am having no luck.
I have built the project with Visual C++ Express 2010 on 32 bit Windows Vista SP2.
Copied the dll into the KRP plugins directory and ran KRP and carried out a short testing session.
No sign of the log file (telemetry_output.txt) being created. Looked in the install folders and Documents\PiBoSo\Kart Racing Pro\.
Using ProcessMonitor I can see that it finds the dll, but it does not seem to successfully be calling any of the functions.

I even tried moving the install folder out of Program Files, in case it was a permission problem. Still no output.
The telemetry.dll supplied with KRP works fine - creates the logdata.csv file in Documents\PiBoSo\Kart Racing Pro\.
I removed that dll before testing the new one.

I noticed that this example returns 4 from a call to Version(), whereas the proxy example that PiBoSo has supplied returns Version 5. I assume that KRP beta 3 can handle either.

thanks for any light you can shed on the matter,

John

PiBoSo

Quote from: maxhurtz on August 21, 2011, 04:42:32 PM
I noticed that this example returns 4 from a call to Version(), whereas the proxy example that PiBoSo has supplied returns Version 5. I assume that KRP beta 3 can handle either.

For a plugin to be loaded by Beta3, Version function must return 5.

maxhurtz

OK, I changed it to 5, but still no luck.

Would posting a copy of my dll help?

thanks

John

PiBoSo

Quote from: maxhurtz on August 21, 2011, 07:13:04 PM
OK, I changed it to 5, but still no luck.

Would posting a copy of my dll help?

thanks

John

It sure wouldn't hurt :)

maxhurtz

Here you are.
The file created should be "telemetry_output.txt".

Thanks for taking a look.

John

PiBoSo

Quote from: maxhurtz on August 21, 2011, 11:02:29 PM
Here you are.
The file created should be "telemetry_output.txt".

Thanks for taking a look.

John

It is correctly loaded, but it crashes.
Please make sure the structures and functions are updated to the latest version.
The sample project is probably using the old interface, instead of the new one, that can be found in "krp_example.c": http://www.kartracing-pro.com/?page=downloads

maxhurtz

August 22, 2011, 12:21:32 AM #9 Last Edit: August 22, 2011, 12:24:58 AM by maxhurtz
It works!

You were right, the structures were out of date (specifically the Event struct). Just copied the ones from krp_example, and removed the code that referred to the missing field (m_afLimiter[]) and it now works perfectly.

Thank you very much,

John

SimRacer

Yep, the project needs to be updated as new versions of the interface become available. If you get around to using it and update it, please think about attaching a copy for others to download. Sorry that I have not had a chance to update it myself.

jarowww

I was trying to play with live telemetry data representation, but well this didn't work out. I'm left with MVS2010 project so i thought someone may find some parts of it useful. I'm also attaching piboso example code inserted into project.
If someone want to check how program works there is dll. Program creates window that displays kart speed and speed of best lap so game need to be in windowed mode.

dibu

Very nice toy jarowww, I like it. ;D

I used a second monitor for the diagrams and so I still could drive KRP fullscreen on my beamer.

Hehe, but it doesn't make me faster because it draws off my attention... ;)


jarowww

QuoteHehe, but it doesn't make me faster because it draws off my attention...
This is exactly why this won't work. You can't look at window in corners or short straights you need to wait for long parts to check data, even then you can deconcentrate. And most importantly higher speed through corner doesn't always mean faster (i can drive on outside edge of corner and carry more speed). I was thinking about dividing track in maybe 1000 places and displaying difference to best lap (something like racing ghost) but still same problems apply.

dibu

For a real time system it would be interesting to use the dashes of the onboard display. They are easy and fast readable.
If we could define multiple small splits which include the braking point to a corner and the following straight until the breaking point to the next corner, this would help very much. ATM each split contains multiple corners and it's hard to say where you really lost the time.