Klamp't  0.8.1
ContactCSpace.h
1 #ifndef ROBOT_CONTACT_CSPACE_H
2 #define ROBOT_CONTACT_CSPACE_H
3 
4 #include "RobotCSpace.h"
5 #include <Klampt/Modeling/GeneralizedRobot.h>
6 #include <Klampt/Contact/Stance.h>
7 #include <KrisLibrary/robotics/IK.h>
8 
18 {
19  public:
20  ContactCSpace(RobotWorld& world,int index,
21  WorldPlannerSettings* settings);
22  ContactCSpace(const SingleRobotCSpace& space);
23  ContactCSpace(const ContactCSpace& space);
24 
25  virtual void Sample(Config& q);
26  virtual void SampleNeighborhood(const Config& c,Real r,Config& q);
27  virtual void Interpolate(const Config& x,const Config& y,Real u,Config& out);
28  virtual EdgePlannerPtr PathChecker(const Config& a,const Config& b);
29  virtual void Properties(PropertyMap&);
30 
31  void AddContact(const IKGoal& goal);
32  void AddContact(int link,const Vector3& localPos,const Vector3& worldPos);
33  void AddContact(int link,const vector<Vector3>& localPos,const vector<Vector3>& worldPos);
34  void RemoveContact(int link);
35  bool SolveContact(int numIters=0,Real tol=0);
38  Real ContactDistance();
40  Real ContactDistance(const Config& q);
42  //current configuration. If dist is nonzero, this overrides the defaults
44  bool CheckContact(Real dist=0);
46  bool CheckContact(const Config& q,Real dist=0);
47 
48  vector<IKGoal> contactIK;
49  int numSolveContact;
50  double solveContactTime;
51 };
52 
53 /*
54 class MultiContactCSpace : public MultiRobotCSpace
55 {
56  public:
57  struct ContactPair
58  {
59  int id1,id2; //world id of the given object
60  vector<Vector3> c1,c2; //cx = contacts in local frame of object x
61  vector<Vector3> n1,n2; //nx = normals in local frame of object x
62  vector<Real> kFriction;
63  };
64 
65  MultiContactCSpace(RobotWorld& world,
66  WorldPlannerSettings* settings);
67  MultiContactCSpace(const MultiRobotCSpace&);
68  MultiContactCSpace(const MultiContactCSpace&);
69  virtual ~MultiContactCSpace() {}
71  void InitContactPairs(const vector<ContactPair>& pairs);
73  void InitContactPairs(const ContactFormation& formation);
74 
75  virtual int NumDimensions() const;
76  virtual void Sample(Config& x);
77  virtual void SampleNeighborhood(const Config& c,Real r,Config& x);
78  virtual bool IsFeasible(const Config&);
79  virtual void Interpolate(const Config& x,const Config& y,Real u,Config& out);
80  virtual void Midpoint(const Config& x,const Config& y,Config& out);
81  virtual void Properties(PropertyMap&);
82 
83  bool SolveContact(Config& x,int numIters=0,Real tol=0);
84  Real ContactDistance();
85  Real ContactDistance(const Config& x);
86  bool CheckContact(Real dist=0);
87  bool CheckContact(const Config& x,Real dist=0);
88 
89  vector<ContactPair> contactPairs;
90  Robot aggregateRobot;
91  vector<IKGoal> closedChainConstraints;
92  Stance aggregateStance;
93 
94  //stats
95  int numSolveContact,numIsFeasible;
96  double solveContactTime,isFeasibleTime;
97 };
98 */
99 
100 #endif
Real ContactDistance()
A structure containing settings that should be used for collision detection, contact solving...
Definition: PlannerSettings.h:41
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:20
A SingleRobotCSpace for a robot maintaining contact.
Definition: ContactCSpace.h:17
A cspace consisting of a single robot configuration in a RobotWorld. Feasibility constraints are join...
Definition: RobotCSpace.h:100
bool CheckContact(Real dist=0)
Checks whether the contact constraints are satisfied at the robot&#39;s.