Waypoint¶
Waypoint class for flight planning with position, altitude, heading, and speed.
- class Waypoint[source]¶
Bases:
object- __init__(latitude, longitude, heading, altitude_msl=None, name=None, speed=None, delay=None, segment_type=None)[source]¶
Initialize a Waypoint object.
- Parameters:
latitude (float) – Latitude in decimal degrees.
longitude (float) – Longitude in decimal degrees.
heading (float) – Heading in degrees relative to North.
altitude_msl (Union[Quantity, float, None], optional) – Altitude MSL in meters or as a pint Quantity. Defaults to None.
name (str, optional) – Name of the waypoint. Defaults to None.
speed (Union[Quantity, float, None], optional) – Speed override in m/s or as a pint Quantity. Used for the departing leg. Defaults to None.
delay (Union[Quantity, float, None], optional) – Loiter time at waypoint in seconds or as a pint Quantity. Defaults to None.
segment_type (str, optional) – Segment type label for the departing leg (e.g. “pattern”, “sampling”). Used by compute_flight_plan. Defaults to None.
- offset_north_east(offset_north, offset_east)[source]¶
Return a new Waypoint translated by geodetic N/E offsets.
- Parameters:
offset_north (
Union[Quantity,float]) – Distance north (positive) or south (negative). Float interpreted as meters; or a pint Quantity with length units.offset_east (
Union[Quantity,float]) – Distance east (positive) or west (negative). Float interpreted as meters; or a pint Quantity with length units.
- Return type:
- Returns:
A new Waypoint at the translated position, preserving all other attributes.
- to_dict()[source]¶
Convert the waypoint to a dictionary representation.
The returned dict round-trips through
Waypoint.from_dict()and includes every field accepted by__init__. Quantity-valued fields (altitude_msl,speed,delay) are returned aspint.Quantityinstances; for JSON-friendly output the caller is responsible for serialization.- Returns:
- Dictionary with all eight Waypoint fields:
latitude,longitude,heading,altitude_msl,name,speed,delay,segment_type.
- Return type:
Dict
- classmethod from_dict(data)[source]¶
Reconstruct a Waypoint from a
to_dict()dictionary.Required keys are
latitude,longitude, andheading. Optional keys (altitude_msl,name,speed,delay,segment_type) default toNoneif absent. This is the inverse ofto_dict()and round-trips losslessly when the Quantity fields are preserved aspint.Quantityinstances.