Hi. Why, oh why, are mLapDist not in the TelemInfo? In the scoringinfo it only gets updated twice per second, right? I have no idea about what can be done with all the coordinates available. Can I somehow calculate the LapDist every tick?? /Lars
Are you sure you need that sort of accuracy? I don't know what your goal is, so it's hard to judge. If you assume someone is going to be following the track closely you can just use their speed on each telemetry update to add a 'covered distance' to the last scoring mLapDist. You might need to correct a bit on each scoring update but would that be noticeable for your application? You could monitor the 'telemetry distance' and compare it to the 'scoring distance' in order to gauge whether the driver is currently following the track well, if you're worried about someone driving off on a tangent. Again, depending on your application, the half-second precision might well be enough with some correction of this nature.
Thanks for answering, Lazza. Thing is, I'm trying to build a "map" of a driven lap, where I have a precision of 1 meter. For each point in this map, I store that laps current laptime. This map is used for calculating delta-values on the fly, and time to other drivers, etc. I used that for iRacing (untill last build, where they included those delta-times in the telemetry) and have the code in place for this. It would just be nice to re-use that for rFactor.
I stumbled across this issue as well but it's pretty easy to solve. In the plugin there is a lap number value that is updated every time step. Create your own lap distance var, and for each time step you can get the distance travelled by doing the delta between the current elapsed distance and the last elapsed distance and then add that to you own lap distance var. Each time the lap number chanages you need to reset the lap distance back to 0. This should be accurate to a < 1m which should be close enough I think for what you are trying to do? Let me know if you need more details.
I can't see any "direct" DeltaDistance in the InternalsPlugin, but I have been using mDeltaTime * Speed to do what you propose. This works pretty well, but I still don't understand why the mLapDist is not in the TelemInfo instead of the ScoringInfo...
Sorry, I gave the slightly wrong info. I have just had a look at my code and I do something similar to you, eg Code: // build the speed values const double metersPerSec = sqrt( ( info.mLocalVel.x * info.mLocalVel.x ) + ( info.mLocalVel.y * info.mLocalVel.y ) + ( info.mLocalVel.z * info.mLocalVel.z ) ); // check if we need to set the initial time value if (lapTimeStart == -1) { lapTimeStart = info.mElapsedTime; } // update the current lap time and distance double currentLapTime = info.mElapsedTime - lapTimeStart; double distance = metersPerSec * info.mDeltaTime; lapDistance = lapDistance + distance; // if we have a new lap we need to reset some of the lap vars if (info.mLapNumber != lastLapNumber) { // blah blah reset the lap time and distance etc
What about using the x, y coordinates from the TelemInfoV01.mPos for doing your map? It's updated every time telemetry info is provided and is a 3D vector. If you use just the lap distance and have some significant inclination in the track (e.g. Nordschleife, Circuits of America) you might make a failure greater then what the missing accuracy!
Yes. That is the approach I followed when trying to increase accuracy of the Delta Best plugin. I keep an internal variable to track the distance traveled (in meters) between each ScoringUpdate tick (0.2 s). That variable is reset to zero when the ScoringUpdate ticks. I calculate this distance by just using -z velocity times dt. It's crude but works well enough for the DeltaBest. Source code is available if you want to have a look.