Klamp't  0.8.1
Stance.h
1 #ifndef STANCE_H
2 #define STANCE_H
3 
4 #include "Hold.h"
5 #include <KrisLibrary/math3d/Plane3D.h>
6 #include <KrisLibrary/math/matrix.h>
7 #include <map>
8 #include <vector>
9 using namespace std;
10 
11 struct Environment;
12 
19 struct Stance : public map<int,Hold>
20 {
21  typedef map<int,Hold>::iterator iterator;
22  typedef map<int,Hold>::const_iterator const_iterator;
23 
24  void insert(const Hold& h) { operator[](h.link)=h; }
25  bool contains(int link) const { return find(link)!=end(); }
26  bool remove(int link);
27 
29  bool isValid() const;
30 };
31 
32 //returns true if the stance is valid
33 bool CopyStance(const vector<int>& indices,const vector<Hold>& holds,Stance& s);
34 
41 const Hold& DifferingHold(const Stance& a,const Stance& b);
42 
46 bool IsSimilarStance(const Stance& a,const Stance& b);
47 
51 bool IsSubset(const Stance& a,const Stance& b);
52 
56 void GetDifference(const Stance& a,const Stance& b,vector<Hold>& d);
57 
58 istream& operator >> (istream& in,Stance& stance);
59 ostream& operator << (ostream& out,const Stance& stance);
60 
61 int NumContactPoints(const Stance& s);
62 void GetContactPoints(const Stance& s,vector<ContactPoint>& cps);
63 const ContactPoint& GetContactPoint(const Stance& s,int i);
64 ContactPoint& GetContactPoint(Stance& s,int i);
65 Vector3 GetCentroid(const Stance& s,Real L=Zero);
66 Real GetStdDev(const Stance& s);
67 Real GetStdDev(const Stance& s,const Vector3& c); //provide the centroid
68 void GetPlaneFit(const Stance& s,Plane3D& p);
69 void GetPlaneFit(const Stance& s,const Vector3& c,Plane3D& p); //provides the centroid
70 
73 void ToContactFormation(const Stance& stance,ContactFormation& contacts);
74 
77 void ToIKProblem(const Stance& stance,vector<IKGoal>& constraints);
78 
79 #endif
A single contact between the robot and the environment.
Definition: Hold.h:26
void ToIKProblem(const Stance &stance, vector< IKGoal > &constraints)
A collection of holds.
Definition: Stance.h:19
bool IsSubset(const Stance &a, const Stance &b)
Returns true if a is a subset of b.
void GetDifference(const Stance &a, const Stance &b, vector< Hold > &d)
Returns the difference d = a-b.
const Hold & DifferingHold(const Stance &a, const Stance &b)
If b = a union {h}, returns h.
bool IsSimilarStance(const Stance &a, const Stance &b)
Returns true if a and b share the same links.
Structures defining the finalized contacts used in stances.
void ToContactFormation(const Stance &stance, ContactFormation &contacts)