Computing collisions#

CollisionComputation#

This class compute collisions of moving points with lists of DiscCache and LineSegment.

Construct an instance.

Returns the free distance if the agent will be move

Parameters:
  • angle – The angle (absolute)

  • max_distance – The maximal distance to consider

  • speed – The speed of the agent

Returns:

The distance in direction angle before possibly colliding

Return regularly sampled angles.

Parameters:
  • from – The interval lower bound

  • length – The length of the interval

  • resolution – The number of values in the interval

Returns:

Angles regularly sampled in the interval [from, from + length].

Return the polar contour for an interval of headings.

Parameters:
  • from – The interval lower bound

  • length – The length of the interval

  • resolution – The number of values in the interval

  • max_distance – The maximum distance to consider (collision behind this distance are effectively ignored)

  • dynamic – If the agent is moving

  • speed – The speed at which the agent is moving

Returns:

An arrays of angles sampled regularly in the interval [from, from + length] and one array with the free distance in their direction.

Return the free distance to collision for an interval of headings.

Parameters:
  • from – The interval lower bound

  • length – The length of the interval

  • resolution – The number of values in the interval

  • max_distance – The maximum distance to consider (collision behind this distance are effectively ignored)

  • dynamic – If the agent is moving

  • speed – The speed at which the agent is moving

Returns:

The free distance for each angle in the interval [from, from + length].

Set the state from collections of LineSegment, Disc, and Neighbor.

Parameters:
  • pose – The pose

  • margin – The margin

  • line_segments – The line segments

  • static_discs – The static discs

  • dynamic_discs – The dynamic discs

Returns the free distance if the agent will be static

Parameters:
  • angle – The angle (absolute)

  • max_distance – The maximal distance to consider

  • include_neighbors – Indicates if the neighbors should be included in the computation

Returns:

The distance in direction angle before possibly colliding

CachedCollisionComputation#

Bases: CollisionComputation

This class extend CollisionComputation to cache the results.

It assumes that the agents is only interested in possible collisions when moving in directions comprised in an interval \([\alpha, \alpha + \Delta]\), represented by in \(N\) points at regular steps, only up to a maximal distance \(D\), and that the agent moves at at given speed.

Construct an instance

Returns the free distance to collision for the cached interval of headings.

Parameters:

dynamic – If the agent is moving

Returns:

The distance before possibly colliding for each direction in the interval \([\alpha, \alpha + \Delta]\).

Type:

float

The cache interval length \(\delta\).

Type:

float

The maximal distance \(d\) to consider

Type:

float

The cache interval lower bound \(\alpha\).

Type:

int

The resolution: the number of discrete angles \(n\).

Type:

float

The agent speed.