Fix error caused by bug in the kOS language (?).
This commit is contained in:
parent
738f581155
commit
d353debe5a
|
@ -80,7 +80,6 @@ function launch {
|
|||
|
||||
wait until APOAPSIS > target_orbit_altitude.
|
||||
lock THROTTLE TO 0.
|
||||
unlock_control().
|
||||
|
||||
|
||||
print "--- CIRCULARIZE ---".
|
||||
|
@ -95,7 +94,7 @@ function launch {
|
|||
local node is NODE(TIME:SECONDS + ETA:APOAPSIS, 0, 0, 0).
|
||||
|
||||
// Burn magnitude in the prograde direction is the difference between the required velocity to acheive circular orbit at apoapsis altitude and our velocity at apoapsis
|
||||
local required_velocity is orbital_velocity_from_ap_pe(APOAPSIS, target_orbit_altitude, target_orbit_altitude).
|
||||
local required_velocity is orbital_velocity_from_ap_pe(APOAPSIS, APOAPSIS, target_orbit_altitude).
|
||||
set node:PROGRADE to required_velocity - VELOCITYAT(SHIP, TIME:SECONDS + ETA:APOAPSIS):ORBIT:MAG.
|
||||
|
||||
add node.
|
||||
|
@ -118,7 +117,7 @@ function calculate_launch_azimuth {
|
|||
local inertial_azimuth is ARCSIN(COS(target_orbit_inclination) / COS(launch_site_latitude)). // azimuth in inertial space, that is, disregarding the rotation of the body
|
||||
|
||||
local equatorial_rotational_velocity is (2 * CONSTANT:PI * BODY:RADIUS) / BODY:ROTATIONPERIOD.
|
||||
local target_orbit_velocity is orbital_velocity_from_ap_pe(APOAPSIS, target_orbit_altitude, target_orbit_altitude).
|
||||
local target_orbit_velocity is orbital_velocity_from_ap_pe(target_orbit_altitude, target_orbit_altitude, target_orbit_altitude).
|
||||
|
||||
local launch_vector_x_component is target_orbit_velocity * SIN(inertial_azimuth) - equatorial_rotational_velocity * COS(launch_site_latitude).
|
||||
local launch_vector_y_component is target_orbit_velocity * COS(inertial_azimuth).
|
||||
|
|
|
@ -42,9 +42,9 @@ function orbital_velocity {
|
|||
// http://www.orbiterwiki.org/wiki/Front_Cover_Equations
|
||||
// https://en.wikipedia.org/wiki/Vis-viva_equation
|
||||
parameter altitude.
|
||||
parameter semi_major_axis is semi_major_axis().
|
||||
parameter sma is semi_major_axis().
|
||||
|
||||
return SQRT(BODY:MU * ((2 / (altitude+BODY:RADIUS)) - (1 / semi_major_axis))). // add body radius because KSP measures altitude from the surface
|
||||
return SQRT(BODY:MU * ((2 / (altitude+BODY:RADIUS)) - (1 / sma))). // add body radius because KSP measures altitude from the surface
|
||||
}
|
||||
|
||||
function orbital_velocity_from_ap_pe {
|
||||
|
|
Loading…
Reference in a new issue