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