5 #include <KrisLibrary/math/matrix.h> 6 #include <KrisLibrary/math/sparsematrix.h> 8 #include <KrisLibrary/errors.h> 17 inline Real frictionConeHalfAngle()
const {
return Atan(kFriction); }
18 inline void setfrictionConeHalfAngle(Real phi) { kFriction=Tan(phi); }
20 bool isValidForce(
const Vector3& f)
const;
24 Real minFriction(
const Vector3& f)
const;
39 inline Real frictionConeHalfAngle()
const {
return Atan(kFriction); }
40 inline void setfrictionConeHalfAngle(Real phi) { kFriction=Tan(phi); }
42 bool isValidForce(
const Vector2& f)
const;
46 Real minFriction(
const Vector2& f)
const;
64 void set(
int link,
const std::vector<ContactPoint>& contacts,
int target=-1);
68 void flatten(std::vector<int>& flatLinks,std::vector<ContactPoint>& cps)
const;
69 void flatten(std::vector<int>& flatLinks,std::vector<ContactPoint>& cps,std::vector<int>& flattargets)
const;
71 int numContactPoints()
const;
73 int numForceVariables()
const;
75 std::vector<int> links;
76 std::vector<std::vector<ContactPoint> > contacts;
77 std::vector<int> targets;
89 void set(
int k,
const Vector3& n,Real kFriction);
90 bool contains(
const Vector3& f)
const;
91 bool onBoundary(
const Vector3& f)
const;
93 std::vector<Vector3> edges;
94 std::vector<Vector3> planes;
104 void FrictionToFrictionlessContacts(
const std::vector<ContactPoint>& c1,
int k,std::vector<ContactPoint>& c2);
112 void FrictionToFrictionlessContacts(
const std::vector<ContactPoint2D>& c1,std::vector<ContactPoint2D>& c2);
139 void GetWrenchMatrix(
const std::vector<ContactPoint>& s,
const Vector3& cm,
Matrix& A);
140 void GetWrenchMatrix(
const std::vector<ContactPoint>& s,
const Vector3& cm,
SparseMatrix& A);
152 void GetFrictionConePlanes(
const std::vector<ContactPoint>& contacts,
int k,
Matrix& A);
153 void GetFrictionConePlanes(
const std::vector<ContactPoint>& contacts,
int k,
SparseMatrix& A);
163 void GetFrictionConePlanes(
const std::vector<ContactPoint2D>& contacts,
Matrix& A);
164 void GetFrictionConePlanes(
const std::vector<ContactPoint2D>& contacts,
SparseMatrix& A);
183 void setRobustnessFactor(Real offset);
185 void addNormalForceBounds(Real minimum,Real maximum);
187 void calculateForceMatrix(
int numFCEdges=4);
190 void calculateWrenchMatrix(
int numFCEdges=4);
193 int numForceVariables()
const;
195 int numConstraints()
const;
218 void setRobustnessFactor(Real offset);
220 void addNormalForceBounds(Real minimum,Real maximum);
222 void calculateForceMatrix();
225 void calculateWrenchMatrix();
228 int numForceVariables()
const;
230 int numConstraints()
const;
254 void set(
int link,
const std::vector<ContactPoint>& contacts,
int numFCEdges);
256 void set(
int link,
const std::vector<CustomContactPoint>& contacts);
263 void addLinkForceLimit(
int link,
const Vector3& direction,Real maximum);
266 void addLinkWrenchLimit(
int link,
const Vector3& fdirection,
const Vector3& mdirection,Real maximum);
268 void addForceLimit(
const std::vector<int>& contacts,
const Vector3& direction,Real maximum);
271 void addWrenchLimit(
const std::vector<int>& contacts,
const Vector3& fdirection,
const Vector3& mdirection,Real maximum);
274 void addLinkForceConstraint(
int link,
const Matrix& A,
const Vector& b,
bool equality=
false);
277 void addLinkWrenchConstraint(
int link,
const Matrix& A,
const Vector& b,
bool equality=
false);
281 void addForceConstraint(
const std::vector<int>& contacts,
const Matrix& A,
const Vector& b,
bool equality=
false);
284 void addForceConstraint(
const std::vector<int>& contacts,
const std::vector<Matrix>& A,
const Vector& b,
bool equality=
false);
288 void addWrenchConstraint(
const std::vector<int>& contacts,
const Matrix& A,
const Vector& b,
bool equality=
false);
291 void addWrenchConstraint(
const std::vector<int>& contacts,
const std::vector<Matrix>& A,
const Vector& b,
bool equality=
false);
293 int numForceVariables()
const;
295 int numConstraints()
const;
297 std::vector<int> links;
298 std::vector<CustomContactPoint> contacts;
299 std::vector<int> targets;
300 std::vector<std::vector<int> > constraintGroups;
301 std::vector<std::vector<Matrix> > constraintMatrices;
302 std::vector<Vector> constraintOffsets;
303 std::vector<bool> constraintEqualities;
310 void GetForceMatrix(
const std::vector<CustomContactPoint>& contacts,
SparseMatrix& A);
320 void GetWrenchMatrix(
const std::vector<CustomContactPoint>& contacts,
const Vector3& cm,Matrix& A);
321 void GetWrenchMatrix(
const std::vector<CustomContactPoint>& contacts,
const Vector3& cm,
SparseMatrix& A);
334 void GetFrictionConePlanes(
const std::vector<CustomContactPoint>& contacts,Matrix& A,Vector& b);
335 void GetFrictionConePlanes(
const std::vector<CustomContactPoint>& contacts,
SparseMatrix& A,Vector& b);
345 void GetFrictionConePlanes(
const std::vector<CustomContactPoint2D>& contacts,Matrix& A,Vector& b);
346 void GetFrictionConePlanes(
const std::vector<CustomContactPoint2D>& contacts,
SparseMatrix& A,Vector& b);
Polygonal pyramid representation of the friction cone.
Definition: Contact.h:87
A 2x2 matrix class.
Definition: math3d/primitives.h:333
A 3D vector class.
Definition: math3d/primitives.h:136
Class declarations for useful 3D math types.
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13
A 3x3 matrix class.
Definition: math3d/primitives.h:469
A 2D vector class.
Definition: math3d/primitives.h:41
void concat(std::vector< T > &a, const std::vector< T > &b)
Concatenates b onto the end of a.
Definition: arrayutils.h:213