Klamp't  0.9.0
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 
11 namespace Klampt {
12 
17 class Grasp
18 {
19  public:
20  Grasp();
21 
23  inline size_t NumConstraints() const { return constraints.size(); }
24 
26  inline bool IsSimple() const
27  {
28  return constraints.size()==1 && IKGoal::NumDims(constraints[0].posConstraint)+IKGoal::NumDims(constraints[0].rotConstraint) == 6;
29  }
30 
31  void Add(const Grasp& grasp);
32  void SetHold(const Hold& h);
33  void SetStance(const Stance& h);
34  void GetHold(Hold& h) const;
35  void GetStance(Stance& s) const;
36  void GetContactFormation(ContactFormation& s) const;
37  void Transform(const RigidTransform& T);
38  void SetFixed(Vector& q) const;
39 
40  bool Load(TiXmlElement* e);
41  bool Save(TiXmlElement* e);
42 
44  int objectIndex,robotIndex;
45 
47  vector<IKGoal> constraints;
48  vector<Real> fixedValues;
49  vector<int> fixedDofs;
50 
52  vector<ContactPoint> contacts;
53  vector<int> contactLinks;
54  vector<Vector3> forces;
55 };
56 
57 } //namespace Klampt
58 
59 #endif
A collection of holds.
Definition: Stance.h:20
size_t NumConstraints() const
Returns the number of constraints touching the object.
Definition: Grasp.h:23
vector< IKGoal > constraints
describes constraints on robot configuration relative to object
Definition: Grasp.h:47
bool IsSimple() const
A grasp is simple if it&#39;s a rigid attachment to a single robot link.
Definition: Grasp.h:26
vector< ContactPoint > contacts
optional: describes contact state
Definition: Grasp.h:52
int objectIndex
index of the robot and object – object may be -1
Definition: Grasp.h:44
A single contact between the robot and the environment.
Definition: Hold.h:28
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:17
Definition: ContactDistance.h:6