Sensor¶
- class missiontools.Sensor(half_angle_deg, *, attitude_law=None, body_vector=None, body_euler_deg=None)[source]¶
Bases:
objectAn 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 satisfy0 < half_angle_deg <= 90.attitude_law (
AttitudeLaw, optional) – IndependentAttitudeLawfor this sensor, decoupled from the host spacecraft’s attitude. Mutually exclusive withbody_vectorandbody_euler_deg.body_vector (
array_like,shape (3,), optional) – Boresight direction expressed in the spacecraft body frame. Normalised on input. Mutually exclusive withattitude_lawandbody_euler_deg.body_euler_deg (
(yaw,pitch,roll) tupleoffloat, 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 withattitude_lawandbody_vector.
- Parameters:
Notes
Body-mounted sensors (
body_vectororbody_euler_deg) require the sensor to be attached to a spacecraft viaadd_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 spacecraft¶
Host spacecraft, or
Noneif not yet attached.
- pointing_eci(r_eci, v_eci, t)[source]¶
Boresight unit vector(s) in the ECI frame.
For
body_vector/body_euler_degsensors the host spacecraft’sattitude_lawis 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_likeofdatetime64,shape ``(N,)``orscalar) – 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:
- 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_likeofdatetime64,shape ``(N,)``orscalar) – 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:
- 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_likeofdatetime64,shape ``(N,)``orscalar) – 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: