2 #include "trajopt/common.hpp"
3 #include "trajopt/collision_checker.hpp"
4 #include "sco/modeling.hpp"
5 #include "sco/sco_fwd.hpp"
11 typedef std::map<const OR::KinBody::Link*, int> Link2Int;
15 virtual void CalcDistExpressions(
const DblVec& x, vector<AffExpr>& exprs) = 0;
16 virtual void CalcDists(
const DblVec& x, DblVec& exprs) = 0;
17 virtual void CalcCollisions(
const DblVec& x, vector<Collision>& collisions) = 0;
18 void GetCollisionsCached(
const DblVec& x, vector<Collision>&);
20 virtual VarVector GetVars()=0;
22 Cache<size_t, vector<Collision>, 3> m_cache;
24 typedef boost::shared_ptr<CollisionEvaluator> CollisionEvaluatorPtr;
39 void CalcDists(
const DblVec& x, DblVec& exprs);
40 void CalcCollisions(
const DblVec& x, vector<Collision>& collisions);
41 VarVector GetVars() {
return m_vars;}
43 OR::EnvironmentBasePtr m_env;
44 CollisionCheckerPtr m_cc;
45 ConfigurationPtr m_rad;
48 vector<OR::KinBody::LinkPtr> m_links;
55 void CalcDistExpressions(
const DblVec& x, vector<AffExpr>& exprs);
56 void CalcDists(
const DblVec& x, DblVec& exprs);
57 void CalcCollisions(
const DblVec& x, vector<Collision>& collisions);
58 VarVector GetVars() {
return concat(m_vars0, m_vars1);}
62 OR::EnvironmentBasePtr m_env;
63 CollisionCheckerPtr m_cc;
64 ConfigurationPtr m_rad;
67 typedef std::map<const OR::KinBody::Link*, int> Link2Int;
69 vector<OR::KinBody::LinkPtr> m_links;
78 CollisionCost(
double dist_pen,
double coeff, ConfigurationPtr rad,
const VarVector& vars);
80 CollisionCost(
double dist_pen,
double coeff, ConfigurationPtr rad,
const VarVector& vars0,
const VarVector& vars1);
81 virtual ConvexObjectivePtr convex(
const vector<double>& x,
Model* model);
82 virtual double value(
const vector<double>&);
83 void Plot(
const DblVec& x, OR::EnvironmentBase& env, std::vector<OR::GraphHandlePtr>& handles);
85 CollisionEvaluatorPtr m_calc;
92 CollisionConstraint(
double dist_pen,
double coeff, ConfigurationPtr rad,
const VarVector& vars);
94 CollisionConstraint(
double dist_pen,
double coeff, ConfigurationPtr rad,
const VarVector& vars0,
const VarVector& vars1);
95 virtual ConvexConstraintsPtr convex(
const vector<double>& x,
Model* model);
96 virtual DblVec value(
const vector<double>&);
97 void Plot(
const DblVec& x, OR::EnvironmentBase& env, std::vector<OR::GraphHandlePtr>& handles);
99 CollisionEvaluatorPtr m_calc;