Board index FlightGear Development New features

Flight Recorder custom start end time

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Flight Recorder custom start end time

Postby tldrc » Sun Oct 10, 2021 3:32 pm

Hi,
I would like to start the fgtape recording manually by specifying when I want to start recording and when to end the recording.

I have done some digging into the configuration and saw that the dialog in flight-recorder-save.xml used to contain textfields for start-time and end-time stored within the properties tree. There is even a save-all to specify whether to save the whole duration of the simulation or by setting true to save-all.

starttime and endtime is sent to save-tape through a fgcommand. I tried uncommenting the gui entries in flight-recorder-save.xml and try entering custom time to before saving. The saved fgtape is still saving the whole duration of the simulation.

Does anyone have any knowledge of this working before since all these code exists? I am looking to give a command to start recording and another command to stop recording and potentially save.

Thanks in advance. :)
tldrc
 
Posts: 19
Joined: Wed May 19, 2021 2:49 am

Re: Flight Recorder custom start end time

Postby cgdae » Sun Oct 10, 2021 4:08 pm

tldrc wrote in Sun Oct 10, 2021 3:32 pm:Hi,
I would like to start the fgtape recording manually by specifying when I want to start recording and when to end the recording.

I have done some digging into the configuration and saw that the dialog in flight-recorder-save.xml used to contain textfields for start-time and end-time stored within the properties tree. There is even a save-all to specify whether to save the whole duration of the simulation or by setting true to save-all.

starttime and endtime is sent to save-tape through a fgcommand. I tried uncommenting the gui entries in flight-recorder-save.xml and try entering custom time to before saving. The saved fgtape is still saving the whole duration of the simulation.

Does anyone have any knowledge of this working before since all these code exists? I am looking to give a command to start recording and another command to stop recording and potentially save.

Thanks in advance. :)


According to git, that code in the dialogue has been commented-out since 2012. I've made quite a few changes to record/replay C++ code in the last two years, and i haven't seen, or removed, any such functionality. So maybe it was planned but not implemented? Saving a subset of the current in-memory history shouldn't be too difficult to implement, though the code is a little tricky to work with.

If instead you want to tell Flightgear to start recording at a time T1 in the future, and stop recording at time T2, then it should be easy enough to set up the relevant timers in Nasal. Then for example to create a Continuous recording, simply set /sim/replay/record-continuous to true to start recording, then back to false to stop recording. There are various other properties that control aspects of Continuous recordings - see https://sourceforge.net/p/flightgear/fl ... ordings.md for details.

Hope that's of some use,

- Jules
cgdae
 
Posts: 117
Joined: Tue May 31, 2016 8:35 pm

Re: Flight Recorder custom start end time

Postby tldrc » Thu Oct 14, 2021 11:32 am

Hi Jules,

Thank you for the reply.
So to reiterate what you just said, setting /sim/replay/record-continuous to true (or checking "Continuous Record to file" in the [File] -> [Flight Recorder Control] menu) should start the continuous recording and setting /sim/replay/record-continuous to false should stop the recording.
I have verified that indeed a fgtape file with continuous label is created on setting true and the file size is updated when setting to false.

I have a new related issue. I cannot seem to play continuously recorded fgtape. I am not sure it is due to me not knowing how to record properly or not knowing how to load the continuous fgtape properly.

I loaded the continuously recorded fgtape like it is a normal fgtape by doing [File] -> [Flight Recorder Control] -> Click [Load] Button -> Select the file name -> Click [Load]

When I select the filename, continuous fgtape seem to show up with info Tape Duration: 0:00
when loaded it says Size: 0.0 MB. (Note the continuous fgtape is clearly not 0 size on my machine)
In the console I see
[ALRT]:systems Continous recording: indexing finished m_continuous_in_time_to_frameinfo.size()=0

Is there anything I am missing when playing the fgtape?
I was using the nightly build pushed out on Sept 17th, I have since tested the latest one pushed out on Oct 14th (today)
Both has the same problem. Is there a bug involved here?
tldrc
 
Posts: 19
Joined: Wed May 19, 2021 2:49 am

Re: Flight Recorder custom start end time

Postby cgdae » Thu Oct 14, 2021 12:32 pm

Hmm, interesting, i build and run next (which i guess is similar to your use of a nightly build?), and loading Continuous recordings works for me, via the "Flight Recorder Control" dialogue and via --load-tape=... .

The 'Tape Duration: 0:00' in the 'Load' dialogue and the 'Size: 0.0 MB' in the REPLAY dialogue are expected with Continuous recordings - when the file header if written, we don't know how long the recording will be so always write zero into the length field.

However we should be seeing a non-zero m_continuous_in_time_to_frameinfo.size()=... on the console.

Could you try specifying the recording on the command line with load-tape=... ?

One thing that might give us more information is to run with environmental variable SG_LOG_DELTAS set to :loadTape=3. On Linux this can be done by export SG_LOG_DELTAS=:loadTape=3 or SG_LOG_DELTAS=:loadTape=3 run_fgfs.sh ....

This which will increase the amount of console diagnostics from the FGReplay::loadTape() function. There will be a lot of information about the recording file's header, plus the exact filename that is being loaded.

