Orbital

bsk_rl.utils.orbital:Utilities for computing orbital events.

random_orbit(i: float | None = 45.0, alt: float = 500, r_body: float = 6371, e: float = 0, Omega: float | None = None, omega: float | None = 0, f: float | None = None) <MagicMock name='mock.ClassicElements' id='140715586256960'>[source]

Create a set of orbit elements.

Parameters are fixed if specified and randomized if None. Defaults to a random circular orbit at 500 km altitude and 45 deg inclination.

Parameters:
  • i (float | None) – [deg] Inclination, randomized in [-pi, pi].

  • alt (float) – [km] Altitude above r_body.

  • r_body (float) – [km] Body radius.

  • e (float) – Eccentricity.

  • Omega (float | None) – [deg] LAN, randomized in [0, 2pi].

  • omega (float | None) – [deg] Argument of periapsis, randomized in [0, 2pi].

  • f (float | None) – [deg] True anomaly, randomized in [0, 2pi].

Returns:

orbital elements

Return type:

ClassicElements

random_epoch(start: int = 2000, end: int = 2022)[source]

Generate a random epoch in a year range.

Date will always be in the first 28 days of the month.

Parameters:
  • start (int) – Initial year.

  • end (int) – Final year.

Returns:

Epoch in YYYY MMM DD HH:MM:SS.SSS (UTC) format

lla2ecef(lat: float, long: float, radius: float)[source]

Project LLA to Earth Centered, Earth Fixed location.

Parameters:
  • lat (float) – [deg]

  • long (float) – [deg]

  • radius (float) – [any]

elevation(r_sat: ndarray, r_target: ndarray) ndarray[source]

Find the elevation angle from a target to a satellite.

Parameters:
  • r_sat (ndarray) – Satellite position(s).

  • r_target (ndarray) – Target position.

Returns:

Elevation angle(s)

Return type:

ndarray

walker_delta(n_spacecraft: int, n_planes: int, rel_phasing: float, altitude: float, inc: float, clustersize: int = 1, clusterspacing: float = 0) list[<MagicMock name='mock.orbitalMotion.ClassicElements' id='140715586261664'>][source]

Compute the initial orbit conditions of a Walker-delta constellation.

Parameters:
  • n_spacecraft (int) – Number of spacecraft.

  • n_planes (int) – Number of orbital planes.

  • rel_phasing (float) – [deg] Relative phasing between planes.

  • altitude (float) – [m] Altitude above Earth’s surface.

  • inc (float) – [deg] Inclination.

  • clustersize (int) – Number of spacecraft in each cluster.

  • clusterspacing (float) – [deg] Spacing between spacecraft in a cluster.

Returns:

List of orbital elements

Return type:

list

walker_delta_args(n_planes: int, rel_phasing: float = 0.0, altitude: float = 500, inc: float = 45.0, randomize_true_anomaly=True, randomize_lan=True, **walker_delta_kwargs)[source]

Generate a function to generate a randomly phased Walker-delta constellation.

The output of this function should be used to set the sat_arg_randomizer of the environment.

Parameters:
  • n_planes (int) – Number of constellation planes.

  • rel_phasing (float) – [deg] Relative phasing between planes. Defaults to 0.0.

  • altitude (float) – [km] Orbit altitude above Earth’s surface.

  • inc (float) – [deg] Orbit inclination

  • randomize_true_anomaly – Add a random true anomaly phase shift that is the same for all constellation members on each call.

  • randomize_lan – Add a random LAN phase shift that is the same for all constellation members on each call.

  • walker_delta_kwargs – Additional arguments to pass to walker_delta.

rv2HN(r_N: ndarray, v_N: ndarray)[source]

Find the Hill frame rotation matrix from position and velocity.

Parameters:
  • r_N (ndarray) – Position vector in the inertial frame

  • v_N (ndarray) – Velocity vector in the inertial frame

Returns:

Hill frame rotation matrix HN

rv2omega(r_N: ndarray, v_N: ndarray)[source]

Find the Hill frame rotation rate from position and velocity.

Parameters:
  • r_N (ndarray) – Position vector in the inertial frame

  • v_N (ndarray) – Velocity vector in the inertial frame

Returns:

Angular velocity of the Hill frame in the inertial frame

Return type:

omega_HN_N