5
$\begingroup$

@astrojuanlu's answer mentions the existence of the Python package poliastro, and in the documentation there I found an example titled Going to Mars with Python using poliastro among others.

Input data used in the example includes some historical dates for the Mars Science Laboratory with the Curiosity rover, and some JPL Spice Kernels.

Apparently it generates an approximate mission trajectory from that somehow.

Question: In broad terms, how does it do this? What are the basic steps and methods it uses, and what kind of information is obtained? Is there an interplanetary trajectory that could be plotted? Times, magnitudes, and directions of Delta-V maneuvers as well?

I'm looking for more than just armchair speculation or "I suspect" class of answers. If possible, please give the example a test drive and include a script snippet and bit of output along with a summary that answers these questions. The idea is to provide an answer that's informative to future readers and users of poliastro. Thanks!

$\endgroup$
6
  • 3
    $\begingroup$ While not strictly off topic, I feel like documentation for polyastro belongs on the polyastro site; @astrojuanlu is likely the only person equipped to answer in any case. $\endgroup$ Jul 2, 2018 at 13:26
  • $\begingroup$ @RussellBorogove I'm not looking for computational details; I've adjusted the language to make it clearer that I'm just looking for an overview of the steps and what they accomplish. I think anyone who gives it a spin and knows a little bit of python and orbital mechanics will be able to do this. I've never looked at the source code for Skyfield Python package for example, but by using it, I have a basic understanding of how it does what it does. It's hard to know ahead of time that "nobody knows the answer to your question" with any certainty. $\endgroup$
    – uhoh
    Jul 2, 2018 at 13:34
  • 1
    $\begingroup$ Just in case the moderators decide to close this because of off-topic, I decided to leave an answer :) Hope it's useful! $\endgroup$ Jul 2, 2018 at 19:52
  • 1
    $\begingroup$ @uhoh remember to accept my answer if you think it's a good one $\endgroup$ Jul 10, 2018 at 21:10
  • 1
    $\begingroup$ @astrojuanlu yep, give me a few more days. I have been waiting for one of my three bounties to expire so I could add a reward bounty here as well. One just expired a few hours ago. Also need to read all of your links and give poliastro a test drive. Feel fee to ping me again if I don't finish by this weekend, and thank you again for the excellent answer! $\endgroup$
    – uhoh
    Jul 10, 2018 at 23:42

1 Answer 1

15
+100
$\begingroup$

Full disclaimer: I'm the author and main developer of poliastro.

The most important step before doing anything is somehow retrieving the positions and velocities of the planets of the Solar System. Astropy, one of the core dependencies of poliastro, ships medium-precision approximate models described in Simon et al "Numerical expressions for precession formulae and mean elements for the Moon and the planets" (1994). However, for high precision applications it's better to directly download the ephemeris from JPL, based on observational data from many different sources and covering a wide time span[1]. Another Python package, jplephem, is able to read the Chebyshev polynomials contained in these files and compute the cartesian elements of the available bodies.

After setting precise dates of launch and arrival, in this case for the Mars Science Laboratory mission, and neglecting the Trajectory Correction Maneuvers (TCMs) and other deviations from Keplerian trajectories, poliastro can solve the Two Body Boundary Problem, also known as Lambert's problem, which gives the trajectory between two given points. There are several algorithms to solve Lambert's problem, and poliastro uses the Izzo algorithm, described at Izzo "Revisiting Lambert's Problem" (2014), which uses a Householder iterative method (the 3rd order equivalent of Newton's method) to attain faster convergence with fewer function evaluations.

After that, the only remaining thing is plotting[2]. For Keplerian trajectories, poliastro already knows how to best sample the points to maximize efficiency (and to avoid ugly effects at the apocenter of highly eccentric orbits) by using a smart method described in Berry & Healy "The generalized Sundman transformation for propagation of high-eccentricity elliptical orbits" (2002). For the case of already computed trajectories or non keplerian orbits, poliastro allows the user to just use the set of vectors. To produce simpler 2D plots, poliastro reprojects all the orbits onto the perifocal frame of the first orbit. On the other hand, 3D plots do not require any kind of preprocessing.

MSL mission plot

[1] An alternative source with a compatible file format is the "Institut de Mécanique Céleste et de Calcul des Éphémérides" https://www.imcce.fr/recherche/equipes/asd/inpop/download17a#4, but they are not yet supported by Astropy.

[2] The only reason the plots were not appearing was because of an annoying bug with the underlying 3D JavaScript library and the documentation website.

$\endgroup$
1
  • 1
    $\begingroup$ @uhoh would you like to mark this one as the accepted answer? :) $\endgroup$ Sep 17, 2020 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.