Klamp't  0.8.1
Grasp.h
1 #ifndef GRASP_H
2 #define GRASP_H
3 
4 #include <KrisLibrary/robotics/Contact.h>
5 #include <KrisLibrary/robotics/IK.h>
6 #include "Hold.h"
7 #include "Stance.h"
8 #include <vector>
9 class TiXmlElement;
10 
15 class Grasp
16 {
17  public:
18  Grasp();
19 
21  inline size_t NumConstraints() const { return constraints.size(); }
22 
24  inline bool IsSimple() const
25  {
26  return constraints.size()==1 && IKGoal::NumDims(constraints[0].posConstraint)+IKGoal::NumDims(constraints[0].rotConstraint) == 6;
27  }
28 
29  void Add(const Grasp& grasp);
30  void SetHold(const Hold& h);
31  void SetStance(const Stance& h);
32  void GetHold(Hold& h) const;
33  void GetStance(Stance& s) const;
34  void GetContactFormation(ContactFormation& s) const;
35  void Transform(const RigidTransform& T);
36  void SetFixed(Vector& q) const;
37 
38  bool Load(TiXmlElement* e);
39  bool Save(TiXmlElement* e);
40 
42  int objectIndex,robotIndex;
43 
45  vector<IKGoal> constraints;
46  vector<Real> fixedValues;
47  vector<int> fixedDofs;
48 
50  vector<ContactPoint> contacts;
51  vector<int> contactLinks;
52  vector<Vector3> forces;
53 };
54 
55 #endif
A single contact between the robot and the environment.
Definition: Hold.h:26
A collection of holds.
Definition: Stance.h:19
vector< ContactPoint > contacts
optional: describes contact state
Definition: Grasp.h:50
int objectIndex
index of the robot and object – object may be -1
Definition: Grasp.h:42
vector< IKGoal > constraints
describes constraints on robot configuration relative to object
Definition: Grasp.h:45
bool IsSimple() const
A grasp is simple if it&#39;s a rigid attachment to a single robot link.
Definition: Grasp.h:24
size_t NumConstraints() const
Returns the number of constraints touching the object.
Definition: Grasp.h:21
Structures defining the finalized contacts used in stances.
Slightly more sophisticated than a Stance, a Grasp allows some of the robot&#39;s degrees of freedom to b...
Definition: Grasp.h:15