Skip to main content
useLandingAnalysis provides real-time access to touchdown detection, bounce counting, and settled landing analysis. It hydrates from GET /api/simulator/landing-analysis/snapshot on mount, then updates on flight:landing Socket.io events. The hook only re-renders when a landing-relevant event occurs — not on every simulator data tick. Landing data resets automatically when a new tracking session starts.

Import

import { useLandingAnalysis } from "@skyvexsoftware/stratos-sdk";

Signature

function useLandingAnalysis<TSelected = LandingAnalysisSnapshot>(
  options?: UseLandingAnalysisOptions<TSelected>
): UseLandingAnalysisReturn

type UseLandingAnalysisOptions<TSelected = LandingAnalysisSnapshot> = {
  select?: (snapshot: LandingAnalysisSnapshot) => TSelected;
};

type UseLandingAnalysisReturn = {
  landingRate: number | null;
  bounceCount: number;
  touchdowns: BounceData[];
  isOnGround: boolean;
  approachData: CapturePoint | null;
  landingAnalysis: LandingAnalysis | null;
  isLoading: boolean;
};

Parameters

ParameterTypeDescription
options.select(snapshot: LandingAnalysisSnapshot) => TSelectedSelector to subscribe to a specific subset of landing data

Return value

FieldTypeDescription
landingRatenumber | nullFinal landing rate in feet per minute (negative = descent). null until settled.
bounceCountnumberNumber of bounces detected on the current landing sequence
touchdownsBounceData[]Array of all touchdown events for the current landing
isOnGroundbooleanWhether the aircraft is currently on the ground
approachDataCapturePoint | nullSnapshot of flight parameters captured at approach
landingAnalysisLandingAnalysis | nullFull analysis object populated after a settled landing
isLoadingbooleantrue during the initial REST fetch

Types

BounceData

Each entry in touchdowns represents one touchdown contact:
type BounceData = {
  timestamp: number;
  landingRateFpm: number;
  gForce: number;
  groundSpeed: number;
  latitude: number;
  longitude: number;
};

CapturePoint

Approach data captured when the aircraft enters the final approach phase:
type CapturePoint = {
  timestamp: number;
  altitude: number;
  groundSpeed: number;
  indicatedAirspeed: number;
  verticalSpeed: number;
  heading: number;
  latitude: number;
  longitude: number;
};

LandingAnalysis

Populated after the aircraft settles (weight on wheels stabilizes):
type LandingAnalysis = {
  landingRateFpm: number;
  gForce: number;
  bounceCount: number;
  bounces: BounceData[];
  touchdownLatitude: number;
  touchdownLongitude: number;
  timestamp: number;
};

Usage

Display landing rate after touchdown

import { useLandingAnalysis } from "@skyvexsoftware/stratos-sdk";

export function LandingCard() {
  const { landingRate, bounceCount, isOnGround, isLoading } = useLandingAnalysis();

  if (isLoading) return <p>Loading...</p>;

  if (!isOnGround && landingRate === null) {
    return <p>Awaiting touchdown</p>;
  }

  return (
    <div>
      {landingRate !== null && (
        <p>Landing rate: {Math.round(landingRate)} fpm</p>
      )}
      {bounceCount > 0 && <p>Bounces: {bounceCount}</p>}
    </div>
  );
}

Show detailed analysis after settling

const { landingAnalysis, touchdowns } = useLandingAnalysis();

if (landingAnalysis) {
  return (
    <div>
      <p>Rate: {Math.round(landingAnalysis.landingRateFpm)} fpm</p>
      <p>G-force: {landingAnalysis.gForce.toFixed(2)}g</p>
      <p>Bounces: {landingAnalysis.bounceCount}</p>
    </div>
  );
}

Selector pattern

const { data: rate } = useLandingAnalysis({
  select: (s) => s.landingRate,
});

Notes

  • landingRate is null until a settled landing is detected. During a bounce sequence it updates per bounce.
  • The select option is passed directly to TanStack Query’s structural sharing. The component will not re-render if the selected value is deeply equal to the previous value.
  • Landing data resets when FlightEventPipeline.startTracking() is called at the beginning of a new flight — previous session data is not preserved across flights.