# Using Modeling and Simulation to solve Lambert’s problem to enable space travel Spaceflight involves finding a path between an origin and a destination. In spaceflight mechanics, position and velocity are important because mathematically they determine the coordinates for both the origin and destination. The path between is called the orbit.

The determination of an orbit given two position vectors and the time of flight is known in celestial mechanics as Lambert’s problem, also known as two point boundary value problem. This contrasts with Kepler’s problem or propagation, which is rather an initial value problem.

The package `poliastro.iod` allows as to solve Lambert’s problem, provided the main attractor’s gravitational constant, the two position vectors and the time of flight. As you can imagine, being able to compute the positions of the planets as we saw in the previous section is the perfect complement to this feature!

For instance, this is a simplified version of the example Going to Mars with Python using poliastro, where the orbit of the Mars Science Laboratory mission (rover Curiosity) is determined:

ate_launch = time.Time(‘2011-11-26 15:02′, scale=’utc’)
date_arrival = time.Time(‘2012-08-06 05:17′, scale=’utc’)
tof = date_arrival – date_launch

ss0 = Orbit.from_body_ephem(Earth, date_launch)
ssf = Orbit.from_body_ephem(Mars, date_arrival)

from poliastro import iod
(v0, v), = iod.lambert(Sun.k, ss0.r, ssf.r, tof)

And these are the results:

>> v0
<Quantity [-29.29150998, 14.53326521, 5.41691336] km / s>
>>> v
<Quantity [ 17.6154992 ,-10.99830723, -4.20796062] km / s> This site uses Akismet to reduce spam. Learn how your comment data is processed.