Closed jake-baxter closed 2 years ago
Hi @jake-baxter
I don't really play the Train Simulator any longer, so won't be able to debug this with you.
Out of interest - how do you call this library?
Are you calling set_rail_driver_connected
prior to reading any values?
Do you have a background process reading the values and writing them to a text file at intervals as you use the simulator?
Maybe any of this will help.
I have the game loaded, and to test I open up the idle and do the following: import raildriver rd = raildriver.RailDriver() -- I don't have to define the location because it finds the correct path anyway rd.set_rail_driver_connected(True)
After doing this I have done this: rd.get_controller_list()
but it returns an empty array - []
Also to that, calling other values such as "SpeedometerMPH" just gives a plain 0
I think you're doing everything right then. Sorry to hear it's no longer working.
Alright, I have tried the last thing that comes to mind, and it has worked. It only works on 32-bit version, do you know any way to try and get it to work with 64 bit?
Nevermind, it does work! I was running 32-bit python for some reason and it is now working. Thankyou very much for your help.
Sorry for bothering again, is there a guide to get a certain value and it has the integer required?
Sorry by this I mean like a guide of Controller ID's
I don't think it's that easy to be honest, because different vendors use different naming conventions.
Only the reverser seems to be consistently referred to as a Reverser
, other controllers are a mess.
You can see this in action at: https://github.com/piotrkilczuk/railworks-dsd/blob/bf3c72801cd9d4779ee2f3a1bb89590dbbd88f7c/dsd/machine_models.py#L99
What I've done in the past is simply recording all the controller values at preset intervals into a CSV file whilst taking the train for a test drive...
Thats annoying :/
Thankyou for your help and sorry to keep on bothering you, one more question, is it possible if I can do functions such as get the next signal?
I don't think anything like that is available via the raildriver.dll
.
Maybe for some locos, it is though. Those that come with cab signalling of some form like the German LZB are likely to have a controller that gives you an indication of the next aspect.
I haven't noticed anything like that in the British locos.
Alright, sorry for asking but I have another question as it may actually be possible, is it possible to get the current route using raildriver, and also an actual train speed (since different providers use different controller values)
is it possible to get the current route using raildriver
There is a way, I think, but not directly.
Raildriver.dll is capable of reporting the lat/lon coordinates, so you could work out what is your nearest station as these should be pretty much the same as the real-world coordinates. I suppose Network Rail makes this kind of information available somewhere among their rich developer data. However, some stations will exist in multiple routes, so I'm not sure how you could unambiguously identify the actual TS route.
actual train speed
I finally found a collection of csv files that I used in the past to identify all available controllers and how they change over time.
Would you be interested in these? Happy to e-mail those to you for analysis.
Would you remember how you got it to work with 64 bit TS? I've set it to 64bit python and the RailDriver64.dll file...
Nevermind! Apparently it decided that the moment I hit "comment" on a github post it just wants to work again...
Trying to get values of longitude, latitude, loco names, ect. and its just returning 0.