Interview conceptStatistics & Math

Trajectory, Kinematics, And Collision Analysis

Asked of: Data Scientist

Last updated

Top-to-bottom flowchart showing inputs → compute relative r(t) → decision: linear? → quadratic solve or segment+Brent → interpolation & sampling → uncertainty → scalability → outputs (collision intervals, TTC, calibration).

What's being tested

Interviewers probe your ability to convert vehicle motion into analyzable mathematical objects, select appropriate statistical or numerical methods, and reason about uncertainty and scale. They expect clear problem framing (assumptions, observables), correct kinematic modeling (relative motion → algebraic root problems or time-series comparisons), and principled evaluation metrics that capture safety-relevant errors. For Waymo, the focus is on defensible, reproducible analysis (false positive/negative tradeoffs, calibration) rather than low-level sensor plumbing.

Core knowledge

  • Relative motion reduction: For two objects with positions p1(t), p2(t), define relative position r(t)=p1(t)-p2(t); collision when ∣r(t)∣≤R|r(t)| ≤ R (sum of radii). Squared-distance d2(t)=r(t)⋅r(t)d^2(t)=r(t)·r(t) is the central scalar function to analyze.

  • Quadratic closed-form case: If each object moves linearly (p(t)=p0+v t), then d2(t)=at2+bt+cd^2(t)=a t^2 + b t + c; solve at2+bt+(c−R2)≤0a t^2 + b t + (c-R^2) ≤ 0 via discriminant Δ=b2−4a(c−R2)\Delta=b^2-4a(c-R^2). Real roots → collision interval; Δ≈0\Delta≈0 → grazing/tangent contact.

  • Numerical root-finding: For higher-order/parametric trajectories (splines, polynomials), use robust solvers (brentq, Brent’s method) on d2(t)−R2d^2(t)-R^2 with bracketed intervals; prefer bracketed methods over pure Newton to avoid divergence.

  • Piecewise models & monotonicity: Break trajectories into segments where motion model is simple (constant velocity/acceleration or low-order spline). Solve per-segment and merge intervals — avoids global multimodality pitfalls.

  • Discrete sampling & interpolation: Real logs are sampled; use sinc-compatibility thinking: ensure interpolation (linear / cubic spline) doesn't introduce spurious crossings. Report resolution-limited uncertainty: sample interval Δt\Delta t sets minimum resolvable time-to-collision.

  • Uncertainty propagation: For Gaussian position noise, linearize root solution to approximate time uncertainty via the implicit function theorem, or compute confidence intervals via bootstrap or Monte Carlo perturbation of trajectories.

  • Scalability & candidate filtering: Naive pairwise is O(N2)O(N^2); for NN up to a few hundred (typical road scene) it's fine, but for thousands use spatial bucketing / R-tree-style prefiltering or coarse time-to-contact heuristics to prune pairs. Document assumptions about upstream sampling frequency.

  • Trajectory comparison metrics: For comparing turns use Dynamic Time Warping (DTW), Fréchet distance, or functional summaries (curvature, yaw-rate, lateral displacement) and model differences with mixed-effects or permutation tests to control vehicle-level correlation.

  • Statistical testing & multiple comparisons: When testing many segments/cohorts, correct p-values using Benjamini–Hochberg or conservative Bonferroni depending on FDR vs family-wise error tradeoffs.

  • Evaluation metrics for collision prediction: Use precision–recall curves and area under PR (AUPR) for imbalanced events; report time-error metrics like MAE of predicted time-to-collision and calibration curves for estimated probabilities.

  • Edge cases: Handle initial overlaps (collision at t=0t=0), tangential grazes (Δ≈0\Delta≈0 numerical sensitivity), and very-high-speed/low-radius pairs that amplify discretization and floating-point errors.

  • Safety-aware thresholds: For alarm systems, preferring higher recall (catch all imminent collisions) may be mandated; quantify business cost with a simple cost matrix and optimize thresholds accordingly.

Tip: Always state whether you assume continuous-time analytic trajectories or discrete logged samples — it determines analytic vs numerical solution choices.

Worked example — Determine earliest collision among moving cars

First 30s framing: ask what observables you have (position, velocity, vehicle radii, sample rate), what motion model is acceptable (constant velocity, constant accel, or spline-interpolated), and the time window of interest. Skeleton answer pillars: (1) reduce to per-pair relative-position problem r(t) and d2(t)d^2(t), (2) choose solver: closed-form quadratic if linear motion, otherwise bracketed numerical root-finding per segment, (3) scale/prune candidate pairs and quantify uncertainty. A strong candidate explicitly handles initial overlap and tangency: check c−R2≤0c-R^2 ≤ 0 at t=0t=0 (immediate collision), and treat Δ≈0\Delta≈0 with a tolerance epsilon tied to measurement noise. Tradeoff to flag: using high-order spline interpolation reduces discretization error but can create oscillatory artifacts and expensive root-finding; prefer piecewise low-order fits with adaptive sampling. To close: report earliest collision time with confidence interval, show complexity (O(M)O(M) segments × pairs after pruning), and say "if I had more time, I'd add Monte Carlo uncertainty quantification and a labeled holdout to estimate false positive rate under realistic sensor noise."

A second angle — How compare Waymo turning trajectories statistically

Here the task shifts from pairwise collision roots to population-level comparison of turning behavior. Apply the same fundamental reduction: represent each trajectory as a time-indexed function (x(t), y(t)) or as a path in Frenet frame (longitudinal vs lateral offset relative to lane center). Extract interpretable features: curvature κ(t)\kappa(t), yaw-rate, lateral displacement at matched arc-length, and time-normalized speed profiles. Use functional-data techniques (mixed-effects models or Gaussian Process regression) to model per-vehicle random effects and test treatment/cohort fixed effects (autonomous vs baseline). For non-time-aligned turns, use DTW or elastic registration to align phases before averaging; when you report significance, correct for vehicle-level clustering (cluster-robust SEs) and multiple segments. The common concept — converting raw trajectories to analyzable functions and choosing alignment + appropriate null distribution — carries across both tasks.

Common pitfalls

Pitfall: Assuming closed-form quadratics everywhere. Many real-world trajectories are non-linear or spline-interpolated; blindly applying the quadratic formula will miss collisions or produce imaginary roots.

Pitfall: Ignoring sampling resolution and noise when reporting collision time. Claiming sub-millisecond precision without uncertainty quantification or sensor-rate justification undermines credibility.

Pitfall: Using pointwise t-tests on time-series without accounting for temporal correlation or vehicle-level clustering; this inflates false positives. Use functional tests, mixed models, or permutation strategies.

Connections

These analyses commonly pivot to trajectory clustering and anomaly detection, time-to-collision (TTC) modeling and calibration, and probabilistic filtering like the Kalman filter for state estimation. Interviewers may also ask to validate models with holdout scenarios or to design experiments that measure behavioral change after a software update.

Further reading

  • [Brent, R.P., "Algorithms for Minimization Without Derivatives"] — reliable reference for robust 1-D root-finding (bracketing methods).

  • [Ramsay & Silverman, "Functional Data Analysis"] — practical methods for representing and testing differences between trajectories.

Practice questions

Related concepts