MechJeb2

MechJeb2

4M Downloads

Manage air intakes closing too many of them

tavert opened this issue ยท 8 comments

commented

You can see the issue on this craft: https://dl.dropboxusercontent.com/u/8244638/Fueler%205b.craft

When I select both "Manage air intakes" and "Prevent jet flameout" (the latter of which is a godsend BTW, probably my favorite new feature!), it seems to be getting confused and closing too many of the intakes. Not sure what could be causing this, but I haven't looked much at the relevant section of code yet. It might be getting confused with the nested-symmetry construction of my craft, KSP itself can get confused in the VAB with removing or setting action groups for parts attached this way...

With all but 2 intakes closed, the linked craft can't generate enough thrust to get off the ground. If I turn "Manage air intakes" off, it takes off fine as long as I wait until the engines are spooled up to > 90 kN before releasing the launch clamps. It does exhibit some control issues due to #21, Tallinu's workaround is effective for that problem though.

Edit: deleted side question (duplicate of #55), added the following
Feature request! New info item for total number of open intakes. Gets hard to figure out the total # open once you get higher and the time between successive openings decreases.

commented

Speaking of getting that craft off the ground... is that an example or unfinished design, or can it actually reach orbit somehow?

commented

@Tallinu - unfinished design, it doesn't have quite enough intakes or fuel for the jets to make orbit. The finished design is here https://dl.dropboxusercontent.com/u/8244638/Fueler%206a.craft

Interestingly, in the finished design, Manage air intakes appears to be working for the first ~25km of flight, but then doesn't open as many of the rest of the intakes as it should from then on. I moved this craft back and forth between the VAB and the SPH several times using the subassembly plugin (tried to get it to launch horizontally, failed, went back to vertical launch), so I think this bug has something to do with VAB vs SPH symmetry modes when the intakes are placed.

commented

I've never had problems swapping a ship back and forth between SPH and VAB. If it's the symmetry at all, I think it's more likely to be the nested symmetry. KSP really doesn't handle that well. In addition to the problems with action groups, if I click on such a part it removes it from the first higher-level parent but not the second, and if I then click on one of the parts on the second, it just vanishes and breaks the editor - trying to save results in no file written and clicking on other parts results in VERY screwed up behavior that's hard to describe.

commented

Yeah that's exactly the KSP editor behavior I was referring to, I've seen it too. Have to be careful where you click when you build boosters that have clustered engines, or intakes, or whatever else. Not that it matters right now since the KSP forums are down, but has a good descriptive report of that bug been made to Squad somewhere?

commented

Maybe mechjeb could be made reactive in this scenario? While it "knows what SHOULD be needed" in terms of intakes, if intake air still isn't enough maybe it could open more intakes than it thinks it needs until the issue is resolved?

Logic could be:

If [IntakeAir] < 25% of IntakeAirMax
then symmetrically open closed intake with smallest [IntakeOpenDrag]

If [IntakeAir] > [75% of IntakeAirMax]
then symmetrically close open intake with largest [IntakeOpenDrag] unless main logic calculates it is needed

Yes, I know this could cause some intakes to "flutter" open and closed rapidly, but it would only happen when the intakes are sufficiently angled away to cause this problem in the first place, and I can't think of any major impacts it would have on the game other than solving an issue people have when pitching too hard or something.

edit: copy paste error

commented

How weird; I'll have to test this next time I have time (should be a few days only, I'm back from a long vacation).

I won't go through great effort to fix it though, given that it's going to be about working around a buggy craft (and thus any fix is wasted effort if Squad fixes the core problem). But if there's an easy fix...

commented

Hope it was a good vacation. As I said on the forums, not a huge priority on this since it's probably fundamentally KSP's bug and there is a workaround of rebuilding the ship without nested symmetry.

I'm fairly sure the issue is due to https://github.com/MuMech/MechJeb2/blob/master/MechJeb2/MechJebModuleThrustController.cs#L382
symmetryCounterparts is probably bugged.

commented

Ah, OK, I see what the issue could be.

If intake a does not have b in its symmetryCounterparts, but b has a in its counterparts, then I'll make two groups, both of which have intake a.

The first group will be opened, because we haven't accumulated enough air yet. So we open intake a.

The second group will be closed, because we have enough air. So we close intake a.

Net effect: intake a ends up closed.

Fix: copy line 385 if (groupIds.ContainsKey(intake)) { continue; } into the inner loop as well (but for symintake instead of intake).