/Trajectory_Deviation

This repo includes codes for comparing two trajectories to see if they deviate from each other or not. This can be used for identifying deviation of observed trajectory of an autonomous vehicle from its planned trajectory.

Primary LanguagePython

Trajectory Analysis Tools

This repository contains a collection of Python scripts designed to analyze and visualize deviations in trajectories, particularly useful in fields such as autonomous driving, robotics, and any application where precision in path tracking is crucial.

Description

The scripts provided offer a variety of methods for comparing planned versus actual trajectories, highlighting deviations in both spatial and temporal dimensions. They range from basic Euclidean distance calculations to more sophisticated methods like Dynamic Time Warping (DTW) and Frenet frame analysis.

Scripts Overview

  1. Dynamic_Window_fastdw.py

    • Utilizes the Fast Dynamic Time Warping (FastDTW) algorithm to measure the similarity between planned and actual trajectories, optimizing for computational efficiency.
  2. Dynamic_Window_numpy.py

    • Implements the Dynamic Time Warping algorithm using NumPy without any external libraries, providing a deep dive into the DTW calculation process.
  3. Euclidean_Distance_wxv.py

    • Calculates deviations between planned and actual trajectories using straightforward Euclidean distance, extended to consider velocity vectors for a comprehensive trajectory analysis.
  4. Euclidean_Distance_xy.py

    • Focuses on spatial deviations between trajectories by calculating the Euclidean distance solely based on x and y coordinates.
  5. Euclidean_Distance_xyv_TimeWindow.py

    • Enhances the spatial analysis by incorporating a time window, allowing for the assessment of deviations over specified intervals, making it suitable for dynamic scenarios where conditions change over time.
  6. Frenet_Frame.py (1D and 2D versions)

    • Provides a detailed analysis using Frenet coordinates to quantify lateral and longitudinal displacements, and extends the analysis to include temporal deviations, offering insights into both spatial misalignments and timing inaccuracies.

Installation

Clone the repository to your local machine:

git clone https://github.com/yourusername/trajectory-analysis.git