Search code examples
pythonmathcomputer-visioncollisionkalman-filter

Using kalman filter for detecting collision


According to that post kalman 2d filter in python it can predict trajectories using position and velocities. My question is how to use that predicted trajectory for predicting a collision that might happen in 5 mins for example. Assuming 2D Cartesian coordinates system.


Solution

  • As a rule a stack overflow question is a coding question - we're not really at that level here. There may be other communities which are a better match for the question.

    That being said, a Kalman filter is not the best way to detect a potential collision. There are two different problems:

    1. Estimate the position and velocity of the vehicles. Generally a Kalman filter is used for this.

    2. Predict if the trajectories will result in a collision. The solution to this is not generally a Kalman filter. It's a geometry problem.

      We have from the Kalman filters the position and velocity estimates for both vehicles at a common time. We construct line-segments for the time of interest for both vehicles. The segments start at the current position estimates, and the direction is taken from the velocity vector. The length of the line-segment is the product of how much time you're considering for collision detection and the magnitude of the individual velocity vector estimates.

      Then the question of a collision becomes - do these two line-segments intersect? The Kalman filter is not used to detect if line-segments intersect.