Software Pulling data from .pos, .att. and .atc files in real time

vanhayes

New member
Joined
Feb 29, 2020
Messages
2
Reaction score
0
Points
0
Hello everyone,

I'm a college student, and I want to recreate a spaceship cockpit to do more realistic simulations. I intend to use orbiter for this because I've played around in Orbiter for a while and I have always been happy with the results. My intention to make this happen is to create a link between the orbiter software and a third party program (yet to be decided but currently using MATLAB just to observe data in an early stage) that can interpret what is happening in the simulation and any buttons or switches pressed by me outside the simulation.

The first step to this is for me to get familiar with collecting data from the simulation while it is running. I've done some research mostly aimed at starting a recording and using the playback data in real time. I've found many documents that explain the layout of the data inside the files under the "flights" folder, but i have yet to figure out how to actually open the files and look at my own data. When i try converting them, it usually results in a few data points but with terrible resolution.

Does anyone have any opinions/ideas on how i could either A. get the data out of these files quickly and efficiently or B. get the simulation to spit out live data better than through the playback capability.

Thanks in advance

p.s. I am not a very experienced software person, part of why I'm doing this project is to try to learn some software stuff. If its a complicated solution ill probably have questions to ask.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,614
Reaction score
2,335
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I have no idea what Matlab allows for importing such data - could you also poll the data from a webservice for example?

If yes, you could write a plugin to provide the data.

I know that there used to be solutions for flightdeck builders, but I am not sure if they still work with the current version.

AFAIR Project Apollo has a networked telemetry module for itself, if you limit yourself to this add-on, you could use this plugin for getting the data into matlab.

This here is a client using this data.

https://github.com/indy91/telemetryClient
 

asbjos

tuanibrO
Addon Developer
Joined
Jun 22, 2011
Messages
696
Reaction score
259
Points
78
Location
This place called "home".
I haven't done this before, while others have. So take my advice with a grain of salt.

First, this is not what the flight recording feature was made for, so it will probably be very difficult at best to use this for the interface.
If you decide to use it, though, you can change the sampling resolution in the dialog box.

You can get out more data and better resolution by writing your own recording addon, either in C++, and possibly the Lua interface (haven't tried this myself).
It could look something like this:
PHP:
// When you initialise the addon
vesselLogFile = oapiOpenFile("myFile.txt", FILE_OUT, ROOT);

// Every timestep
VECTOR3 pos; // example
GetRelativePos(GetSurfaceRef(), pos); // example
char vesselLog[256];
sprintf(vesselLog, "%.3f\t%.3f\t%.3f\t%.3f\t%.3f", simt, pos.x, pos.y, pos.z, GetPitch() * DEG);
oapiWriteLine(vesselLogFile, vesselLog);

// When you exit the simulation
oapiCloseFile(pitchDataLogFile, FILE_OUT);
You can probably extend this to also write out any key presses.

But to actually interact with an addon, like having a physical switch for the DeltaGlider's nosecone, you will in the end need close to full access to the source code of the addon you want to connect with, or hope that every switch is backed by a keyboard shortcut.
Some addons share their sources, some do not. If they do, you'll then have to write in support for your physical switches. Difficult, but it is possible, and has been done before, as I said earlier.

But good luck, and of course you are always welcome to ask for help if encounter problems.
 

vanhayes

New member
Joined
Feb 29, 2020
Messages
2
Reaction score
0
Points
0
So these two responses and some more research on my end make it seem like its much more viable to just program my own addon that records and transmits data, rather than hijacking an already existing method in the game like the playback files. Would there happen to be any examples of this online similar to what I'm working on?
 
Top