astrix.utils module¶
Utility functions for Astrix.
Should not be imported to core type modules to avoid circular dependencies.
- defeature_path(path, tol=50.0)[source]¶
Defeature a path by removing points that are within tol meters of a straight line between their neighbors. The first and last points are always kept. Useful for plotting.
- get_ned_rotation(loc, backend=None)[source]¶
Calculate the rotation matrix from ECEF to NED frame at the given location.
- Parameters:
loc (
Location) – Location The location to calculate the NED rotation matrix for.backend (
str|Any|None) – BackendArg The backend to use. If None, uses the backend of the location.
- Return type:
- Returns:
- Rotation
The rotation matrix from ECEF to NED frame at the given location.
- ground_path(path, alt=0.0)[source]¶
Return a new path with all points at the specified altitude (default 0 m).
- path_to_az_el_rate(path, time, frame, backend=None)[source]¶
Project the velocity vectors of a path to azimuth and elevation components
- point_from_heading(start, head, dist, time_new=Time invariant (n=1), method='haversine')[source]¶
Calculate a new point given a start point, heading (degrees) and distance (meters). If point has len > 1, uses the last point.
Note: Applicable for NumPy backend only.
- solve_wahba(v, w, weights=None)[source]¶
Calculate the rotation matrix R which transforms vectors w to v. It is posed as Wahba’s problem https://en.wikipedia.org/wiki/Wahba%27s_problem
- Parameters:
v (
Any) – vectors in the first coordiante framew (
Any) – vectors in the second coordinate frameweights (
Any|None) – weights associated with each vector. Otherwise assumed even weights (NumPy only)
- Return type:
tuple[Any,Any]- Returns:
R (3x3 numpy array) – The rotation matrix such that w ~ Rv
delta_angle_deg ((n,) numpy array) – Angle differences between rotated w and v, in degrees, as a quality metric
Note these functions are very important for real-time evaluation. They need robust functional testing and good coding practices.