00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <moveit/collision_detection/collision_world.h>
00038 #include <geometric_shapes/shape_operations.h>
00039
00040 collision_detection::CollisionWorld::CollisionWorld() : world_(new World()), world_const_(world_)
00041 {
00042 }
00043
00044 collision_detection::CollisionWorld::CollisionWorld(const WorldPtr& world) : world_(world), world_const_(world)
00045 {
00046 }
00047
00048 collision_detection::CollisionWorld::CollisionWorld(const CollisionWorld& other, const WorldPtr& world)
00049 : world_(world), world_const_(world)
00050 {
00051 }
00052
00053 void collision_detection::CollisionWorld::checkCollision(const CollisionRequest& req, CollisionResult& res,
00054 const CollisionRobot& robot,
00055 const robot_state::RobotState& state) const
00056 {
00057 robot.checkSelfCollision(req, res, state);
00058 if (!res.collision || (req.contacts && res.contacts.size() < req.max_contacts))
00059 checkRobotCollision(req, res, robot, state);
00060 }
00061
00062 void collision_detection::CollisionWorld::checkCollision(const CollisionRequest& req, CollisionResult& res,
00063 const CollisionRobot& robot,
00064 const robot_state::RobotState& state,
00065 const AllowedCollisionMatrix& acm) const
00066 {
00067 robot.checkSelfCollision(req, res, state, acm);
00068 if (!res.collision || (req.contacts && res.contacts.size() < req.max_contacts))
00069 checkRobotCollision(req, res, robot, state, acm);
00070 }
00071
00072 void collision_detection::CollisionWorld::checkCollision(const CollisionRequest& req, CollisionResult& res,
00073 const CollisionRobot& robot,
00074 const robot_state::RobotState& state1,
00075 const robot_state::RobotState& state2) const
00076 {
00077 robot.checkSelfCollision(req, res, state1, state2);
00078 if (!res.collision || (req.contacts && res.contacts.size() < req.max_contacts))
00079 checkRobotCollision(req, res, robot, state1, state2);
00080 }
00081
00082 void collision_detection::CollisionWorld::checkCollision(const CollisionRequest& req, CollisionResult& res,
00083 const CollisionRobot& robot,
00084 const robot_state::RobotState& state1,
00085 const robot_state::RobotState& state2,
00086 const AllowedCollisionMatrix& acm) const
00087 {
00088 robot.checkSelfCollision(req, res, state1, state2, acm);
00089 if (!res.collision || (req.contacts && res.contacts.size() < req.max_contacts))
00090 checkRobotCollision(req, res, robot, state1, state2, acm);
00091 }
00092
00093 void collision_detection::CollisionWorld::setWorld(const WorldPtr& world)
00094 {
00095 world_ = world;
00096 if (!world_)
00097 world_.reset(new World());
00098
00099 world_const_ = world;
00100 }