KontrolSystem2
KontrolSystem2 copied to clipboard
issue following node.burn_vector
When I execute a burn for a maneuver node, I have this in my script:
while (dv_min.value >= 0.01) {
const ut = current_time()
craft.autopilot.target_orientation = nextNode.burn_vector
const dv = nextNode.expected_orbit.orbital_velocity(ut) - craft.orbit.orbital_velocity(ut)
let max_acc = craft.available_thrust / craft.mass
craft_throttle.throttle = min(dv.magnitude / max_acc, 1)
if(dv0 * dv < 0) break
if (current_time() > start_mnv + burn_duration + 20) break
yield()
}
Most of the time, it works well but I've noticed 2 strange situations where the craft.autopilot.target_orientation = nextNode.burn_vector doesn't seem to work very well.
1- around Minmus with a very elliptic orbit, I change my inclination's orbit at the apoapsis. The vessel doesn't stay aligned with the burn vector. 2- fly by of the Mun (picture below) when I start a maneuver at the periapsis of the mun to lower the periapsis around Kerbin.
Where should I investigate to understand those problems?
(I have plenty of electricity, I have gimbal and reaction wheel working perfectly... when I execute a long maneuver (for example from Kerbin to Minmus), I have no problem even if the maneuvers lasts more than 90 sec)
Instead of manually overriding the target_orientation you could just set the SAS to maneuver mode directly:
vessel.autopilot.mode = AutopilotMode.Maneuver
It should be the same, but I am still not sure if overriding the target_orientation on every yield somehow messes up the internal state of PID-loops in the SAS.
Concerning "following the burn vector" in general: For short burn there is a problem of a "run-away" burn-vector, since
- ... the burn-vector is a prediction that is updated asynchronously, and is therefore slightly outdated
- ... the prediction changes when the vessel is not on the correct course
- ... it takes time to turn the vessel To compensate it might be feasible to check if the vessel is correctly aligned and reduce the throttle if it is not so that the prediction can catch up.
Then again, controlling a course correction is actually a pretty complex problem: https://www.orbiterwiki.org/wiki/Powered_Explicit_Guidance
Instead of manually overriding the
target_orientationyou could just set the SAS to maneuver mode directly:vessel.autopilot.mode = AutopilotMode.ManeuverIt should be the same, but I am still not sure if overriding the
target_orientationon every yield somehow messes up the internal state of PID-loops in the SAS.
I'll try this. Thanks.
This issue was closed because it has been inactive for 14 days since being marked as stale.