@Sodoma, Ah nice! You guys have taken the idea and run with it! I've been busy with teaching for the past couple of weeks, so haven't been able to look any further into this.
Still the question though, the truck object (and the wheel objects too...), what other properties do the objects have? Ideally I'd like something like truck.name - then we can have a lookup table for gear ratios.
In @Pavel 's explanation of engine mechanics, you're referring to a number of variables from the xml file, eg fGearAngVel. Is this exposed to any of the objects/classes in the lua?
The wheels object, for example, takes wheel.radius from the wheel XML, same with wheel.width.
Ah, fair enough
This is my shifter:
Need to do some lettering, some sort of cover on the threaded bar, and maybe a new knob... Doesn't look nearly as professional as yours though!
Just powering it through an Arduino Micro - using up 8 digital pins, but I wasn't really planning on adding much more to it..
[0_1519040481839_truck.lua](Uploading 100%) Ah nice! Yea, interim method of getting RPM, like you mentioned on Discord, would be a lookup table for each truck..
Would be easier if we pass the data to Python - then we could have a little GUI allowing for easy truck selection
The fact that the game passes some details from the xmls through to the lua script (like the wheel radius), there must be other parts of the xmls that can be accessed.
I wonder whether wheel radii are different enough to be used as a "fingerprint" for the different trucks...Probably not
Some of the trucks have reasonably unique radii, the K700 for example, but most share wheels with other vehicles, for example, the D535 has the same wheels as the E7310
Figured out how to get AWD, diff lock and handbrake status to file. Was trying to write a boolean to file, and it wasn't having it, so converted to string and its all good.
Headings for the CSV would be:
Tension, Ground Speed, Wheel Speed, Gear, Wheel Radius, Revving/Clutch?, Class, All Wheel Drive, Diff Lock, Handbrake
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.
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.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...