Hello!
I'm currently trying to get telemetry from the game, and have had some success by modifying the truck.lua to save the wheel rpm, ground speed, engine tension (difference between what you've asked for, and what the engine can/is giving), selected gear, and some other basic things.
I'm wondering though, what other properties do the wheels and truck objects have? I tried dumping it to a table using something along the lines of:
for key, value in pairs(truck) do
.....export each key and value pair from the table
end
but it didn't seem to work for some reason.
Gives me:
K is: isBreakPulled, V is: K is: prevGear, V is: -1
Which is great, but I'd prefer more!
Anyone with more lua experience, or a dev able to shed some light on some of the other properties of the objects?
The ones I've got thus far are:
-
truck.engineTension
-
truck.heavy (seems to follow tension closely, but shows a greater difference)
-
truck.turbo (doesnt seem to give any output)
-
truck.trans(also, nothing, and neither does truck.transReverse)
-
truck.revving (seems to indicate the clutch being down, as it goes high on gear change, but engine tension remains the same, more or less...So not sure)
-
wheel.radius (this seems to come from the xml file for the specific wheel)
-
wheel.angVel (angular velocity - this is the rotational speed of the wheel I think (i get these two mixed up though...)
-
wheel.linVel (Linear velocity - correlates with ground speed - +value for forward, -value for reverse
-
difference between angVel and linVel gives you a nice wheel spin factor
Currently, I've got some key ones exporting to a csv file so I can plot them in excel (or read them in Python and parse the result onto an arduino - driving a voltmeter as a speedo/rpm gauge etc.
If you want my code (its not very neat) :
if (truck.engineTension > 0.0001) then
file = io.open("rpm.csv", "a")
io.output(file)
io.write("\n")
io.write(GetTruckEngineTension(truck))
io.write(",")
io.write(groundspeed)
io.write(",")
io.write(angularspeed)
io.write(",")
io.write(gear)
io.write(",")
io.write(truck.revving)
io.close(file)
end
This lives in the ProcessTruck function, so it is called regulally. It dumps it all to a CSV file called rpm.csv (because I was trying to find the rpm)
There are two global variables, groundspeed and angularspeed, which are defined under process wheels...