MechJeb2

MechJeb2

4M Downloads

Launch inclination fix

NathanKell opened this issue ยท 6 comments

commented

In ascent guidance, the inclination box doesn't actually give you an inclination; instead you're just setting launch azimuth and burning in that direction, with the plane becoming whatever. This is particularly a problem when using launch-to-rendezvous or launch-into-target-plane, which require exact inclinations.
I know it's Math :( but here is a page that should help.
http://www.orbiterwiki.org/wiki/Launch_Azimuth
With this you should be able to calculate the azimuth to launch along to achieve a desired plane, or state "plane unreachable."

commented

The input really is an inclination, not a launch azimuth. The math for this is already implemented here, and the ascent AP is using it. If the AP is failing to achieve the desired inclination, I guess either something has broken or the controller needs to be tuned.

commented

Interesting. When I was actually playing KSP more (and with stock sizes) about eight months ago, my inclinations would always be off a degree or two, which I presumed was because rotation wasn't taken into account. Maybe the transition to inertial is too slow for how tiny Kerbin is? Inclination is a bit less off desired in RSS MJ non-equatorial launches I think.

commented

Really--huh! Was it always like this or was that changed in the last year or so?
That said, it doesn't look like it's taking body rotation into account.

commented

It's always been like this, since version 1.0 of my AR202 part before it became part of MechJeb :)

The body rotation is taken into account here. The AP computes the current velocity vector and a desired velocity vector and then steers to reduce the difference between them. Initially, the current velocity vector is calculated in the rotating reference frame of the planet. Steering according to this velocity vector will result in the inclination being slightly off, because of the rotation of the planet, so the initial launch azimuth doesn't account for the planet rotation. But as the vessel ascends this calculation gradually shifts to the inertial reference frame, which is independent of the planet rotation, so that the AP will correct the initial error and the final inclination ought to end up correct.

That said, maybe your link gives a cleaner way of accounting for planet rotation which might simplify the code a bit...

commented

Unless Corrective Steering is checked it won't try to fix any early rotating reference frame error. Unfortunately Corrective Steering has unwanted effects like pointing a ship below the horizon. Errors in inclination are consistent and increase with desired inclination: no error at 0, 5.2 actual at 6 desired and 85 actual at 90 desired.

commented

fixed this a long time ago so it properly follows great circle routes. then PEG came and made targeting desired inclinations really accurate. the old trick of setting a high altitude to avoid the classic ascent guidance cutting the engine when apo > target on RO/RSS also used to mess things up terribly.