Sensor

class missiontools.Sensor(half_angle_deg, *, attitude_law=None, body_vector=None, body_euler_deg=None)[source]

Bases: object

An instrument attached to a spacecraft with a cone-shaped field of view.

Prefer the keyword arguments to select the pointing mode (see below). The constructor is public and may be called directly when needed.

Parameters:
  • half_angle_deg (float) – Half-angle of the sensor’s conical field of view (degrees). Must satisfy 0 < half_angle_deg <= 90.

  • attitude_law (AttitudeLaw, optional) – Independent AttitudeLaw for this sensor, decoupled from the host spacecraft’s attitude. Mutually exclusive with body_vector and body_euler_deg.

  • body_vector (array_like, shape (3,), optional) – Boresight direction expressed in the spacecraft body frame. Normalised on input. Mutually exclusive with attitude_law and body_euler_deg.

  • body_euler_deg ((yaw, pitch, roll) tuple of float, optional) – ZYX intrinsic Euler angles (degrees) defining the sensor frame relative to the spacecraft body frame. The boresight is the sensor frame’s z-axis expressed in body-frame coordinates. Mutually exclusive with attitude_law and body_vector.

Parameters:

Notes

Body-mounted sensors (body_vector or body_euler_deg) require the sensor to be attached to a spacecraft via add_sensor() before their pointing methods can be called.

Examples

Nadir-pointing sensor, 10° half-angle:

from missiontools import Sensor, AttitudeLaw
sensor = Sensor(10.0, attitude_law=AttitudeLaw.nadir())

Sensor body-mounted along spacecraft body-z (boresight = nadir for a nadir spacecraft), 5° half-angle:

sensor = Sensor(5.0, body_vector=[0, 0, 1])

Sensor tilted 30° in pitch from body-z:

sensor = Sensor(15.0, body_euler_deg=(0, 30, 0))
property half_angle_rad: float

FOV cone half-angle in radians.

property half_angle_deg: float

FOV cone half-angle in degrees.

property spacecraft

Host spacecraft, or None if not yet attached.

pointing_eci(r_eci, v_eci, t)[source]

Boresight unit vector(s) in the ECI frame.

For body_vector / body_euler_deg sensors the host spacecraft’s attitude_law is used to transform the body-frame boresight to ECI.

Parameters:
  • r_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI position(s) (m).

  • v_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI velocity(s) (m s⁻¹).

  • t (array_like of datetime64, shape ``(N,)`` or scalar) – Observation epoch(s).

Returns:

npt.NDArray[np.floating] – Unit boresight vector(s) in ECI, shape (N, 3) for array inputs or (3,) for scalar inputs.

Raises:

RuntimeError – If the sensor is in body mode and has not been attached to a spacecraft via add_sensor().

Parameters:
  • r_eci (ArrayLike)

  • v_eci (ArrayLike)

  • t (ArrayLike)

Return type:

ndarray[tuple[Any, …], dtype[floating]]

pointing_lvlh(r_eci, v_eci, t)[source]

Boresight unit vector(s) in the LVLH frame.

Parameters:
  • r_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI position(s) (m).

  • v_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI velocity(s) (m s⁻¹).

  • t (array_like of datetime64, shape ``(N,)`` or scalar) – Observation epoch(s).

Returns:

npt.NDArray[np.floating] – Unit boresight vector(s) in LVLH, shape (N, 3) for array inputs or (3,) for scalar inputs.

Parameters:
  • r_eci (ArrayLike)

  • v_eci (ArrayLike)

  • t (ArrayLike)

Return type:

ndarray[tuple[Any, …], dtype[floating]]

pointing_ecef(r_eci, v_eci, t)[source]

Boresight unit vector(s) in the ECEF frame.

Parameters:
  • r_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI position(s) (m).

  • v_eci (array_like, shape ``(N, 3)`` or (3,)) – Host spacecraft ECI velocity(s) (m s⁻¹).

  • t (array_like of datetime64, shape ``(N,)`` or scalar) – Observation epoch(s).

Returns:

npt.NDArray[np.floating] – Unit boresight vector(s) in ECEF, shape (N, 3) for array inputs or (3,) for scalar inputs.

Parameters:
  • r_eci (ArrayLike)

  • v_eci (ArrayLike)

  • t (ArrayLike)

Return type:

ndarray[tuple[Any, …], dtype[floating]]