The online racing simulator
InSim : MCI.Info[].Speed calculation problem
Hi,

I want to convert the speed value of MCI.Info[].Speed packet to Km/h. I do this with:
(MCI.Info[0].Speed * 0.003050082352223510034770938815348f) * 3.6f

It works fairly well, but there is a little difference with the real driving speed. Like if I'm driving 210 Kmh, this calculation will output something like 207. I also notices that when I'm standing still the MCI speed value is 3, and the output value is then 0.0329408869147301.

I don't know how to solve this problem, help would be appreciated.

Note that I'm on a 64-bit OS.
#2 - Knu
Quote :* 0.003050082352223510034770938815348f

That's not accurate. You'd better use (32768 / 100) or at least 0.0030517578125
Quote :Like if I'm driving 210 Kmh, this calculation will output something like 207.

IIRC, the speed you see in LFS is the speed that your wheels are rotating at, whereas the MCI speed is the speed the car is moving at.
Quote :I also notices that when I'm standing still the MCI speed value is 3, and the output value is then 0.0329408869147301.

You mean, ~0.032 KPH? That's down to precision. What's the problem with that anyway? BTW, if you want to detect if a car is standing still, do NOT use "if (Speed == 0)"

Hope that helped.
Nope, that didnt work. I attacked a screenshot, maybe it helps.
Attached images
problem.JPG
#4 - Knu
I see nothing wrong, the debug data looks correct.
Quote :IIRC, the speed you see in LFS is the speed that your wheels are rotating at, whereas the MCI speed is the speed the car is moving at.

Quote :IIRC, the speed you see in LFS is the speed that your wheels are rotating at, whereas the MCI speed is the speed the car is moving at.

I know, but I tried it with bf1, I was driving 351 for a few seconds and the output was 346. So if this is the case then the measurement on the wheels wouldn't be correct?
#6 - Knu
The wheels slip a bit probably

So yes, not quite correct.
Well ok, fine.

Thanks for your help and time.

FGED GREDG RDFGDR GSFDG