MechJeb2

MechJeb2

4M Downloads

Question: Landing prediction and staging

yankee14 opened this issue · 5 comments

commented

I'll illustrate my question with an example. I have a spacecraft capsule in orbit around Kerbin with a fuel tank and an engine. I intend to deorbit the capsule using the engine, but dispose of the stage before entry interface. I activate the landing autopilot prediction feature and begin my deorbit burn. I burn until MechJeb indicates my desired landing spot. All is well, except that when I finally jettison my stage, the landing site changes drastically.

If MechJeb is giving landing predictions based on the larger mass, it makes sense that the predicted landing site would change drastically after staging. Would it be possible to have some sort of slider bar that lets you either

  1. calculate landing sites based on a certain stage number/configuration?
  2. calculate landing sites based on a manually inputted spacecraft mass?
commented

Mechjeb tries to calculate the landing with precision. when you stage, the decouplers add a few deltaV, pushing the vessel off-course. From a considerable distance, 0.1 dV can really add up over time, pushing the vessel several (kilo)meters off-course. Landing doesn't account for staging, it assumes you're already in a landing-suitable stage.

I found this out the hard way, when my return pod from Duna landed in the KSC mountains instead of the ocean nearby. Jebadiah was not pleased with the rough landing and long hike back to KSC without a suitable rover.

The solution is a rather easy one, just add a single ball of monopropellant and few RCS thrusters, make sure the RCS adjustment option is checked and viola! it fixes the decoupler problem.

commented

I'm sorry for being so analytical.

when you stage, the decouplers add a few deltaV, pushing the vessel off-course.

I agree that the decoupler creates an impulse during staging which affects the trajectory. However, I suspected that the decoupler's impulse was not solely responsible for the change in MechJeb's landing predictions. So, I performed an experiment to test my hypothesis.

I created a generic craft in the VAB, got it into a 100km circular orbit, and made a quicksave. Here is the little craft with its engine, fuel tank, and decoupler. In the VAB, I lowered the force strength of the final stage decoupler to 13 percent of maximum (for no good reason other than I don't need a lot of force for the tiny craft).

  1. Perform a retrograde burn until MechJeb predicts a relatively stable landing site somewhere. I wrote down the predicted landing coordinates to refer to them:

Predicted landing site before staging at 13 force percent: 0deg 05' 10"N, 37deg 14' 30"W

  1. Initiate staging to eject the fuel tank, engine, and decoupler at 13 force percent. Note that the mass of the craft before staging is about 6.7t. After staging it is 6t. Perhaps intuitively, the predicted landing site has changed:

Predicted landing site after staging at 13 force percent: 0deg 05' 10"N, 34deg 24' 50"W

At this point, I closed the game, opened the quicksave file in a text editor, and changed the decoupler force percent from 13 to 0. I reopened the game, loaded the quicksave of my craft in the circular orbit, and began the experiment again:

  1. Perform a retrograde burn until MechJeb predicts a relatively stable landing site somewhere (close to the landing site in the first experiment). I wrote down the predicted landing coordinates to refer to them:

Predicted landing site before staging at 0 force percent: 0deg 05' 10"N, 37deg 23' 30"W

  1. Initiate staging. Note that the mass of the craft before staging is about 6.7t. After staging it is 6t. If the decoupler's impulse is truly responsible for the change in landing site predictions, we should expect to see absolutely no change in landing predictions before-and-after staging.

Predicted landing site after staging at 0 force percent: 0deg 05' 10"N, 33deg 58' 42"W

Interesting results! If we assume that activating a decoupler at 0 force percent exerts absolutely no impulse on the spacecraft, then the only explanation is that the change in the vehicle's mass must have produced the change in landing site prediction!

Armed with this data, can we answer:

Do landing site predictions change due to impulse from the decoupler (Δp)? Probably
Did the predicted landing site change because of the change in the vehicle's mass (Δm)? DEFINITELY
Did the predicted landing site change because of both Δp and Δm? Probably. I will perform this experiment several more times by varying the spacecraft's mass and decoupler ejection force percentages to investigate.
Did the predicted landing site change because of some other variable(s) for which I have not accounted? Hmm...

I think I can conclude that changes in vehicle mass factor greatly in MechJeb's landing prediction function.

Landing doesn't account for staging, it assumes you're already in a landing-suitable stage.

I agree, it only assumes that the mass (and possibly the aerodynamic characteristics?) of your craft will remain constant throughout reentry.

Now that I've (hopefully) demonstrated Δm is important for landing predictions, I wonder whether it would be possible add functionality to show landing predictions based on other factors such as:

  1. the current mass of the spacecraft
  2. the mass of the spacecraft in stage number N
  3. a manually inputted spacecraft mass
commented

The issue is way more complex that adding mass slider. The aerodynamic of the vessel change when you stage and computing this change is a complex task involving occlusion that I am not really looking into doing.

commented

It's not possible to do something like generating landing predictions based on how the vessel is configured in a future stage? I'm talking out of my bum here, but I mean something like:

while(landingPrediction.isEnabled())
{
    int stageNumber = userInput.getStageNumber();//get stage number user wants landing predictions based on

    generateLandingPredictions.particularStage(stageNumber);
}

The aerodynamic of the vessel change when you stage and computing this change is a complex task involving occlusion that I am not really looking into doing.

I don't doubt that computing landing predictions is a complex task, but MechJeb does compute new landing predictions when I press the spacebar. We can't pretend to tell MechJeb that we staged, and generate the new predictions based on whatever future stage configuration? Is this the occlusion thing you mentioned?

commented

MJ does compute it when you stage because all the info about the stage aerodynamic was computed by KSP after the staging. As I said that part is far from trivial.