|
Collision Checker
|
CollisionChecker can contain collision objects and their groups (such as ShapeGroup and TimeVariantCollisionObject) More...
#include <collision_checker.h>
Public Member Functions | |
| EIGEN_MAKE_ALIGNED_OPERATOR_NEW | CollisionChecker () |
| CollisionCheckerPtr | clone_shared (void) const |
| void | addCollisionObject (CollisionObjectConstPtr co) |
| Adds a collision object into the CollisionChecker group structure. More... | |
| bool | rayTrace (const Eigen::Vector2d &point1, const Eigen::Vector2d &point2, std::vector< LineSegment > &intersect, bool remove_overlaps=true) |
| adds a collision object to the CC More... | |
| int | collisionTime (CollisionObjectConstPtr co) const |
| Returns timestep at which any of the objects contained in the CollisionChecker collides with the given object. More... | |
| bool | collide (CollisionObjectConstPtr co, int *collision_time=0) const |
| Returns true if any of the objects contained in the CollisionChecker collide with the given object. More... | |
| bool | collide (CollisionObjectConstPtr co, CollisionObjectConstPtr &obstacle, bool ungroup_shape_groups=false, bool ungroup_TV_obstacles=false) const |
| Returns true if any of the objects contained in the CollisionChecker collide with the given object. More... | |
| bool | collide (CollisionObjectConstPtr co, std::vector< CollisionObjectConstPtr > &obstacles, bool ungroup_shape_groups=false, bool ungroup_TV_obstacles=false) const |
| Returns true if any of the objects contained in the CollisionChecker collide with the given object. More... | |
| CollisionCheckerPtr | windowQuery (const RectangleAABB &aabb) const |
| Returns new CollisionChecker with all static objects within the window and all time-variant obstacles. Ungroups all shape groups. More... | |
| PrimitiveCollisionCheckerPtr | windowQueryPrimitive (const RectangleAABB &aabb) const |
| Returns new PrimitiveCollisionChecker with all static objects within the window and all time-variant obstacles. Ungroups all shape groups. More... | |
| CollisionCheckerPtr | timeSlice (int time_idx) const |
| Returns new CollisionChecker with objects that exist at a given timestep. More... | |
| void | print (std::ostringstream &stream) const |
| void | toString (std::ostringstream &stream) const |
| int | numberOfObstacles (void) const |
| Returns number of contained CollisionObjects of any type. More... | |
| std::vector< CollisionObjectConstPtr > | getObstacles (void) const |
| Returns a Vector with all contained CollisionObjects of any type. More... | |
Public Member Functions inherited from collision::ICollisionChecker | |
| virtual | ~ICollisionChecker () |
CollisionChecker can contain collision objects and their groups (such as ShapeGroup and TimeVariantCollisionObject)
The benefit of grouping objects in the CollisionChecker is that a broadphase structure is built for efficient filtering of candidate objects for the collision
Definition at line 45 of file collision_checker.h.
|
inline |
Definition at line 52 of file collision_checker.h.
|
virtual |
Adds a collision object into the CollisionChecker group structure.
Implements collision::ICollisionChecker.
Definition at line 25 of file collision_checker.cc.
| CollisionCheckerPtr collision::CollisionChecker::clone_shared | ( | void | ) | const |
Definition at line 12 of file collision_checker.cc.
| bool collision::CollisionChecker::collide | ( | CollisionObjectConstPtr | co, |
| int * | collision_time = 0 |
||
| ) | const |
Returns true if any of the objects contained in the CollisionChecker collide with the given object.
| [in] | co | given object |
| [out] | optional | output pointer for getting the time of the collision |
Definition at line 68 of file collision_checker.cc.
| bool collision::CollisionChecker::collide | ( | CollisionObjectConstPtr | co, |
| CollisionObjectConstPtr & | obstacle, | ||
| bool | ungroup_shape_groups = false, |
||
| bool | ungroup_TV_obstacles = false |
||
| ) | const |
Returns true if any of the objects contained in the CollisionChecker collide with the given object.
| [in] | co | given object |
| [in] | ungroup_shape_groups | when false, ShapeGroups will be treated as separate objects and included in the result. Otherwise, one of the colliding obstacles within the ShapeGroups will be added to the output Vector. |
| [in] | ungroup_TV_obstacles | when false, TimeVarintCollisionObjects will be treated as separate objects and included in the result. Otherwise, one of the colliding obstacles within the TimeVarintCollisionObject will be added to the output Vector. |
| [out] | obstacle | output reference for the colliding object |
Definition at line 112 of file collision_checker.cc.
| bool collision::CollisionChecker::collide | ( | CollisionObjectConstPtr | co, |
| std::vector< CollisionObjectConstPtr > & | obstacles, | ||
| bool | ungroup_shape_groups = false, |
||
| bool | ungroup_TV_obstacles = false |
||
| ) | const |
Returns true if any of the objects contained in the CollisionChecker collide with the given object.
| [in] | co | given object |
| [in] | ungroup_shape_groups | when false, ShapeGroups will be treated as separate objects and included in the result. Otherwise, the colliding obstacles within the ShapeGroups will be added to the output Vector. |
| [in] | ungroup_TV_obstacles | when false, TimeVariantCollisionObjects will be treated as separate objects and included in the result. Otherwise, the colliding obstacles within the TimeVariantCollisionObject will be added to the output Vector. |
| [out] | obstacles | output Vector for colliding objects |
Definition at line 235 of file collision_checker.cc.
| int collision::CollisionChecker::collisionTime | ( | CollisionObjectConstPtr | co | ) | const |
Returns timestep at which any of the objects contained in the CollisionChecker collides with the given object.
The function returns -1 if there is no collision or timestep of the collision is not defined (such as for static obstacles)
Definition at line 42 of file collision_checker.cc.
|
virtual |
Returns a Vector with all contained CollisionObjects of any type.
Implements collision::ICollisionChecker.
Definition at line 328 of file collision_checker.cc.
|
virtual |
Returns number of contained CollisionObjects of any type.
Implements collision::ICollisionChecker.
Definition at line 319 of file collision_checker.cc.
| void collision::CollisionChecker::print | ( | std::ostringstream & | stream | ) | const |
Definition at line 332 of file collision_checker.cc.
| bool collision::CollisionChecker::rayTrace | ( | const Eigen::Vector2d & | point1, |
| const Eigen::Vector2d & | point2, | ||
| std::vector< LineSegment > & | intersect, | ||
| bool | remove_overlaps = true |
||
| ) |
adds a collision object to the CC
Performs raytracing for a given line segment. The function returns true if the line segment between the given two points collides with any object inside the CollisionChecker. In addition, the function returns Vector with the parts of the given line segment that belong to the occupied space.
The function finds all intersection points between the given line segment and all line segments or circles that the colliding objects are made of.
If the given line segment start or end point lies within an object, the line segment between this point inside the object and the point of collision is added.
If remove_overlaps is set to true, the function joins together all overlapping intervals for the final result.
| [in] | point1 | line segment begin point |
| [in] | point2 | line segment end point |
| [in] | remove_overlaps | if true, the the function joins together all overlapping intervals for the final result. |
Definition at line 159 of file collision_checker.cc.
| CollisionCheckerPtr collision::CollisionChecker::timeSlice | ( | int | time_idx | ) | const |
Returns new CollisionChecker with objects that exist at a given timestep.
| [in] | time_idx | - index of timestep of interest |
Definition at line 302 of file collision_checker.cc.
| void collision::CollisionChecker::toString | ( | std::ostringstream & | stream | ) | const |
Definition at line 193 of file collision_checker.cc.
| CollisionCheckerPtr collision::CollisionChecker::windowQuery | ( | const RectangleAABB & | aabb | ) | const |
Returns new CollisionChecker with all static objects within the window and all time-variant obstacles. Ungroups all shape groups.
| [in] | aabb | - reference to an axis-aligned rectangle representing the region of interest |
Definition at line 285 of file collision_checker.cc.
| PrimitiveCollisionCheckerPtr collision::CollisionChecker::windowQueryPrimitive | ( | const RectangleAABB & | aabb | ) | const |
Returns new PrimitiveCollisionChecker with all static objects within the window and all time-variant obstacles. Ungroups all shape groups.
| [in] | aabb | - reference to a axis-aligned rectangle representing the region of interest |
Definition at line 264 of file collision_checker.cc.