2 #include "typedefs.hpp"
6 #include <openrave/openrave.h>
7 #include "configuration_space.hpp"
12 enum CastCollisionType {
20 const OR::KinBody::Link* linkA;
21 const OR::KinBody::Link* linkB;
22 OR::Vector ptA, ptB, normalB2A;
26 CastCollisionType cctype;
27 Collision(
const KinBody::Link* linkA,
const KinBody::Link* linkB,
const OR::Vector& ptA,
const OR::Vector& ptB,
const OR::Vector& normalB2A,
double distance,
float weight=1,
float time=0) :
28 linkA(linkA), linkB(linkB), ptA(ptA), ptB(ptB), normalB2A(normalB2A), distance(distance), weight(weight), time(0), cctype(CCType_None) {}
30 TRAJOPT_API std::ostream& operator<<(std::ostream&,
const Collision&);
32 enum CollisionFilterGroups {
44 virtual void AllVsAll(vector<Collision>& collisions)=0;
46 virtual void LinkVsAll(
const KinBody::Link& link, vector<Collision>& collisions,
short filterMask)=0;
47 virtual void LinksVsAll(
const vector<KinBody::LinkPtr>& links, vector<Collision>& collisions,
short filterMask)=0;
50 void BodyVsAll(
const KinBody& body, vector<Collision>& collisions,
short filterMask=-1) {
51 LinksVsAll(body.GetLinks(), collisions, filterMask);
54 virtual void SetContactDistance(
float distance) = 0;
55 virtual double GetContactDistance() = 0;
57 virtual void PlotCollisionGeometry(vector<OpenRAVE::GraphHandlePtr>&) {
throw std::runtime_error(
"not implemented");}
59 virtual void ContinuousCheckTrajectory(
const TrajArray& traj, Configuration& rad, vector<Collision>& collisions) {
throw std::runtime_error(
"not implemented");}
62 virtual void CastVsAll(
Configuration& rad,
const vector<KinBody::LinkPtr>& links,
const DblVec& startjoints,
const DblVec& endjoints, vector<Collision>& collisions) {
throw std::runtime_error(
"not implemented");}
65 void IgnoreZeroStateSelfCollisions();
66 void IgnoreZeroStateSelfCollisions(OpenRAVE::KinBodyPtr body);
69 virtual void ExcludeCollisionPair(
const KinBody::Link& link0,
const KinBody::Link& link1) = 0;
72 OpenRAVE::EnvironmentBaseConstPtr GetEnv() {
return m_env;}
74 virtual ~CollisionChecker() {}
76 static boost::shared_ptr<CollisionChecker> GetOrCreate(OR::EnvironmentBase& env);
78 CollisionChecker(OpenRAVE::EnvironmentBaseConstPtr env) : m_env(env) {}
79 OpenRAVE::EnvironmentBaseConstPtr m_env;
81 typedef boost::shared_ptr<CollisionChecker> CollisionCheckerPtr;
83 CollisionCheckerPtr TRAJOPT_API CreateCollisionChecker(OR::EnvironmentBaseConstPtr env);
85 TRAJOPT_API
void PlotCollisions(
const std::vector<Collision>& collisions, OR::EnvironmentBase& env, vector<OR::GraphHandlePtr>& handles,
double safe_dist);