space_object

Defines a space object. Encapsulates orbital elements, propagation and related methods.

Example:

Using space object for propagation.

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from astropy.time import Time

from sorts.propagator import Kepler
from sorts import SpaceObject

options = dict(
    settings=dict(
        in_frame='GCRS',
        out_frame='GCRS',
    ),
)

t = np.linspace(0,3600*24.0*2,num=5000)

obj = SpaceObject(
    Kepler,
    propagator_options = options,
    a = 7000e3, 
    e = 0.0, 
    i = 69, 
    raan = 0, 
    aop = 0, 
    mu0 = 0, 
    epoch = Time(57125.7729, format='mjd'),
    parameters = dict(
        d = 0.2,
    )
)

print(obj)

states = obj.get_state(t)



fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111, projection='3d')
ax.plot(states[0,:], states[1,:], states[2,:],"-b")

max_range = np.linalg.norm(states[0:3,0])*2

ax.set_xlim(-max_range, max_range)
ax.set_ylim(-max_range, max_range)
ax.set_zlim(-max_range, max_range)
plt.show()

Module summary

Classes

SpaceObject(propagator[, …])

Encapsulates a object in space who’s dynamics is governed in time by a propagator.

Contents

SpaceObject

class sorts.space_object.SpaceObject(propagator, propagator_options={}, propagator_args={}, parameters={}, epoch=<Time object: scale='utc' format='mjd' value=57125.7729>, oid=1, **kwargs)[source]

Bases: object

Encapsulates a object in space who’s dynamics is governed in time by a propagator.

The relation between the Cartesian and Kepler states are a direct transformation according to the below orientation rules. If the Kepler elements are given in a Inertial system, to reference the Cartesian to a Earth-fixed system a earth rotation transformation must be applied externally of the method.

#TODO: THIS DOC MUST BE UPDATED TOO

Orientation of the ellipse in the coordinate system:
  • For zero inclination \(i\): the ellipse is located in the x-y plane.

  • The direction of motion as True anoamly \(\nu\): increases for a zero inclination \(i\): orbit is anti-coockwise, i.e. from +x towards +y.

  • If the eccentricity \(e\): is increased, the periapsis will lie in +x direction.

  • If the inclination \(i\): is increased, the ellipse will rotate around the x-axis, so that +y is rotated toward +z.

  • An increase in Longitude of ascending node \(\Omega\): corresponds to a rotation around the z-axis so that +x is rotated toward +y.

  • Changing argument of perihelion \(\omega\): will not change the plane of the orbit, it will rotate the orbit in the plane.

  • The periapsis is shifted in the direction of motion.

  • True anomaly measures from the +x axis, i.e \(\nu = 0\) is located at periapsis and \(\nu = \pi\) at apoapsis.

  • All anomalies and orientation angles reach between 0 and \(2\pi\)

Reference: “Orbital Motion” by A.E. Roy.

Variables:
  • \(a\): Semi-major axis

  • \(e\): Eccentricity

  • \(i\): Inclination

  • \(\omega\): Argument of perihelion

  • \(\Omega\): Longitude of ascending node

  • \(\nu\): True anoamly

Variables
  • orbit (pyorb.Orbit) – Orbit instance

  • oid (int) – Identifying object ID

  • C_D (float) – Drag coefficient

  • C_R (float) – Radiation pressure coefficient

  • A (float) – Area [\(m^2\)]

  • m (float) – Mass [kg]

  • d (float) – Diameter [m]

  • mjd0 (float) – Epoch for state [BC-relative JD]

  • prop (float) – Propagator instance, child of PropagatorBase

  • propagator_options (dict) – Propagator initialization keyword arguments

  • propagator_args (dict) – Propagator call keyword arguments

The constructor creates a space object using Kepler elements.

Parameters
  • A (float) – Area in square meters

  • m (float) – Mass in kg

  • C_D (float) – Drag coefficient

  • C_R (float) – Radiation pressure coefficient

  • mjd0 (float) – Epoch for state

  • oid (int) – Identifying object ID

  • d (float) – Diameter in meters

  • propagator (PropagatorBase) – Propagator class pointer

  • propagator_options (dict) – Propagator initialization keyword arguments

  • propagator_args (dict) – Keyword arguments to be passed to the propagator call

  • kwargs (dict) – All additional keywords are used to initialize the orbit

Keyword arguments
  • a (float) – Semi-major axis in meters

  • e (float) – Eccentricity

  • i (float) – Inclination in degrees

  • aop (float) – Argument of perigee in degrees

  • raan (float) – Right ascension of the ascending node in degrees

  • mu0 (float) – Mean anomaly in degrees

  • x (float) – X-position

  • y (float) – Y-position

  • z (float) – Z-position

  • vx (float) – X-velocity

  • vy (float) – Y-velocity

  • vz (float) – Z-velocity

copy()[source]

Returns a copy of the SpaceObject instance.

get_position(t)[source]

Gets position at specified times using propagator instance.

Parameters

t (float/list/numpy.ndarray) – Time relative epoch in seconds.

Returns

Array of positions as a function of time.

Return type

numpy.ndarray of size (3,len(t))

get_state(t)[source]

Gets ECEF state at specified times using propagator instance.

Parameters

t (int/float/list/numpy.ndarray/astropy.time.Time/astropy.time.TimeDelta) – Time relative epoch in seconds.

Returns

Array of state (position and velocity) as a function of time.

Return type

numpy.ndarray of size (6,len(t))

get_velocity(t)[source]

Gets velocity at specified times using propagator instance.

Parameters

t (float/list/numpy.ndarray) – Time relative epoch in seconds.

Returns

Array of positions as a function of time.

Return type

numpy.ndarray of size (3,len(t))

property m

Object mass, if changed the Kepler elements stays constant

propagate(dt)[source]

Propagate and change the epoch of this space object if the state is a pyorb.Orbit.

update(**kwargs)[source]

If a pyorb.Orbit is present, updates the orbital elements and Cartesian state vector of the space object.

Can update any of the related state parameters, all others will automatically update.

Cannot update Keplerian and Cartesian elements simultaneously.

Parameters
  • a (float) – Semi-major axis in km

  • e (float) – Eccentricity

  • i (float) – Inclination in degrees

  • aop/omega (float) – Argument of perigee in degrees

  • raan/Omega (float) – Right ascension of the ascending node in degrees

  • mu0/anom (float) – Mean anomaly in degrees

  • x (float) – X position in km

  • y (float) – Y position in km

  • z (float) – Z position in km

  • vx (float) – X-direction velocity in km/s

  • vy (float) – Y-direction velocity in km/s

  • vz (float) – Z-direction velocity in km/s