MechJeb2

MechJeb2

4M Downloads

Improvements to DeltaVToChange{Apoapsis,Periapsis}

dewiniaid opened this issue ยท 2 comments

commented

As currently implemented, DeltaVChangeApoapsis and DeltaVChangePeriapsis perform a binary search in order to determine the dV required for the new maneuver.

I've been puzzling over a better approach to this for awhile and asked about it on StackExchange -- as well as having the opportunity to test the formula presented in the answer in KSP (using kOS):

  • Solving for z>r works for adjusting apoapsis.
  • Solving for z<r works for adjusting periapsis.
  • Solving for z=r is a singularity.

For the simple cases of a burn at apoapsis/periapsis (the most common case), it is sufficient to merely solve the formula for precise orbital speed:
v = sqrt(mu * (2/r)-(1/a))
where r is the magnitude of the ship's position vector (or apoapsis/periapsis + body radius) and a is the target semi-major axis (r + target apoapsis or periapsis / 2)

commented

I saw this and I will most likely look into it when I have more free time in 2 or 3 weeks.

commented

Love the shout out to my old SE post.

I suspect this should get implemented as an optimization problem, though, using Levenburg-Marquardt or something like that.