ferram4 / Ferram-Aerospace-Research

Aerodynamics model for Kerbal Space Program
Other
238 stars 131 forks source link

RCS thrusters inside a fairing usually don't work after the fairing is deployed #170

Closed kbios closed 7 years ago

kbios commented 7 years ago

The following is with KSP 1.2.2, the KSP_update branch, MFI 1.2.3 and MM 2.7.5. If any kind of RCS thruster is put inside a fairing, around 80% of the times it will not work after the fairing is deployed. To get another chance of it working it is enough to revert to launch. My test procedure is the following: load the attached craft, then press R, T, spacebar, wait a few seconds, spacebar again, try to use RCS. There is a full log attached, but what catches my eyes is this difference: in a nonworking launch, the log says

[LOG 11:40:00.873] Update fairing event
[LOG 11:40:00.877] Updating vessel voxel for rcsbug
[LOG 11:40:01.123] Std dev for smoothing: 3 voxel total vol: 36,6814178657211 filled vol: 14,3976486996057

[LOG 11:40:03.153] Unpacking rcsbug
[LOG 11:40:03.319] [Progress Node Reached]: RecordsAltitude
[LOG 11:40:03.321] [Progress Node Reached]: RecordsSpeed
[LOG 11:40:03.321] [Progress Node Reached]: RecordsDistance
[LOG 11:40:04.543] RCS lock/unlock
[LOG 11:40:07.806] [Progress Node Reached]: FirstLaunch
[LOG 11:40:07.806] [Progress Node Complete]: FirstLaunch
[LOG 11:40:12.048] Update fairing event
[LOG 11:40:12.048] Updating vessel voxel for rcsbug
[LOG 11:40:12.263] Std dev for smoothing: 3 voxel total vol: 36,6814178657211 filled vol: 14,3976486996057

in a working launch, it says

[LOG 11:41:54.808] Update fairing event
[LOG 11:41:54.809] Updating vessel voxel for rcsbug
[LOG 11:41:55.044] Std dev for smoothing: 3 voxel total vol: 36,6814551257511 filled vol: 14,3977266178752

[LOG 11:41:57.120] Unpacking rcsbug
[LOG 11:41:57.296] [Progress Node Reached]: RecordsAltitude
[LOG 11:41:57.296] [Progress Node Reached]: RecordsSpeed
[LOG 11:41:57.296] [Progress Node Reached]: RecordsDistance
[LOG 11:41:57.701] RCS lock/unlock
[LOG 11:41:58.647] [Progress Node Reached]: FirstLaunch
[LOG 11:41:58.647] [Progress Node Complete]: FirstLaunch
[LOG 11:42:01.525] Update fairing event
[LOG 11:42:01.526] Updating vessel voxel for rcsbug
[LOG 11:42:01.738] Std dev for smoothing: 3 voxel total vol: 36,6814551257511 filled vol: 12,5331723593108

Notice the change in "filled vol". The test was done with a clean install of KSP, with only FAR and its dependencies installed.

rcsbug.craft.txt KSP.log.txt

ferram4 commented 7 years ago

What are the steps to cause the issue, as opposed to no issue occurring?

kbios commented 7 years ago

It seems non deterministic to me: it happens randomly, around 80% of the times. In my tests I did up to 30 consecutive launches using exactly the same procedure and got a random sequence of successes and failures.

ferram4 commented 7 years ago

I have been unable to reproduce this issue in any test; RCS always functions and the filled volume always changes. I suspect that there might actually be something to this though, but there might be reproduction steps missing or some other type of thing that isn't clear enough; until then, I'll mark that it needs repro steps.

kbios commented 7 years ago

Ok, I continued my testing and found an interesting thing: on the same machine, with the Windows version of KSP I cannot reproduce the issue. Since all my earlier testing was done on Linux maybe it's an operating system-specific problem?

ferram4 commented 7 years ago

It's possible, but I suspect that it's unlikely. The functional differences between the operating systems isn't that big. Hopefully it's not that. I suspect if that is accurate that similar behavior could be found on Macs as well.

If that is accurate, the question becomes whether the difference is due to something in KSP itself or in Mono and then how to work around it without breaking everything.

Can this be reproduced in earlier versions of KSP and FAR?

kbios commented 7 years ago

I've tried with KSP 1.0.5 and FAR 0.15.5.7 on Linux and I cannot reproduce it.

ferram4 commented 7 years ago

Can you try with KSP 1.1.3 and FAR 0.15.7.2 and see if you can reproduce it? There are a lot of code changes between 0.15.5.7 and the current dev version.

kbios commented 7 years ago

I cannot reproduce with 1.1.3 and 0.15.7.2 either, although testing was complicated by the sad state of ksp 1.1 on linux.

ferram4 commented 7 years ago

Fair enough, but that's very helpful in narrowing down when the change happened. I'm pretty sure I can fix it.

ferram4 commented 7 years ago

Hey, so I just pushed a commit that I think might fix it. If not, it should at least provide slightly better logging so I can confirm what's going on. If I'm right about the way that things are going wrong, I think that the revoxelization is getting triggered before the mesh update is handled... so if this doesn't fix it at least the log will confirm it and I can try and figure out how to address it. Anyway, I'd appreciate it if you can give it a shot and see if that fixes it.

kbios commented 7 years ago

Hey! I tried with the latest version, I got 4 successes out of 20 launches, so roughly the same proportion as before. There is a full log attached, I noticed these kind of lines:

[ERR 00:45:28.610] FAR could not find Stock Procedural Fairing deploy event

[ERR 00:45:28.610] FAR could not find Stock Procedural Fairing break event

KSP.log.txt

ferram4 commented 7 years ago

Ah, this is not what I expected. So I gather that sometimes when I try to set things up the event is null... sometimes. Not all the times though, if it's working sometimes. Hmm....

ferram4 commented 7 years ago

Hey, I've got another build up to try to fix this one, please try it. If it doesn't work, it should throw an exception instead because the event is null at the time.

kbios commented 7 years ago

Just tried, and I got 10 out of 10 successes. I attach the log anyway if you want to take a look at it, but to me this seems fixed. Thank you so much! KSP.log.txt

ferram4 commented 7 years ago

Excellent. Thanks for the help.