KrisLibrary  1.0.0
NewtonEuler.h
1 #ifndef NEWTON_EULER_H
2 #define NEWTON_EULER_H
3 
4 #include "RobotDynamics3D.h"
5 #include "Wrench.h"
6 
7 
28 {
30  //sets the external wrenches equal to gravity
31  void SetGravityWrenches(const Vector3& gravity);
32  //forward and inverse dynamics, assuming the current state of the robot is updated
33  void CalcTorques(const Vector& ddq,Vector& t);
34  void CalcAccel(const Vector& t,Vector& ddq);
35  void CalcKineticEnergyMatrix(Matrix& B);
36  void CalcKineticEnergyMatrixInverse(Matrix& Binv);
37  void CalcResidualTorques(Vector& CG);
38  void CalcResidualAccel(Vector& ddq0);
39 
40  //helpers (also assume current state of robot has been updated)
41  void MulKineticEnergyMatrix(const Vector& x,Vector& Bx);
42  void MulKineticEnergyMatrix(const Matrix& A,Matrix& BA);
43  void MulKineticEnergyMatrixInverse(const Vector& x,Vector& Binvx);
44  void MulKineticEnergyMatrixInverse(const Matrix& A,Matrix& BinvA);
45  void CalcVelocities();
46  void CalcLinkAccel(const Vector& ddq);
47  void SelfTest();
48 
49  RobotDynamics3D& robot;
50  std::vector<Wrench> externalWrenches;
51 
52  //temporary/output
53  std::vector<std::vector<int> > children;
54  std::vector<RigidBodyVelocity> velocities;
55  std::vector<RigidBodyVelocity> accelerations;
56  std::vector<Wrench> jointWrenches;
57  std::vector<SpatialMatrix> inertiaMatrices;
58  std::vector<SpatialVector> biasingForces;
59 };
60 
61 #endif
62 
A 3D vector class.
Definition: math3d/primitives.h:136
std::vector< SpatialVector > biasingForces
element i is the i&#39;th biasing force computed in the featherstone algorithm
Definition: NewtonEuler.h:58
std::vector< Wrench > jointWrenches
element i is the force on link i from the joint to its parent
Definition: NewtonEuler.h:56
std::vector< Wrench > externalWrenches
set these to the external wrenches on the links (moments about the CM)
Definition: NewtonEuler.h:50
int CG(const Matrix &A, Vector &x, const Vector &b, const Preconditioner &M, int &max_iter, Real &tol)
Definition: conjgrad.h:90
The Featherstone algorithm for O(n) computation of either joint torques from accelerations, or accelerations from torques.
Definition: NewtonEuler.h:27
Class defining kinematic and dynamic state of a robot, with commonly used functions. Inherits from RobotKinematics3D.
Definition: RobotDynamics3D.h:32
std::vector< SpatialMatrix > inertiaMatrices
element i is the i&#39;th inertia matrix computed in the featherstone algorithm
Definition: NewtonEuler.h:57