API Refactor: Maneuver example - poliastro/poliastro GitHub Wiki

This is a rough idea on how I'd like to solve the problem of putting a satellite in a frozen orbit with a = 7000 km and i = 80 degrees from a parking circular orbit of h = 500 km and i = 30 degrees. As a first step, I'm finding out which is the best method to reach the optimal circular orbit previous to the eccentricity correction.

Notice that I don't know in advance the size of that orbit (it's part of the question), so for now I can assume it will have a = 7000 km, though this is not the correct answer.

After the API Refactor: Summary and recap, new ideas:

from poliastro import *

parking = State.circular(Earth, alt=500 * u.km, i=30 * u.deg, arglat=0 * u.deg)

# Option a) Bielliptic transfer + inclination change

# Here I may try some different values for the intermediate
# transfer orbit. *Or* I can create a function to verify
# in which conditions this is preferable to a Hohmann transfer.

pass

# Option b) Hohmann transfer + inclination change

p_b = Orbit(parking)
p_b.hohmann(a=7000 * u.km)
p_b.inc_change(inc=80 * u.deg)

print(p_b.state)  # Updated after propagation
print(p_b.time_of_flight)  # Added up after propagation
print(p_b.total_cost)  # Added up after all maneuvers

# Internally, the State is propagated after the maneuver is added
#p1 = Orbit(parking)
#p2 = Orbit(parking)
#p1._add_maneuver(Maneuver.hohmann(p.state, a=7000 * u.km)); p1.propagate()
#p2.hohmann(a=7000 * u.km)
#p1 == p2

# Option c) First Hohmann impulse + combined maneuver (inclination change + circularization)

p_c = Orbit(parking)
hohmann_1, hohmann_2 = Maneuver.hohmann(parking, a=7000 * u.km)
p_c.impulse(hohmann_1)
p_c.inc_change(inc=80 * u.deg)
p_c.impulse(hohmann_2)  # p_c.circularize()

print(p_c.state)
print(p_c.time_of_flight)
print(p_c.total_cost)

Propagating and plotting

The only thing I'm missing from this approach (found after many hours of iteration) is a straightforward way to plot the orbit. For example Plyades stores the whole propagation in the Orbit object using a little dt. The trick is that it's assuming elliptic orbits, so it's straightforward to vectorize: there's only one single line loop to convert mean anomaly to eccentric anomaly. For sure I'm integrating a better propagator.

Problem is that perhaps is a huge waste of resources storing the whole propagation data if I'm not requesting it (for example, if I'm only interested in the final state or the cost of the maneuvers), but if I don't do it I'd have to rewind the Orbit object and re-propagate it. Thus it would be interesting to store the initial state.