piotrkilczuk / py-raildriver

Python interface to Train Simulator 2016+
MIT License
15 stars 9 forks source link

Nothing working #15

Closed jake-baxter closed 2 years ago

jake-baxter commented 3 years ago

Trying to get values of longitude, latitude, loco names, ect. and its just returning 0.

piotrkilczuk commented 3 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.

jake-baxter commented 3 years ago

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 - []

jake-baxter commented 3 years ago

Also to that, calling other values such as "SpeedometerMPH" just gives a plain 0

piotrkilczuk commented 3 years ago

I think you're doing everything right then. Sorry to hear it's no longer working.

jake-baxter commented 3 years ago

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?

jake-baxter commented 3 years ago

Nevermind, it does work! I was running 32-bit python for some reason and it is now working. Thankyou very much for your help.

jake-baxter commented 3 years ago

Sorry for bothering again, is there a guide to get a certain value and it has the integer required?

jake-baxter commented 3 years ago

Sorry by this I mean like a guide of Controller ID's

piotrkilczuk commented 3 years ago

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...

jake-baxter commented 3 years ago

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?

piotrkilczuk commented 3 years ago

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.

jake-baxter commented 3 years ago

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)

piotrkilczuk commented 3 years ago

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.

YukiSuter commented 2 years ago

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...

YukiSuter commented 2 years ago

Nevermind! Apparently it decided that the moment I hit "comment" on a github post it just wants to work again...