import type { PositionAnchor } from './types'; /** * Anchor state in the fusion engine's hybrid anchor behavior model. * * - `'none'`: No anchor active; GPS measurements accepted, PDR ignored * - `'anchor-only'`: Anchor active and in exclusive period; GPS rejected, PDR accepted * - `'transition'`: Anchor active but past exclusive period; GPS accepted with increasing weight */ export type AnchorState = 'none' | 'anchor-only' | 'transition'; /** * Configuration for anchor state computation. */ export interface AnchorStateConfig { /** Duration in ms where anchor is exclusive (GPS rejected). Default: 5000 */ anchorOnlyPeriodMs: number; } /** * Default anchor state configuration. */ export declare const DEFAULT_ANCHOR_STATE_CONFIG: AnchorStateConfig; /** * Compute anchor state from current time and config. * * Pure function with no side effects or Date.now() calls. * All time values are passed explicitly for deterministic testing. * * @param anchor - Current position anchor, or undefined if none set * @param anchorSetTimeMs - Timestamp (ms) when anchor was set, or undefined * @param nowMs - Current timestamp in milliseconds * @param config - Anchor state configuration * @returns The current anchor state * * @example * ```ts * // No anchor * getAnchorState(undefined, undefined, Date.now(), config); // 'none' * * // Anchor just set (within anchor-only period) * getAnchorState(anchor, 1000, 3000, { anchorOnlyPeriodMs: 5000 }); // 'anchor-only' * * // Anchor set 6s ago (past anchor-only period, within TTL) * getAnchorState(anchor, 1000, 7000, { anchorOnlyPeriodMs: 5000 }); // 'transition' * * // Anchor expired (past TTL) * getAnchorState(anchor, 1000, 40000, { anchorOnlyPeriodMs: 5000 }); // 'none' * ``` */ export declare function getAnchorState(anchor: PositionAnchor | undefined, anchorSetTimeMs: number | undefined, nowMs: number, config: AnchorStateConfig): AnchorState; /** * Calculate the decay factor for anchor confidence during transition. * * Uses exponential decay so anchor confidence smoothly decreases, * allowing GPS to gradually take over. * * @param anchorSetTimeMs - When anchor was set * @param nowMs - Current time * @param config - Anchor state config (for transition start time) * @param halfLifeMs - Half-life of anchor confidence decay in ms * @returns Decay factor from 0 to 1 (1 = full confidence, 0 = no confidence) * * @example * ```ts * // At start of transition (elapsed = anchorOnlyPeriodMs) * getAnchorConfidenceDecay(0, 5000, config, 10000); // ~1.0 * * // One half-life into transition * getAnchorConfidenceDecay(0, 15000, config, 10000); // ~0.5 * ``` */ export declare function getAnchorConfidenceDecay(anchorSetTimeMs: number, nowMs: number, config: AnchorStateConfig, halfLifeMs: number): number;