Computing collisions#
CollisionComputation#
#include "navground/core/collision_computation.h"
- An struct that holds pre-computed values about a disc-shaped obstacle to speed up collision checking. For collision checking, the agent is considered point-like, i.e, the radius of the agent should be added to the disc-cache margin. - Public Functions - Construct a disc cache. - Parameters:
- delta – [in] The difference of positions ( - obstacle - agent) in absolute frame
- margin – [in] The margin (sum of the radii and safety margin) 
- velocity – [in] The disc velocity 
- visible_angle – [in] When colliding, directions outside the sector defined by - [-visible_angle, visible_angle]are considered safe.
 
 
 - Public Members - the difference of positions (obstacle - agent) in absolute frame 
 - The disc velocity in absolute frame 
 - The distance between disc and agent (computed) 
 
- This class compute collisions of moving points with lists of DiscCache and LineSegment. - Subclassed by navground::core::CachedCollisionComputation - Public Functions - Construct an instance. 
 - Return the free distance to collision for an interval of headings. - Parameters:
- from – [in] The interval lower bound 
- length – [in] The length of the interval 
- resolution – [in] The number of values in the interval 
- max_distance – [in] The maximum distance to consider (collision behind this distance are effectively ignored) 
- dynamic – [in] If the agent is moving 
- speed – [in] The speed at which the agent is moving 
 
- Returns:
- The free distance for each angle in the interval [from, from + length]. 
 
 - Return regularly sampled angles. - Parameters:
- from – [in] The interval lower bound 
- length – [in] The length of the interval 
- resolution – [in] 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 – [in] The interval lower bound 
- length – [in] The length of the interval 
- resolution – [in] The number of values in the interval 
- max_distance – [in] The maximum distance to consider (collision behind this distance are effectively ignored) 
- dynamic – [in] If the agent is moving 
- speed – [in] 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. 
 
 - Set the state from collections of LineSegment and DiscCache. - Parameters:
- pose_ – [in] The pose of the agent 
- margin_ – [in] The margin 
- line_segments – [in] The line segments 
- static_discs – [in] The static discs 
- dynamic_discs – [in] The dynamic discs 
 
 
 - Set the state from collections of LineSegment, Disc, and Neighbor. - Parameters:
- pose_ – [in] The pose 
- margin_ – [in] The margin 
- line_segments – [in] The line segments 
- static_discs – [in] The static discs 
- dynamic_discs – [in] The dynamic discs 
 
 
 - Returns the free distance if the agent will be static. - Parameters:
- angle – [in] The angle (absolute) 
- max_distance – [in] The maximal distance to consider 
- include_neighbors – [in] Indicates if the neighbors should be included in the computation 
 
- Returns:
- The distance in direction - anglebefore possibly colliding
 
 - Returns the free distance if the agent will be move. - Parameters:
- angle – [in] The angle (absolute) 
- max_distance – [in] The maximal distance to consider 
- speed – [in] The speed of the agent 
 
- Returns:
- The distance in direction - anglebefore possibly colliding
 
 - Tentatively checks whenever a moving disc-cache may collide with the agent within an horizon. - Parameters:
- obstacle – [in] The obstacle 
- max_distance – [in] The maximal distance to consider 
- speed – [in] The speed of the agent 
 
- Returns:
- False if it is impossible that the agent collides with the obstacle within - max_distance.
 
 - Tentatively checks whenever a static disc-cache may collide with the agent within an horizon. - Parameters:
- obstacle – [in] The obstacle 
- max_distance – [in] The maximal distance to consider 
 
- Returns:
- False if it is impossible that the agent collides with the obstacle within - max_distance.
 
 
CachedCollisionComputation#
#include "navground/core/cached_collision_computation.h"
- 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. - Public Functions - Construct an instance 
 - Sets the resolution: the number of discrete angles \(N\). - Parameters:
- value – [in] A positive value 
 
 - Gets the resolution: the number of discrete angles \(N\). - Returns:
- The size of the cache. 
 
 - Sets the cache interval lower bound \(\alpha\). - Parameters:
- value – [in] The lower bound 
 
 - Gets the cache interval lower bound \(\alpha\). - Returns:
- The lower bound. 
 
 - Sets the cache interval length \(\Delta\). - Parameters:
- value – [in] The interval length 
 
 - Gets the cache interval length \(\Delta\). - Returns:
- The interval length 
 
 - Sets the maximal distance \(D\) to consider. - Parameters:
- value – [in] The maximal distance 
 
 - Gets the maximal distance \(D\) to consider. - Returns:
- The maximal distance 
 
 - Sets the agent speed. - Parameters:
- value – [in] The speed 
 
 - Gets the agent speed. - Returns:
- The agent speed. 
 
 - Returns the free distance if the agent will be static. - Parameters:
- angle – [in] The angle (absolute) 
- include_neighbors – [in] Indicates if the neighbors should be included in the computation 
 
- Returns:
- The distance in direction - anglebefore possibly colliding
 
 - Returns the free distance if the agent will be move. - Parameters:
- angle – [in] The angle (absolute) 
- Returns:
- The distance in direction - anglebefore possibly colliding
 
 - Resets the cache. 
 - Gets a pointer where collision distances are cached. Negative entries mean distance not computed (-2) or no collision (-1). - Parameters:
- assuming_static – [in] The assuming static 
- include_neighbors – [in] Indicates if the neighbors should be included in the computation 
 
- Returns:
- The collision distance cache. 
 
 - Returns the free distance to collision for the cached interval of headings. - Parameters:
- dynamic – [in] If the agent is moving 
- Returns:
- The distance before possibly colliding for each direction in the interval \([\alpha, \alpha + \Delta]\).