MechJeb2

MechJeb2

4M Downloads

Maneuver Execution

thesomebody opened this issue ยท 8 comments

commented

I have noticed that the latest versions of MechJeb start execution burns when the craft/rocket reach the maneuver node. This is fine for short burns, but for long burns this causes an error in the orbit trajectory compared to the calculated trajectory given by KSP. The cause of this is due to the maneuver node/ KSP assuming the craft can produce an infinite amount of thrust at that exact moment. Since this is impossible, it is required that the burn starts before the craft reaches the maneuver node, such that "time before execution" = "burn length" / 2; thus the average burn occurs at the maneuver node time.

I do believe that this is something MechJeb use to do in version 2.0.9.0 (this is the first version of MechJeb that I started using), but I cannot be 100% sure.

Hopefully you understand the problem, but if you have any questions then please let me know.

Thank you for your time and your wonderful programme.

commented

When trying it a minute ago, only 1 engine was activated (I had 2 others which were deactived). This engine can be toggled by an action group, but was always left activated (i.e. during the creation of the maneuver node, clicking on execute node in MechJeb, the auto-time warping of MechJeb and then during the burn itself). This was tested with the latest version (160) of MechJeb. I also notice that KSP / MechJeb incorrectly estimates the burn time initially (i.e. the time that appears next to the navball). Whether this is down to extra rocket engines being possible I don't know, but I would always calculate the burn time to be "delta V / maximum acceleration (which is given in MechJeb's vessel info)". Note that these are custom maneuver nodes and not ones created by MechJeb itself, although even these I would say MechJeb starts the burn too late. For example I use it for getting two rockets to rendezvous with each other; everything works fine until getting them closer together. The first burn (increasing the target velocity, bring the rockets closer together) works fine, but then the second burn (decreasing the target velocity, so that they are very close together) starts too late, so that the target rocket goes flying past. Thus a third burn is required to again "increase the target velocity again"; since the rockets are now closer together, the fact that the fourth burn starts late, doesn't matter since the velocities are lower; hence the rockets are now close enough to dock, but fuel has been wasted.

Thanks for the quick responce and I hope this helps.

commented

Your are not the first to report that but when I try to duplicate it seems to work for me, so something must be different.
Do you activate your engine with action group or by hand ?

commented

I think I might have found where the bug lies (or at least give you an idea as I haven't done enough testing to be 100% sure at this stage) after doing some more testing and looking at the code. What I think is happening, is that the burn time required to the maneuver is calculated incorrectly, due to one or more engines in the current stage being disabled. However Mechjeb is assuming that all engines in the stage are enabled thus works from this thrust / acceleration value. Thus Mechjeb starts the burn at the wrong time, as I have noticed that it does/can start the burn before the maneuver node, but not early enough, e.g. what should be a 30 second burn (manual calculation) it starts 3 seconds beforehand.

As a side note, the acceleration value (m/s^2 value) given in the vessel stats does appears to be correct, independent of whether any engines are disabled.

Hope this helps.

commented

This helps a lot.
I'll try to fix that one tonight.

commented

I had a look at that and I can't find any error. The node burning use the same stat as the "Delta-V Stats" windows.
The info from the stage 0 line is used (the other are used if that stage is not enough). If you manually enable/disable an engine the info from that line change correctly.
Using that MJ calculate the burn time and divide it by 2 to see when to start.

  • It compute the difference in mass between the start and end of burn, and use it to compute the burn time. That may explain why you see a difference.
  • The calculated burn time by MJ is not displayed anywhere. There is an infoItem but the displayed time does not take the mass change in account.

So as far as I can say MJ does burn better than we do.

commented

I have had a further look into this, based upon what you said above. As a test I have used the Kerbal X rocket (http://wiki.kerbalspaceprogram.com/wiki/Kerbal_X) and have hyperedited, it into space to make testing easy. Now assuming that the rocket is full of fuel, then if I manually disable all the engines the information in the "Delta-V Stats" windows does not change. In fact I can have all the engines disabled (or any number of them) and I still get a same values as if all the engines were enabled.

However, if I go down to stage 2 (i.e. press "Space" 5 times), then enabling/disabling the single engine left, does affect the "Delta-V Stats" window. Hence based upon your statement that "The node burning use the same stat as the "Delta-V Stats" windows.", this would indecate some sort of bug.

I will point out that your "Vessel Information" window does display the correct information at all times, regarding Max Acceleration, Max Thrust and Surface TWR. In fact it was this window's "Max Acceleration" that I was using to give myself a rough guide on how early the burn should start, i.e. "seconds before zero" = "delta v" / "max acceleration".

Lastly, I would agree with you that MechJeb does do a better burn than us humans.

Thanks for continuing to have a look at the problem.

commented

Thanks for finding this case !
I made a tiny fix that adds a fake stage when the current stage is higher than the maximum stage. It should fix this one and hopefully all the other problem were related.

commented

The new version works great, thank you very much for this and the whole project. I couldn't do half the stuff I do with KSP without MechJeb.