For example i see:
```
295.77 flightgear/src/Aircraft/replay.cxx:2691: [ALRT]:systems Checking flight recorder file fgtapes/harrier-gr3-20211003-211205-continuous.fgtape, preview: 0
295.77 flightgear/src/Aircraft/replay.cxx:2407: [ALRT]:systems loading Preview=0 Filename=Path "fgtapes/harrier-gr3-20211003-211205-continuous.fgtape"
295.77 flightgear/src/Aircraft/replay.cxx:2424: [ALRT]:systems m_continuous_in_config is:
<?xml version="1.0"?>
...
```

There will be multiple occurrencies of this debug output, because we run the same code to find info about recordings in order to populate the 'Load' dialogue. The last instance will have Preview=0, and will be for the actual recording that is loaded.

Could you compare the Filename=Path "..." text with the file you are trying to load? If things are still unclear, maybe send me the output and i'll have a look directly.

Thanks,

- Jules
cgdae
 
Posts: 117
Joined: Tue May 31, 2016 8:35 pm

Re: Flight Recorder custom start end time

Postby tldrc » Thu Oct 14, 2021 1:48 pm

I am on Windows 10, just tried --load-tape=<full path to my fgtape>
I still got the same message
[ALRT]:systems Continous recording: indexing finished m_continuous_in_time_to_frameinfo.size()=0
show up.
I am flying the Boeing 777-300
I am saving the file to my desktop, since I could write the files, I do not see why i can't load from it as well.

I have a YASim warning: possible convergence problem.
but I have always had that.

This is my fgtape file:
https://file.re/2021/10/14/orgflightgea ... ontinuous/

EDIT: when I used --load-tape in the commandline option, I get a new error when I try to load any new fgtape (even non continuous ones)
[ALRT]:systems Failed to open Filename=<path to .fgtape> in.is_open()=1

EDIT: seems like after any attempts to open a continuous fgtape, I would not be able to open any fgtape and it would give the mentioned "in.is_open()=1" error
tldrc
 
Posts: 19
Joined: Wed May 19, 2021 2:49 am

Re: Flight Recorder custom start end time

Postby wkitty42 » Thu Oct 14, 2021 2:33 pm

try putting your tape in the Export directory with all the rest of your FG managed stuff... FG has read and write permissions in there whereas most other places are quite limited... i don't know the exact path on windows but on linux it is ~/,fgfs/Export...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Flight Recorder custom start end time

Postby cgdae » Thu Oct 14, 2021 2:52 pm

I can replay that recording fine, so it looks like wkitty42 is right that it's a permissions problem. I don't use Windows for flightgear so can't help with this.

I don't understand how we are succeeding in reading the recording header but then fail to read the rest of the contents.

The "[ALRT]:systems Failed to open Filename=<path to .fgtape> in.is_open()=1" diagnostic is implying that the input stream used for replaying fgtape files is already open and so we are failing to open the new recording, so i suspect that we are already replaying a recording (which might be interpreted as zero length). We should probably open a warning when this happens, e.g. saying "Stop current replay before loading new recording" or similar; i'll have a look at doing this.

A workaround might be to use Ctrl-R to open the REPLAY dialogue, and click on 'End Replay' or 'My Controls' so we stop replaying from file, then try loading a recording again.

Thanks,

- Jules
cgdae
 
Posts: 117
Joined: Tue May 31, 2016 8:35 pm

Re: Flight Recorder custom start end time

Postby tldrc » Fri Oct 15, 2021 3:58 am

This logic of read and write permission does not check out because I could write to the directory (my desktop) without administrator rights.
And running FlightGear as administrator on windows (which is what I already tried) should already give the rights to read and write to any directory right?

I changed the directory from the default export directory to my desktop precisely because the default directory was not writable by FG.

Thanks for all your time so far Jules and wkitty42.
tldrc
 
Posts: 19
Joined: Wed May 19, 2021 2:49 am

Re: Flight Recorder custom start end time

Postby wkitty42 » Fri Oct 15, 2021 12:18 pm

tldrc wrote in Fri Oct 15, 2021 3:58 am:This logic of read and write permission does not check out because I could write to the directory (my desktop) without administrator rights.

flightgear has its own file/directory security access in place... it may or may not mesh with the user's access permissions...

tldrc wrote in Fri Oct 15, 2021 3:58 am:And running FlightGear as administrator on windows (which is what I already tried) should already give the rights to read and write to any directory right?

see above...

tldrc wrote in Fri Oct 15, 2021 3:58 am:I changed the directory from the default export directory to my desktop precisely because the default directory was not writable by FG.

what was the default export directory?

tldrc wrote in Fri Oct 15, 2021 3:58 am:Thanks for all your time so far Jules and wkitty42.

you're quite welcome...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Flight Recorder custom start end time

Postby tldrc » Sat Oct 16, 2021 5:22 pm

what was the default export directory?

C:\Users\<username>\AppData\Roaming\flightgear.org\Export
I was mistaken, this directory is read/writable.

Still I cannot load continuous fgtape from the directory.
tldrc
 
Posts: 19
Joined: Wed May 19, 2021 2:49 am


Return to New features

Who is online

Users browsing this forum: No registered users and 4 guests