Skip to content

Instantly share code, notes, and snippets.

@djungelorm
Created July 18, 2017 18:33
Show Gist options
  • Save djungelorm/371a8b075e75b081b3c366fb31125fef to your computer and use it in GitHub Desktop.
Save djungelorm/371a8b075e75b081b3c366fb31125fef to your computer and use it in GitHub Desktop.
Script for testing orbital parameters
import krpc
import time
import math
conn = krpc.connect()
vessel = conn.space_center.active_vessel
orbit = vessel.orbit
ut = conn.add_stream(getattr, conn.space_center, 'ut')
def rad_to_deg(rad):
return rad * (180.0/math.pi)
while True:
print 'true anomaly: %.1f, %.1f' % \
(rad_to_deg(orbit.true_anomaly),
rad_to_deg(orbit.true_anomaly_at_ut(ut())))
print ' ecc anomaly: %.1f, %.1f' % \
(rad_to_deg(orbit.eccentric_anomaly),
rad_to_deg(orbit.eccentric_anomaly_at_ut(ut())))
print 'mean anomaly: %.1f' % \
rad_to_deg(orbit.mean_anomaly)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment