Skip to content

Instantly share code, notes, and snippets.

@jorgepiloto
Created July 15, 2019 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgepiloto/76579262d741ce1b4d88d55f6c912d09 to your computer and use it in GitHub Desktop.
Save jorgepiloto/76579262d741ce1b4d88d55f6c912d09 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
from astropy import units as u
from astropy.time import Time
from poliastro.bodies import Earth, Mars
from poliastro.maneuver import Maneuver
from poliastro.plotting.static import StaticOrbitPlotter
from poliastro.twobody import Orbit
# Departure and time of flight for the mission
EPOCH_DPT = Time("2018-12-01")
EPOCH_ARR = EPOCH_DPT + 2 * u.year
# Origin and target orbits
ss_earth = Orbit.from_body_ephem(Earth, epoch=EPOCH_DPT)
ss_mars = Orbit.from_body_ephem(Mars, epoch=EPOCH_ARR)
man = Maneuver.lambert(ss_earth, ss_mars, short=False, M=1)
ss_trans, ss_target = ss_earth.apply_maneuver(man, intermediate=True)
op = StaticOrbitPlotter()
op.plot(ss_earth, label="Earth", color="navy")
op.plot(ss_mars, label="Mars", color="darkred")
op.plot(ss_trans, label="Long transfer", color="green")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment