I am trying to find a way to access airbrake data in almost real time to drive a set of actual duplex air gauges for my simulator's control stand. The goal is to be able to watch the physical needles rather than anything on the screen. The gauges have been modified such that servos now run the needles and an Arduino drives the servos. At this point all I need is to get the BP, BC, ER, and MR pressures into the Arduino in as close to real time as possible.
The ideas I have been toying with are:
1) Tap into the existing OR logging feature. Enabling physics data in the content logger includes the BP, BC, ER, and MR pressures in the OpenRailsDump.csv file. The arduino can then open this file regularly and update the gauges from there.
Problem: The OpenRailsDump.csv file only updates when the sim session is closed. Also a very clunky method and likely too slow of a refresh rate due to having to open a large csv file. Would need a way to A) refresh the OpenRailsDump file at a steady rate while OR runs and B) delete the contents of the csv file after reading to keep the processing time down.
2) Modify OR to log just the BP, BC, ER, and MR parameters to a csv file and have the Arduino regularly open the file, take the values, then clear the file for the next output from OR.
Problem: I'm an amateur when it comes to coding, I wouldn't know what to modify to get this working. It also still relies on file I/O, which might add restrictive amounts of lag no matter how small the file is.
3) Run a separate program in parallel that uses text detection to read the HUD parameters from a known location on the screen and send the values I need to the Arduino.
Problem: This is also above my experience level, although if no better solutions exist then it is at least documented well enough that I could likely figure my way through it.
Has anyone tried anything like this or know of ways to resolve the problems listed above? Or is there a better approach than my clunky inexperienced ideas?
If this can be accomplished then the last goal will be getting the load meter to work. This is more dynamic than brake pressures though so it will only work well if I can update it at a high enough rate.
Thanks in advance!
Tyler
The ideas I have been toying with are:
1) Tap into the existing OR logging feature. Enabling physics data in the content logger includes the BP, BC, ER, and MR pressures in the OpenRailsDump.csv file. The arduino can then open this file regularly and update the gauges from there.
Problem: The OpenRailsDump.csv file only updates when the sim session is closed. Also a very clunky method and likely too slow of a refresh rate due to having to open a large csv file. Would need a way to A) refresh the OpenRailsDump file at a steady rate while OR runs and B) delete the contents of the csv file after reading to keep the processing time down.
2) Modify OR to log just the BP, BC, ER, and MR parameters to a csv file and have the Arduino regularly open the file, take the values, then clear the file for the next output from OR.
Problem: I'm an amateur when it comes to coding, I wouldn't know what to modify to get this working. It also still relies on file I/O, which might add restrictive amounts of lag no matter how small the file is.
3) Run a separate program in parallel that uses text detection to read the HUD parameters from a known location on the screen and send the values I need to the Arduino.
Problem: This is also above my experience level, although if no better solutions exist then it is at least documented well enough that I could likely figure my way through it.
Has anyone tried anything like this or know of ways to resolve the problems listed above? Or is there a better approach than my clunky inexperienced ideas?
If this can be accomplished then the last goal will be getting the load meter to work. This is more dynamic than brake pressures though so it will only work well if I can update it at a high enough rate.
Thanks in advance!
Tyler






Comment