00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00052
00053 #ifndef IDLagrange_hpp
00054 #define IDLagrange_hpp
00055
00056 #include "InverseDynamics.h"
00057 #include "Math/Tensor.h"
00058 #include "Math/Rot3by3.h"
00059 #include "Math/Matrix.h"
00060 #include "Math/Xform.h"
00061
00063 namespace OSCAR {
00064
00072 class IDLagrange : public InverseDynamics
00073 {
00074
00075 public:
00128 IDLagrange(unsigned int DOF, const String& linkCGandMassFile,
00129 const String& linkInertiaFile,
00130 const Vector3D& gravity = Vector3D(0.0, 0.0, -9.8));
00131
00148 IDLagrange(unsigned int DOF, const MatrixData& linkCGandMass,
00149 const TensorData& linkInertia,
00150 const Vector3D& gravity = Vector3D(0.0, 0.0, -9.8));
00151
00152 virtual ~IDLagrange();
00153
00163 bool SetGfunctions(const Tensor* tg, const Tensor* rg = 0);
00164
00174 bool SetHfunctions(const TensorP* th, const TensorP* rh);
00175
00182 bool GetGravityTorques(Vector& gravityTorques);
00183
00192 bool GetVelocityTorques(const Vector& velocity,
00193 Vector& torques);
00194
00203 bool GetAccelerationTorques(const Vector& acceleration,
00204 Vector& torques);
00205
00214 const Vector& GetJointTorques(const Vector& velocity,
00215 const Vector& acceleration,
00216 const HandPose& eefLoad = HandPose(0,0,0,0,0,0));
00217
00222 const Matrix* GetInertiaMatrix();
00223
00224
00225 const Rot3by3* GetGlobalInertiaMatrices(const Xform* global_ts);
00226
00236 const Matrix* GetIstar(const Xform* global_ts);
00237 const Tensor* GetIstarForEachLink(const Xform* global_ts);
00238 const Tensor* GetPstar();
00239 const Tensor* GetPstar(const Xform* global_ts);
00240 bool GetAppliedLoadTorques(unsigned int linkNumber, const Tensor& gr,
00241 const Tensor& gt,
00242 const Vector& link_load,
00243 Vector& jnt_torques);
00244 protected:
00245
00246 Rot3by3 *rotations;
00247
00248
00249
00250 Rot3by3 *rotations_trans;
00251
00252
00253
00254 Tensor *global_inertia;
00255
00256
00257
00258 Matrix *Istar;
00259
00260
00261 Tensor *linkIstars;
00262
00263
00264
00265
00266 Tensor *Pstar;
00267
00268
00269 const Tensor *trans_g;
00270 const Tensor *rot_g;
00271 const TensorP *trans_h;
00272 const TensorP *rot_h;
00273 bool IstarUpdated, PstarUpdated, gravityUpdated;
00274
00275 void fillRotationMatrices(const Xform* global_ts);
00276 bool calculateGlobalInertiaMatrices(const Xform* global_ts);
00277 bool calculateIstar();
00278 bool calculateIstarForEachLink();
00279 bool calculatePstar();
00280
00281 private:
00282 IDLagrange(const IDLagrange&);
00283 IDLagrange& operator=(const IDLagrange&);
00284 };
00285
00286 #include "Dynamics/IDLagrange.ipp"
00287
00288 }
00289
00290 #endif // ifndef IDLagrange_hpp