Fly-by routines
The gravity assist technique, widely used in the Pioneer and Voyager missions, was developed by Michael Andrew Minovitch when he was a UCLA graduate student working as intern at NASA’s Jet Propulsion Laboratory. Many authors later refined the technique which, avoiding to solve directly the full three body problem, is based on patching the planetocentric hyperbola with incoming and outgoing (elliptic) trajectories. In pykep we offer the basic routines that allow to use this technique in the context of trajectory optimization and patched conics propagations.
Minovitch fly-by
pykep.fb_con(v_rel_in, v_rel_out, mu, safe_radius) : Alternative signature: fb_con(v_rel_in, v_rel_out, planet)
Computes the constraint violation during a fly-by modelled as an instantaneous rotation of the incoming and outgoing relative velocities (Mivovitch).
The two relative velocities must be identical in magnitude (equality constraint). The inequality constraint is defined in a differentiable
form as:
where:
and:
Note
This function is often used in the multiple gravity assist low-thrust (MGA-LT) encoding of an interplanetary trajectory where multiple
low-thrust legs are patched at the fly-by planets by forcing satisfaction for these constraints.
Args:
: *v\_rel\_in* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the incoming relative velocity.
*v\_rel\_out* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the outgoing relative velocity.
*mu* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planet gravitational parameter
*safe\_radius* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planet safe radius
*planet* ([`planet`](/u/b8b3c9975f4a752a#pykep-planet)): planet (in which case *mu* and *safe\_radius* will be extracted from this object). Note: this signature is slower and to be avoided.
Returns:
: [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) [[`float`](https://docs.python.org/3/builtins/functions.html#float), [`float`](https://docs.python.org/3/builtins/functions.html#float)]: The equality constraint violation (defined as the difference between the squared velocities) and the inequality constraint violation
(negative if satisfied).
Examples:
: ```defaultimport pykep as pk eq, ineq = pk.fb_con(v_rel_in = [10.,1.,-4.], v_rel_out = [10.,1.,-4.], mu = 1., safe_radius = 1.)
fb\_con(jacobian = False)
Assembles and returns the `heyoka` symbolic expressions for the fly-by constraints.
The symbolic variables are, in order: `[vx_i, vy_i, vz_i, vx_o, vy_o, vz_o]`.
The symbolic parameters are `[par[0], par[1]] = [mu, safe_radius]`.
The returned constraints are:
where:
and:
Args:
: *jacobian* ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), optional): If `True`, also returns the Jacobian matrix of
`[eq_V2, ineq_delta]` with respect to `[vx_i, vy_i, vz_i, vx_o, vy_o, vz_o]`.
Returns:
: [[`list`](https://docs.python.org/3/builtins/stdtypes.html#list), [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) or `None`]:
: A pair `(expr, jac)` where:
- *expr* is a list of two `heyoka.expression` objects representing
`[eq_V2, ineq_delta]`
- *jac* is either `None` (if `jacobian=False`) or a list of 12
`heyoka.expression` objects representing the 2x6 Jacobian
Examples:
: ```default
>>> import pykep as pk
>>> expr, jac = pk.fb_con()
>>> len(expr), jac is None
(2, True)
>>> expr, jac = pk.fb_con(True)
>>> len(expr), len(jac)
(2, 12)pykep.fb_dv(v_rel_in, v_rel_out, mu, safe_radius) : Alternative signature: fb_dv(v_rel_in, v_rel_out, planet)
Computes the necessary to perform a fly-by modelled as an instantaneous rotation of the incoming and outgoing
relative velocities (Mivovitch). If planetary gravity is not enough to patch the incoming and outcoming conditions
(i.e. the [`fb_con()`](#pykep.fb_con) returns some constraint violation) a is assumed
at the end of the planetocentric hyperbola.
Note
This function is often used in the multiple gravity assist (MGA) encoding of an interplanetary trajectory where multiple
Lambert arcs are patched at the fly-by planets by applying a hopefully vanishing .
Args:
: *v\_rel\_in* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the incoming relative velocity.
*v\_rel\_out* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the outgoing relative velocity.
*mu* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planet gravitational parameter
*safe\_radius* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planet safe radius
*planet* ([`planet`](/u/b8b3c9975f4a752a#pykep-planet)): planet (in which case *mu* and *safe\_radius* will be extracted from this object). Note: this signature is slower and to be avoided.
Returns:
: [`float`](https://docs.python.org/3/builtins/functions.html#float): The magnitude of the required
Examples:
: ```defaultimport pykep as pk DV = pk.fb_dv(v_rel_in = [10.,1.,-4.], v_rel_out = [10.,1.,-4.], mu = 1., safe_radius = 1.)
pykep.fb\_vout(*v\_in*, *v\_pla*, *rp*, *beta*, *mu*)
: Propagates incoming conditions through a planetary encounter (fly-by) assuming an instantaneous rotation of magnitude of
the incoming and outgoing relative velocities (Mivovitch). The planetocentric hyperbola (hence the angle ) is fully
determined by the incoming condition as well as by its pericenter
and an angle defining the orientation of the orbital plane. Eventually the outgoing conditions are computed as:
where the frame is defined by the incoming
relative velocity (normalized), (normalized) and completing the right handed frame.
Note
This function is often used in the multiple gravity assist with DSM (MGA-DSM) encoding of an interplanetary trajectory where multiple
impulsive manoeuvres are allowed between planetary fly-bys.
Args:
: *v\_in* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the incoming velocity
(note: this is NOT the relative velocity, rather the absolute and in the same frame as *v\_pla*).
*v\_pla* ([`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,)): Cartesian components of the planet velocity.
*rp* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planetocentric hyperbola pericenter radius.
*beta* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planetocentric hyperbola plane angle.
*mu* ([`float`](https://docs.python.org/3/builtins/functions.html#float)): planet gravitational parameter.
Returns:
: [`list`](https://docs.python.org/3/builtins/stdtypes.html#list) (3,): The outgoing velocity in the frame of *v\_pla* (inertial).
Examples:
: ```default
>>> import pykep as pk
>>> DV = pk.fb_vout(v_in = [1.,1.,1], v_pla = [10.,1.,-4.], rp = 1., mu = 1., beta=1.2)