Function fly_airship_inner

Source
fn fly_airship_inner(
    phase: AirshipFlightPhase,
    wpos: Vec3<f32>,
    goal_dist: f32,
    initial_speed_factor: f32,
    height_offset: f32,
    with_terrain_following: bool,
    direction_override: Option<Dir>,
    flight_mode: FlightMode,
    with_collision_avoidance: bool,
    radar_interval: Duration,
) -> impl Action<AirshipRouteContext>
Expand description

Called from pilot_airship to move the airship along phases of the route and for initial routing after server startup. The bulk of this action is collision-avoidance monitoring. The frequency of the collision-avoidance tests is controlled by the radar_interval parameter. The collision-avoidance logic has the ability to change the airship’s speed and to hold position.

§Avoidance Logic

All airships on the same route follow what is essentially a race track. All collision issues are caused by airships catching up to each other on the route. To avoid collisions, the postion and movement of other airships on the route is monitored at a interval of between 2 and 4 seconds. If another airship is moving towards the same docking position, it may be ahead or behind the monitoring airship. If the other airship is ahead, and the monitoring airship is approaching the docking position, the monitoring airship will slow down or stop to avoid a potential conflict.

§Parameters

  • route_context: The AirshipRouteContext owned by the pilot_airship action.
  • phase: One of the phases of the airship flight loop or reset stages.
  • wpos: The fly-to target position for the airship.
  • goal_dist: The distance to the target position at which this action (this phase) will stop.
  • initial_speed_factor: The initial speed factor for the airship. Can be modified by collision-avoidance.
  • height_offset: The height offset for the airship (height above terrain). This is only used if with_terrain_following is true.
  • with_terrain_following: Whether to follow the terrain. If true, the airship will fly at a height above the terrain. If false, the airship flies directly to the target position.
  • direction_override: An optional direction override for the airship. If Some, the airship will be oriented (pointed) in this direction.
  • flight_mode: Influences the positioning of the airship. When approaching or at the target position, the airship either slows (brakes) and holds or flys through, expecting to continue on the next flight phase.
  • with_collision_avoidance: Whether to perform collision avoidance. It’s not needed for docking or initial ascent because other airships must give way to this airship.
  • radar_interval: The interval at which to check on the positions and movements of other airships on the same route.

§Returns

An Action