# FlightState

> Talos next · Since next

What a multirotor did on the last tick ({@link EntityHandle.flight}).

## Signature

```ts
export interface FlightState {
  /** The flight mode it flew. */
  mode: "rate" | "angle" | "velocity"
  /** Whether its motors are on. */
  armed: boolean
  /** Total thrust, newtons. */
  thrust: number
  /** Tilt from level, radians. */
  tilt: number
  /** Heading, radians: 0 facing -Z, positive turned left. */
  heading: number
  /** Speed through the air, m/s (the wind included). */
  airspeed: number
  /** Speed over the ground, m/s. */
  groundSpeed: number
  /** Vertical speed, m/s, up positive. */
  climbRate: number
  /** Battery left, 0..1. */
  charge: number
  /** The battery ran out and the motors stopped. */
  empty: boolean
  /** It holds a point (velocity mode, sticks centred). */
  holdingPosition: boolean
  /** It holds an altitude (lift centred). */
  holdingAltitude: boolean
  /** The rotors could not give everything asked this tick. */
  saturated: boolean
  /** On the ground with its motors idling; a climb takes it off. */
  landed: boolean
  /** Each rotor's speed as a share of full, 0..1. */
  rotorSpeeds: number[]
}
```

Import: `import type { FlightState } from "@argus/api"`

## Members

| Member | Signature | Description |
|---|---|---|
| `mode` | `mode: "rate" \| "angle" \| "velocity"` | The flight mode it flew. |
| `armed` | `armed: boolean` | Whether its motors are on. |
| `thrust` | `thrust: number` | Total thrust, newtons. |
| `tilt` | `tilt: number` | Tilt from level, radians. |
| `heading` | `heading: number` | Heading, radians: 0 facing -Z, positive turned left. |
| `airspeed` | `airspeed: number` | Speed through the air, m/s (the wind included). |
| `groundSpeed` | `groundSpeed: number` | Speed over the ground, m/s. |
| `climbRate` | `climbRate: number` | Vertical speed, m/s, up positive. |
| `charge` | `charge: number` | Battery left, 0..1. |
| `empty` | `empty: boolean` | The battery ran out and the motors stopped. |
| `holdingPosition` | `holdingPosition: boolean` | It holds a point (velocity mode, sticks centred). |
| `holdingAltitude` | `holdingAltitude: boolean` | It holds an altitude (lift centred). |
| `saturated` | `saturated: boolean` | The rotors could not give everything asked this tick. |
| `landed` | `landed: boolean` | On the ground with its motors idling; a climb takes it off. |
| `rotorSpeeds` | `rotorSpeeds: number[]` | Each rotor's speed as a share of full, 0..1. |

## Example

The tested fixture `fixtures/host/door.ts`.

```ts
import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
  update(ctx) {
    const player = ctx.world.find("player")
    const near = player !== null && ctx.entity.distanceTo(player) < 2
    ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
  },
} satisfies Behavior
```
