iCub-main
iDynInv.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010-2011 RobotCub Consortium
3  * Author: Serena Ivaldi, Matteo Fumagalli
4  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
5  *
6  */
7 
43 #ifndef __IDYNINV_H__
44 #define __IDYNINV_H__
45 
46 #include <yarp/sig/Vector.h>
47 #include <yarp/sig/Matrix.h>
48 #include <iCub/ctrl/math.h>
49 #include <iCub/iKin/iKinFwd.h>
50 #include <iCub/iDyn/iDyn.h>
51 #include <iCub/skinDynLib/common.h>
52 #include <deque>
53 #include <string>
54 
55 
56 namespace iCub
57 {
58 
59 namespace iDyn
60 {
61 
62 // Newton-Euler types
63 // useful for iDyn, iDynInv, iDynBody
65 const std::string NewEulMode_s[4] = {"static","dynamic","dynamic with motor/rotor","dynamic with only Coriolis and gravitational terms"};
66 
67 // Kinematic and Wrench modes
70 const std::string ChainIterationMode_s[2] = {"Forward (Base To End)","Backward (End To Base)"};
71 const std::string ChainComputationMode_s[4] = {"Kinematic Forward - Wrench Forward","Kinematic Forward - Wrench Backward","Kinematic Backward - Wrench Forward","Kinematic Backward - Wrench Backward"};
72 
73  class iDynLink;
74  class iDynChain;
75  class iDynLimb;
76  class iCubArmDyn;
77  class iCubArmNoTorsoDyn;
78  class iCubLegDyn;
79  class iCubEyeDyn;
80  class iCubEyeNeckRefDyn;
81  class iCubInertialSensorDyn;
82  class iDynSensor;
83  class iDynSensorLeg;
84  class iDynSensorArm;
85  class iGenericFrame;
86  class iFrameOnLink;
87  class iFTransformation;
88 
89 
96 {
97 protected:
98 
102  std::string info;
104  unsigned int verbose;
106  yarp::sig::Vector z0;
108  yarp::sig::Vector zm;
111 
112  //~~~~~~~~~~~~~~~~~~~~~~
113  // set methods
114  //~~~~~~~~~~~~~~~~~~~~~~
115 
122  virtual bool setForce(const yarp::sig::Vector &_F);
123 
130  virtual bool setMoment(const yarp::sig::Vector &_Mu);
131 
137  virtual void setTorque(const double _Tau);
138 
144  virtual bool setAngVel(const yarp::sig::Vector &_w);
145 
151  virtual bool setAngAcc(const yarp::sig::Vector &_dw);
157  virtual bool setLinAcc(const yarp::sig::Vector &_ddp);
164  virtual bool setLinAccC(const yarp::sig::Vector &_ddpC);
171  virtual bool setAngAccM(const yarp::sig::Vector &_dwM);
172 
173  //~~~~~~~~~~~~~~~~~~~~~~
174  // core computation
175  //~~~~~~~~~~~~~~~~~~~~~~
176 
181  void computeAngVel( OneLinkNewtonEuler *prev);
182 
189 
194  void computeAngAcc( OneLinkNewtonEuler *prev);
195 
201 
206  void computeLinAcc( OneLinkNewtonEuler *prev);
207 
213 
218  void computeLinAccC();
219 
225  void computeAngAccM( OneLinkNewtonEuler *prev);
226 
232 
238 
244 
250 
251 
252 public:
253 
257  OneLinkNewtonEuler(iDyn::iDynLink *dlink=NULL);
258 
262  OneLinkNewtonEuler(const NewEulMode _mode, unsigned int verb = iCub::skinDynLib::NO_VERBOSE, iDyn::iDynLink *dlink=NULL);
263 
267  virtual ~OneLinkNewtonEuler() {};
268 
272  void zero();
273 
278  virtual bool setAsBase(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp);
279  virtual bool setAsBase(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
280 
287  virtual bool setAsFinal(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
288 
296  virtual bool setAsFinal(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp);
297 
304  virtual bool setMeasuredFMu(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
305 
310  virtual bool setMeasuredTorque(const double _Tau);
311 
315  virtual std::string toString() const;
316 
317 
318  //~~~~~~~~~~~~~~~~~~~~~~
319  // set methods
320  //~~~~~~~~~~~~~~~~~~~~~~
321 
326  void setVerbose(unsigned int verb = iCub::skinDynLib::VERBOSE);
331  void setMode(const NewEulMode _mode);
337  bool setZM(const yarp::sig::Vector &_zm);
342  void setInfo(const std::string &_info);
343 
344 
345  //~~~~~~~~~~~~~~~~~~~~~~
346  // get methods
347  //~~~~~~~~~~~~~~~~~~~~~~
348 
352  NewEulMode getMode() const;
356  yarp::sig::Vector getZM() const;
360  std::string getInfo() const;
364  virtual const yarp::sig::Vector& getAngVel() const;
368  virtual const yarp::sig::Vector& getAngAcc() const;
372  virtual const yarp::sig::Vector& getAngAccM() const;
376  virtual const yarp::sig::Vector& getLinAcc() const;
380  virtual const yarp::sig::Vector& getLinAccC() const;
384  virtual const yarp::sig::Vector& getForce() const;
388  virtual const yarp::sig::Vector& getMoment(bool isBase = false) const;
392  virtual double getTorque() const;
396  virtual double getIm() const;
400  virtual double getFs() const;
404  virtual double getFv() const;
408  virtual double getD2q() const;
412  virtual double getDq() const;
416  virtual double getKr() const;
420  virtual double getMass() const;
424  virtual const yarp::sig::Matrix& getInertia() const;
428  virtual const yarp::sig::Matrix& getH();
432  virtual const yarp::sig::Matrix& getR();
436  virtual const yarp::sig::Matrix& getRC();
440  virtual const yarp::sig::Vector& getr(bool proj=false);
444  virtual const yarp::sig::Vector& getrC(bool proj=false);
445 
446 
447  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
448  // main computation methods
449  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
450 
456 
462 
467  void BackwardWrench( OneLinkNewtonEuler *next);
468 
473  void ForwardWrench( OneLinkNewtonEuler *prev);
474 
479  virtual void computeTorque(OneLinkNewtonEuler *prev);
480 
481 };
482 
492 {
493 protected:
495  yarp::sig::Vector w;
497  yarp::sig::Vector dw;
499  yarp::sig::Vector ddp;
501  yarp::sig::Matrix H0;
503  yarp::sig::Vector F;
505  yarp::sig::Vector Mu;
507  yarp::sig::Vector Mu0;
509  double Tau;
510 
511  // dummy matrixes/vectors
512  const yarp::sig::Matrix eye3x3;
513  const yarp::sig::Matrix zeros3x3;
514  const yarp::sig::Vector zeros3;
515 
516 public:
517 
524  BaseLinkNewtonEuler(const yarp::sig::Matrix &_H0, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
525 
535  BaseLinkNewtonEuler(const yarp::sig::Matrix &_H0, const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw,
536  const yarp::sig::Vector &_ddp, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
537 
544  bool setAsBase(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp);
550  bool setAsBase(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
551 
552  //~~~~~~~~~~~~~~~~~~~~~~
553  // get methods
554  //~~~~~~~~~~~~~~~~~~~~~~
555 
556  const yarp::sig::Vector& getAngVel() const;
557  const yarp::sig::Vector& getAngAcc() const;
558  const yarp::sig::Vector& getAngAccM() const;
559  const yarp::sig::Vector& getLinAcc() const;
560  const yarp::sig::Vector& getLinAccC() const;
561 
562  // redefine the other unuseful methods
563  // to avoid errors due to missing link
564 
565  const yarp::sig::Vector& getForce() const;
566  const yarp::sig::Vector& getMoment(bool isBase = false) const;
567  double getTorque() const;
568  const yarp::sig::Matrix& getR();
569  const yarp::sig::Matrix& getRC();
570  double getIm() const;
571  double getD2q() const;
572  double getDq() const;
573  double getKr() const;
574  double getFs() const;
575  double getFv() const;
576  double getMass() const;
577  const yarp::sig::Matrix& getInertia()const;
578  const yarp::sig::Vector& getr(bool proj=false);
579  const yarp::sig::Vector& getrC(bool proj=false);
580 
581  //~~~~~~~~~~~~~~~~~~~~~~
582  // set methods
583  //~~~~~~~~~~~~~~~~~~~~~~
584 
585  bool setForce(const yarp::sig::Vector &_F);
586  bool setMoment(const yarp::sig::Vector &_Mu);
587  void setTorque(const double _Tau);
588  bool setAngVel(const yarp::sig::Vector &_w);
589  bool setAngAcc(const yarp::sig::Vector &_dw);
590  bool setLinAcc(const yarp::sig::Vector &_ddp);
591  bool setLinAccC(const yarp::sig::Vector &_ddpC);
592  bool setAngAccM(const yarp::sig::Vector &_dwM);
593 
594  // other methods
595 
596  std::string toString() const;
597 
598 
599 };
600 
601 
611 {
612 protected:
614  yarp::sig::Vector w;
616  yarp::sig::Vector dw;
618  yarp::sig::Vector ddp;
620  yarp::sig::Vector F;
622  yarp::sig::Vector Mu;
624  yarp::sig::Matrix HN;
625 
626  // dummy matrices/vectors
627  const yarp::sig::Matrix eye4x4;
628  const yarp::sig::Matrix eye3x3;
629  const yarp::sig::Matrix zeros3x3;
630  const yarp::sig::Vector zeros3;
631 
632 public:
633 
639  FinalLinkNewtonEuler(const yarp::sig::Matrix &_HN, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
640 
648  FinalLinkNewtonEuler(const yarp::sig::Matrix &_HN, const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
649 
656  bool setAsFinal(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
657 
665  bool setAsFinal(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp);
666 
667 
668  //~~~~~~~~~~~~~~~~~~~~~~
669  // get methods
670  //~~~~~~~~~~~~~~~~~~~~~~
671  const yarp::sig::Vector& getForce() const;
672  const yarp::sig::Vector& getMoment(bool isBase = false) const;
673 
674  // redefine the other unuseful methods to avoid errors due to missing link
675  const yarp::sig::Vector& getAngVel() const;
676  const yarp::sig::Vector& getAngAcc() const;
677  const yarp::sig::Vector& getAngAccM() const;
678  const yarp::sig::Vector& getLinAcc() const;
679  const yarp::sig::Vector& getLinAccC() const;
680  double getTorque() const;
681  const yarp::sig::Matrix& getH();
682  const yarp::sig::Matrix& getR();
683  const yarp::sig::Matrix& getRC();
684  double getIm() const;
685  double getFs() const;
686  double getFv() const;
687  double getD2q() const;
688  double getDq() const;
689  double getKr() const;
690  double getMass() const;
691  const yarp::sig::Matrix& getInertia()const;
692  const yarp::sig::Vector& getr(bool proj=false);
693  const yarp::sig::Vector& getrC(bool proj=false);
694  bool setForce(const yarp::sig::Vector &_F);
695  bool setMoment(const yarp::sig::Vector &_Mu);
696  void setTorque(const double _Tau);
697  bool setAngVel(const yarp::sig::Vector &_w);
698  bool setAngAcc(const yarp::sig::Vector &_dw);
699  bool setLinAcc(const yarp::sig::Vector &_ddp);
700  bool setLinAccC(const yarp::sig::Vector &_ddpC);
701  bool setAngAccM(const yarp::sig::Vector &_dwM);
702 
703  //other
704  std::string toString() const;
705 };
706 
707 
719 {
720 protected:
722  yarp::sig::Vector F;
724  yarp::sig::Vector Mu;
725 
727  yarp::sig::Vector w;
729  yarp::sig::Vector dw;
731  yarp::sig::Vector ddp;
733  yarp::sig::Vector ddpC;
735  yarp::sig::Matrix H;
737  yarp::sig::Matrix COM;
739  yarp::sig::Matrix I;
741  double m;
742 
743  yarp::sig::Matrix R;
744  yarp::sig::Matrix RC;
745  yarp::sig::Vector r;
746  yarp::sig::Vector r_proj;
747  yarp::sig::Vector rc;
748  yarp::sig::Vector rc_proj;
749  const yarp::sig::Vector zeros0;
750 
751 public:
752 
758  SensorLinkNewtonEuler(const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
759 
765  SensorLinkNewtonEuler(const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_COM, const double _m, const yarp::sig::Matrix &_I, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE);
766 
771 
778  bool setMeasuredFMu(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu);
779 
787  bool setSensor(const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I);
788 
794 
800 
808 
813  yarp::sig::Vector getForceMoment() const;
814 
815 
816  //~~~~~~~~~~~~~~~~~~~~~~
817  // get methods
818  //~~~~~~~~~~~~~~~~~~~~~~
819  const yarp::sig::Vector& getAngVel() const;
820  const yarp::sig::Vector& getAngAcc() const;
821  const yarp::sig::Vector& getLinAcc() const;
822  const yarp::sig::Vector& getLinAccC() const;
823 
824  const yarp::sig::Vector& getForce() const;
825  const yarp::sig::Vector& getMoment(bool isBase = false) const;
826 
827  double getIm() const;
828  double getFs() const;
829  double getFv() const;
830  double getD2q() const;
831  double getDq() const;
832  double getKr() const;
833  const yarp::sig::Vector& getAngAccM()const;
834  double getTorque() const;
835  const yarp::sig::Matrix& getH() const;
836 
837  double getMass() const;
838  const yarp::sig::Matrix& getInertia()const;
839  const yarp::sig::Matrix& getR();
840  const yarp::sig::Matrix& getRC();
841  const yarp::sig::Vector& getr(bool proj=false);
842  const yarp::sig::Vector& getrC(bool proj=false);
843 
844  bool setForce(const yarp::sig::Vector &_F);
845  bool setMoment(const yarp::sig::Vector &_Mu);
846  void setTorque(const double _Tau);
847  bool setAngVel(const yarp::sig::Vector &_w);
848  bool setAngAcc(const yarp::sig::Vector &_dw);
849  bool setLinAcc(const yarp::sig::Vector &_ddp);
850  bool setLinAccC(const yarp::sig::Vector &_ddpC);
851  bool setAngAccM(const yarp::sig::Vector &_dwM);
852 
856  std::string toString() const;
857 
858  // redefinitions but using iDynLink instead of OneLinkNeutonEuler
859  // that because it is used by IDynInvSensor
860 
861  void computeAngVel ( iDynLink *link);
862  void computeAngAcc ( iDynLink *link);
863  void computeLinAcc ( iDynLink *link);
864  void computeLinAccC( );
865  void computeForce ( iDynLink *link);
866  void computeMoment ( iDynLink *link);
867 
870 
871  // virtual function to be called by specific sensorLinks
872  virtual std::string getType() const;
873 
874 };
875 
882 {
883  friend class iDynChain;
884 
885 protected:
886 
891 
893  unsigned int nLinks;
895  unsigned int nEndEff;
896 
900  std::string info;
902  unsigned int verbose;
903 
904 public:
905 
909  OneChainNewtonEuler(iDyn::iDynChain *_c, std::string _info, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
910 
915 
919  std::string toString() const;
920 
924  bool getVelAccAfterForward(unsigned int i, yarp::sig::Vector &w, yarp::sig::Vector &dw, yarp::sig::Vector &dwM, yarp::sig::Vector &ddp, yarp::sig::Vector &ddpC) const;
925 
929  bool getWrenchAfterForward(unsigned int i, yarp::sig::Vector &F, yarp::sig::Vector &Mu) const;
930 
935  void getVelAccBase(yarp::sig::Vector &w, yarp::sig::Vector &dw,yarp::sig::Vector &ddp) const;
936 
941  void getVelAccEnd(yarp::sig::Vector &w, yarp::sig::Vector &dw,yarp::sig::Vector &ddp) const;
942 
947  void getWrenchBase(yarp::sig::Vector &F, yarp::sig::Vector &Mu) const;
948 
953  void getWrenchEnd(yarp::sig::Vector &F, yarp::sig::Vector &Mu) const;
954 
955  //~~~~~~~~~~~~~~~~~~~~~~
956  // set methods
957  //~~~~~~~~~~~~~~~~~~~~~~
958 
959  void setVerbose(unsigned int verb=iCub::skinDynLib::VERBOSE);
960  void setMode(const NewEulMode _mode);
961  void setInfo(const std::string _info);
962 
970  bool initKinematicBase(const yarp::sig::Vector &w0,const yarp::sig::Vector &dw0,const yarp::sig::Vector &ddp0);
971 
979  bool initKinematicEnd(const yarp::sig::Vector &w0,const yarp::sig::Vector &dw0,const yarp::sig::Vector &ddp0);
980 
987  bool initWrenchEnd(const yarp::sig::Vector &F0,const yarp::sig::Vector &Mu0);
988 
995  bool initWrenchBase(const yarp::sig::Vector &F0,const yarp::sig::Vector &Mu0);
996 
997 
998  //~~~~~~~~~~~~~~~~~~~~~~
999  // get methods
1000  //~~~~~~~~~~~~~~~~~~~~~~
1001 
1005  std::string getInfo() const;
1006 
1010  NewEulMode getMode() const;
1011 
1012 
1013  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1014  // main computation methods
1015  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1016 
1020  void ForwardKinematicFromBase();
1021 
1025  void ForwardKinematicFromBase(const yarp::sig::Vector &w0, const yarp::sig::Vector &dw0, const yarp::sig::Vector &ddp0);
1026 
1030  void BackwardKinematicFromEnd();
1031 
1035  void BackwardKinematicFromEnd(const yarp::sig::Vector &we, const yarp::sig::Vector &dwe, const yarp::sig::Vector &ddpe);
1036 
1040  void BackwardWrenchFromEnd();
1041 
1045  void BackwardWrenchFromEnd(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu);
1046 
1051  void computeTorques();
1052 
1057  void ForwardWrenchFromBase();
1058 
1065  void ForwardWrenchFromBase(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu);
1066 
1073  bool ForwardWrenchToEnd(unsigned int lSens);
1074 
1081  bool BackwardWrenchToBase(unsigned int lSens);
1082 
1083  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1084  // computations for contacts
1085  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1086 
1094  bool ForwardWrenchFromAtoB(unsigned int lA, unsigned int lB);
1095 
1103  bool BackwardWrenchFromAtoB(unsigned int lA, unsigned int lB);
1104 
1105 };
1106 
1107 
1108 
1109 
1223 {
1224  friend class iFTransformation;
1225 protected:
1226 
1228  unsigned int lSens;
1236  unsigned int verbose;
1238  std::string info;
1239 
1240 public:
1241 
1249  iDynInvSensor(iDyn::iDynChain *_c, const std::string &_info, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1250 
1263  iDynInvSensor(iDyn::iDynChain *_c, unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I, const std::string &_info, const NewEulMode _mode = DYNAMIC, unsigned int verb = 0);
1264 
1274  bool setSensor(unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I);
1275 
1276  bool setSensor(unsigned int i, SensorLinkNewtonEuler* sensor);
1277 
1284  void computeSensorForceMoment();
1285 
1289  std::string toString() const;
1290 
1295  yarp::sig::Vector getSensorForce() const;
1296 
1301  yarp::sig::Vector getSensorMoment() const;
1302 
1307  yarp::sig::Vector getSensorForceMoment() const;
1308 
1313  yarp::sig::Matrix getH() const;
1314 
1319  double getMass() const;
1320 
1325  yarp::sig::Matrix getCOM() const;
1326 
1331  yarp::sig::Matrix getInertia() const;
1332 
1333  //~~~~~~~~~~~~~~
1334  // set methods
1335  //~~~~~~~~~~~~~~
1336 
1337  void setMode(const NewEulMode _mode = DYNAMIC);
1338  void setVerbose(unsigned int verb=iCub::skinDynLib::VERBOSE);
1339  void setInfo(const std::string &_info);
1340  void setSensorInfo(const std::string &_info);
1341 
1349  bool setDynamicParameters(const double _m, const yarp::sig::Matrix &_HC, const yarp::sig::Matrix &_I);
1350 
1351  //~~~~~~~~~~~~~~
1352  // get methods
1353  //~~~~~~~~~~~~~~
1354 
1355  std::string getInfo() const;
1356  std::string getSensorInfo() const;
1357  unsigned int getSensorLink() const;
1358  yarp::sig::Vector getTorques() const;
1359 
1360  //destructor
1361  virtual ~iDynInvSensor();
1362 
1363 };
1364 
1374 {
1375 protected:
1376 
1378  std::string type;
1379 
1380 public:
1381 
1388  iCubArmSensorLink(const std::string &_type, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1389 
1393  virtual ~iCubArmSensorLink() {};
1394 
1398  std::string getType() const;
1399 
1400 };
1401 
1411 {
1412 protected:
1413 
1415  std::string type;
1416 
1417  public:
1418 
1425  iCubLegSensorLink(const std::string _type, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1426 
1430  virtual ~iCubLegSensorLink() {};
1431 
1435  std::string getType() const;
1436 
1437 };
1438 
1439 
1450 {
1451 
1452 public:
1453 
1460  iDynInvSensorArm(iDyn::iCubArmDyn *_c, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1461 
1470  iDynInvSensorArm(iDyn::iDynChain *_c, const std::string _type, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1471 
1475  std::string getType() const;
1476 
1477 
1478 };
1479 
1490 {
1491 
1492 public:
1493 
1501 
1510  iDynInvSensorArmNoTorso(iDyn::iDynChain *_c, const std::string _type, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1511 
1515  std::string getType() const;
1516 
1517 
1518 };
1519 
1530 {
1531 
1532 public:
1533 
1540  iDynInvSensorLeg(iDyn::iCubLegDyn *_c, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1541 
1549  iDynInvSensorLeg(iDyn::iDynChain *_c, const std::string _type, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1550 
1554  std::string getType() const;
1555 
1556 
1557 };
1558 
1559 
1560 
1561 
1562 
1563 
1564 
1565 
1578 {
1579 
1580 public:
1581 
1589  iDynSensor(iDyn::iDynChain *_c, std::string _info, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1590 
1591 
1604  iDynSensor(iDyn::iDynChain *_c, unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I, std::string _info, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1605 
1612  bool setSensorMeasures(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu);
1613 
1620  bool setSensorMeasures(const yarp::sig::Vector &FM);
1621 
1622  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1623  // main computation methods
1624  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1625 
1636  virtual bool computeFromSensorNewtonEuler(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu);
1637 
1647  virtual bool computeFromSensorNewtonEuler(const yarp::sig::Vector &FMu);
1648 
1658  virtual void computeFromSensorNewtonEuler();
1659 
1670  virtual void computeWrenchFromSensorNewtonEuler();
1671 
1672  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1673  // get methods, overloaded from iDyn
1674  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1675 
1680  yarp::sig::Matrix getForces() const;
1681 
1686  yarp::sig::Matrix getMoments() const;
1687 
1692  yarp::sig::Vector getTorques() const;
1693 
1698  yarp::sig::Vector getForce(const unsigned int iLink) const;
1699 
1704  yarp::sig::Vector getMoment(const unsigned int iLink) const;
1705 
1710  double getTorque(const unsigned int iLink) const;
1711 
1716  yarp::sig::Matrix getForcesNewtonEuler() const;
1717 
1722  yarp::sig::Matrix getMomentsNewtonEuler() const;
1723 
1728  yarp::sig::Vector getTorquesNewtonEuler() const;
1729 
1734  virtual yarp::sig::Vector getForceMomentEndEff() const;
1735 
1736 
1737 };
1738 
1739 
1740 
1741 
1753 {
1754 
1755 public:
1756 
1763  iDynSensorArm(iDyn::iCubArmDyn *_c, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1764 
1768  std::string getType() const;
1769 
1770 
1771 };
1772 
1773 
1785 {
1786 
1787 public:
1788 
1796 
1800  std::string getType() const;
1801 
1802 
1803 };
1804 
1816 {
1817 
1818 public:
1819 
1826  iDynSensorLeg(iDyn::iCubLegDyn *_c, const NewEulMode _mode = DYNAMIC, unsigned int verb = iCub::skinDynLib::NO_VERBOSE);
1827 
1831  std::string getType() const;
1832 
1833 
1834 };
1835 
1836 
1837 
1838 
1839 
1840 
1841 
1842 
1843 }
1844 
1845 }//end namespace
1846 
1847 #endif
1848 
1849 
A class for setting a virtual base link: this is useful to initialize the forward phase of Newton-Eul...
Definition: iDynInv.h:492
std::string toString() const
Useful to print some information.
Definition: iDynInv.cpp:852
const yarp::sig::Vector & getLinAccC() const
Definition: iDynInv.cpp:881
yarp::sig::Vector dw
initial angular acceleration
Definition: iDynInv.h:497
yarp::sig::Vector w
initial angular velocity
Definition: iDynInv.h:495
bool setMoment(const yarp::sig::Vector &_Mu)
Set the OneLink moment: either the corresponding iDynLink moment, or the one declared as member in th...
Definition: iDynInv.cpp:920
const yarp::sig::Matrix & getR()
Definition: iDynInv.cpp:891
const yarp::sig::Vector & getAngVel() const
Definition: iDynInv.cpp:873
const yarp::sig::Vector zeros3
Definition: iDynInv.h:514
const yarp::sig::Vector & getr(bool proj=false)
Definition: iDynInv.cpp:901
bool setAngAccM(const yarp::sig::Vector &_dwM)
Set the OneLink angular acceleration of the motor (dwM), ie the corresponding iDynLink angular accele...
Definition: iDynInv.cpp:994
yarp::sig::Vector Mu0
initial moment
Definition: iDynInv.h:507
bool setLinAcc(const yarp::sig::Vector &_ddp)
Set the OneLink linear acceleration (ddp), ie the corresponding iDynLink linear acceleration (ddp) (i...
Definition: iDynInv.cpp:971
BaseLinkNewtonEuler(const yarp::sig::Matrix &_H0, const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor, initializing the base data.
const yarp::sig::Vector & getMoment(bool isBase=false) const
Definition: iDynInv.cpp:884
yarp::sig::Vector ddp
initial linear acceleration
Definition: iDynInv.h:499
bool setForce(const yarp::sig::Vector &_F)
Set the OneLink force: either the corresponding iDynLink force, or the one declared as member in the ...
Definition: iDynInv.cpp:904
bool setAngAcc(const yarp::sig::Vector &_dw)
Set the OneLink angular acceleration (dw), ie the corresponding iDynLink angular acceleration (dw) (i...
Definition: iDynInv.cpp:955
bool setAngVel(const yarp::sig::Vector &_w)
Set the OneLink angular velocity (w), ie the corresponding iDynLink angular velocity (w) (in the chil...
Definition: iDynInv.cpp:939
yarp::sig::Matrix H0
base roto-traslation (if necessary)
Definition: iDynInv.h:501
void setTorque(const double _Tau)
Set the OneLink torque, ie the corresponding iDynLink joint torque (nothing in the child classes deri...
Definition: iDynInv.cpp:937
BaseLinkNewtonEuler(const yarp::sig::Matrix &_H0, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Default constructor.
const yarp::sig::Matrix & getInertia() const
Definition: iDynInv.cpp:900
const yarp::sig::Matrix zeros3x3
Definition: iDynInv.h:513
double Tau
corresponding torque
Definition: iDynInv.h:509
const yarp::sig::Matrix & getRC()
Definition: iDynInv.cpp:892
bool setAsBase(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp)
Sets the base data.
const yarp::sig::Vector & getrC(bool proj=false)
Definition: iDynInv.cpp:902
yarp::sig::Vector Mu
initial moment
Definition: iDynInv.h:505
const yarp::sig::Matrix eye3x3
Definition: iDynInv.h:512
const yarp::sig::Vector & getAngAccM() const
Definition: iDynInv.cpp:877
const yarp::sig::Vector & getAngAcc() const
Definition: iDynInv.cpp:875
const yarp::sig::Vector & getLinAcc() const
Definition: iDynInv.cpp:879
bool setAsBase(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
Sets the base data.
yarp::sig::Vector F
initial force
Definition: iDynInv.h:503
bool setLinAccC(const yarp::sig::Vector &_ddpC)
Set the OneLink linear acceleration of the COM (ddpC), ie the corresponding iDynLink linear accelerat...
Definition: iDynInv.cpp:987
const yarp::sig::Vector & getForce() const
Definition: iDynInv.cpp:883
A class for setting a virtual final link: this is useful to initialize the backward phase of Newton-E...
Definition: iDynInv.h:611
yarp::sig::Vector F
final force
Definition: iDynInv.h:620
bool setMoment(const yarp::sig::Vector &_Mu)
Set the OneLink moment: either the corresponding iDynLink moment, or the one declared as member in th...
Definition: iDynInv.cpp:1163
const yarp::sig::Vector zeros3
Definition: iDynInv.h:630
const yarp::sig::Vector & getForce() const
Definition: iDynInv.cpp:1123
bool setLinAccC(const yarp::sig::Vector &_ddpC)
Set the OneLink linear acceleration of the COM (ddpC), ie the corresponding iDynLink linear accelerat...
Definition: iDynInv.cpp:1206
const yarp::sig::Vector & getAngVel() const
Definition: iDynInv.cpp:1127
bool setForce(const yarp::sig::Vector &_F)
Set the OneLink force: either the corresponding iDynLink force, or the one declared as member in the ...
Definition: iDynInv.cpp:1147
const yarp::sig::Vector & getr(bool proj=false)
Definition: iDynInv.cpp:1144
const yarp::sig::Vector & getLinAccC() const
Definition: iDynInv.cpp:1131
FinalLinkNewtonEuler(const yarp::sig::Matrix &_HN, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Default constructor.
Definition: iDynInv.cpp:1011
const yarp::sig::Matrix & getH()
Definition: iDynInv.cpp:1133
bool setAngAcc(const yarp::sig::Vector &_dw)
Set the OneLink angular acceleration (dw), ie the corresponding iDynLink angular acceleration (dw) (i...
Definition: iDynInv.cpp:1190
bool setAngAccM(const yarp::sig::Vector &_dwM)
Set the OneLink angular acceleration of the motor (dwM), ie the corresponding iDynLink angular accele...
Definition: iDynInv.cpp:1213
const yarp::sig::Vector & getLinAcc() const
Definition: iDynInv.cpp:1130
yarp::sig::Vector w
initial angular velocity
Definition: iDynInv.h:614
const yarp::sig::Vector & getAngAccM() const
Definition: iDynInv.cpp:1129
const yarp::sig::Matrix & getInertia() const
Definition: iDynInv.cpp:1143
yarp::sig::Vector Mu
final moment
Definition: iDynInv.h:622
bool setAsFinal(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp)
Set the final frame data.
const yarp::sig::Matrix eye3x3
Definition: iDynInv.h:628
void setTorque(const double _Tau)
Set the OneLink torque, ie the corresponding iDynLink joint torque (nothing in the child classes deri...
Definition: iDynInv.cpp:1179
yarp::sig::Vector dw
initial angular acceleration
Definition: iDynInv.h:616
bool setAngVel(const yarp::sig::Vector &_w)
Set the OneLink angular velocity (w), ie the corresponding iDynLink angular velocity (w) (in the chil...
Definition: iDynInv.cpp:1181
const yarp::sig::Matrix & getR()
Definition: iDynInv.cpp:1134
FinalLinkNewtonEuler(const yarp::sig::Matrix &_HN, const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor, initializing the final frame data.
std::string toString() const
Useful to print some information.
Definition: iDynInv.cpp:1103
yarp::sig::Vector ddp
initial linear acceleration
Definition: iDynInv.h:618
bool setLinAcc(const yarp::sig::Vector &_ddp)
Set the OneLink linear acceleration (ddp), ie the corresponding iDynLink linear acceleration (ddp) (i...
Definition: iDynInv.cpp:1198
const yarp::sig::Vector & getMoment(bool isBase=false) const
Definition: iDynInv.cpp:1125
const yarp::sig::Vector & getrC(bool proj=false)
Definition: iDynInv.cpp:1145
const yarp::sig::Matrix & getRC()
Definition: iDynInv.cpp:1135
yarp::sig::Matrix HN
final roto-traslation (if necessary)
Definition: iDynInv.h:624
bool setAsFinal(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
Set the final frame data.
const yarp::sig::Matrix zeros3x3
Definition: iDynInv.h:629
const yarp::sig::Matrix eye4x4
Definition: iDynInv.h:627
const yarp::sig::Vector & getAngAcc() const
Definition: iDynInv.cpp:1128
A class for computing forces and torques in a iDynChain.
Definition: iDynInv.h:882
void BackwardWrenchFromEnd()
[classic] Base function for backward of classical Newton-Euler.
Definition: iDynInv.cpp:1883
bool getVelAccAfterForward(unsigned int i, yarp::sig::Vector &w, yarp::sig::Vector &dw, yarp::sig::Vector &dwM, yarp::sig::Vector &ddp, yarp::sig::Vector &ddpC) const
Useful to debug, getting the intermediate computations after the forward phase.
Definition: iDynInv.cpp:1732
unsigned int nEndEff
the index of the end-effector in the chain (the last frame)
Definition: iDynInv.h:895
void BackwardWrenchFromEnd(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu)
[classic] Backward of classical Newton-Euler, after initializing the final link
void getVelAccEnd(yarp::sig::Vector &w, yarp::sig::Vector &dw, yarp::sig::Vector &ddp) const
This method is used by iDynChain to retrieve kinematic information for connection with one or more iD...
Definition: iDynInv.cpp:1774
std::string toString() const
Useful to print some information.
Definition: iDynInv.cpp:1720
iDyn::iDynChain * chain
the real kinematic/dynamic chain of the robot
Definition: iDynInv.h:888
void ForwardKinematicFromBase()
[classic/inverse] Base function for forward of classical Newton-Euler.
Definition: iDynInv.cpp:1851
bool initKinematicBase(const yarp::sig::Vector &w0, const yarp::sig::Vector &dw0, const yarp::sig::Vector &ddp0)
[classic] Initialize the base with measured or known kinematics variables
Definition: iDynInv.cpp:1818
bool initWrenchEnd(const yarp::sig::Vector &F0, const yarp::sig::Vector &Mu0)
[classic] Initialize the end-effector finalLink with measured or known wrench
Definition: iDynInv.cpp:1828
void setMode(const NewEulMode _mode)
Definition: iDynInv.cpp:1806
NewEulMode getMode() const
Definition: iDynInv.cpp:1844
void setInfo(const std::string _info)
Definition: iDynInv.cpp:1813
void BackwardKinematicFromEnd(const yarp::sig::Vector &we, const yarp::sig::Vector &dwe, const yarp::sig::Vector &ddpe)
[inverse] Forward of classical Newton-Euler, after initializing the base link
void ForwardKinematicFromBase(const yarp::sig::Vector &w0, const yarp::sig::Vector &dw0, const yarp::sig::Vector &ddp0)
[classic/inverse] Forward of classical Newton-Euler, after initializing the base link
NewEulMode mode
static/dynamic/dynamicWrotor
Definition: iDynInv.h:898
void getWrenchEnd(yarp::sig::Vector &F, yarp::sig::Vector &Mu) const
This method is used by iDynChain to retrieve wrench information for connection with one or more iDynL...
Definition: iDynInv.cpp:1787
void setVerbose(unsigned int verb=iCub::skinDynLib::VERBOSE)
Definition: iDynInv.cpp:1799
bool ForwardWrenchToEnd(unsigned int lSens)
[inverse] Base function for inverse Newton-Euler: from the i-th link to the end, forward of forces an...
Definition: iDynInv.cpp:1926
~OneChainNewtonEuler()
Standard destructor.
Definition: iDynInv.cpp:1713
OneChainNewtonEuler(iDyn::iDynChain *_c, std::string _info, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor (note: without FT sensor)
Definition: iDynInv.cpp:1673
OneLinkNewtonEuler ** neChain
the chain of links/frames for Newton-Euler computations
Definition: iDynInv.h:890
void BackwardKinematicFromEnd()
[inverse] Base function for forward of classical Newton-Euler.
Definition: iDynInv.cpp:1867
void ForwardWrenchFromBase(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu)
[inverse] Base function for inverse Newton-Euler: from the i-th link to the base, backward of forces ...
bool initWrenchBase(const yarp::sig::Vector &F0, const yarp::sig::Vector &Mu0)
[inverse] Initialize the base with measured or known wrench
Definition: iDynInv.cpp:1833
unsigned int verbose
verbosity flag
Definition: iDynInv.h:902
bool BackwardWrenchFromAtoB(unsigned int lA, unsigned int lB)
Base function for inverse Newton-Euler: from the lA-th link to the lB-th, backward of forces and mome...
Definition: iDynInv.cpp:1995
bool BackwardWrenchToBase(unsigned int lSens)
[classic/inverse] Base function for inverse Newton-Euler: from the i-th link to the base,...
Definition: iDynInv.cpp:1947
void getWrenchBase(yarp::sig::Vector &F, yarp::sig::Vector &Mu) const
This method is used by iDynChain to retrieve wrench information for connection with one or more iDynL...
Definition: iDynInv.cpp:1781
void getVelAccBase(yarp::sig::Vector &w, yarp::sig::Vector &dw, yarp::sig::Vector &ddp) const
This method is used by iDynChain to retrieve kinematic information for connection with one or more iD...
Definition: iDynInv.cpp:1767
void ForwardWrenchFromBase()
[inverse] Base function for inverse Newton-Euler: from the i-th link to the end, forward of forces an...
Definition: iDynInv.cpp:1908
void computeTorques()
Computes all the torques in the chain, assuming that all the internal wrenches have been already comp...
Definition: iDynInv.cpp:1892
std::string info
info or useful notes
Definition: iDynInv.h:900
unsigned int nLinks
number of links
Definition: iDynInv.h:893
std::string getInfo() const
Definition: iDynInv.cpp:1843
bool getWrenchAfterForward(unsigned int i, yarp::sig::Vector &F, yarp::sig::Vector &Mu) const
Useful to debug, getting the intermediate computations after the forward phase.
Definition: iDynInv.cpp:1751
bool initKinematicEnd(const yarp::sig::Vector &w0, const yarp::sig::Vector &dw0, const yarp::sig::Vector &ddp0)
[inverse] Initialize the end-effector finalLink with measured or known kinematics variables
Definition: iDynInv.cpp:1823
bool ForwardWrenchFromAtoB(unsigned int lA, unsigned int lB)
Base function for inverse Newton-Euler: from the lA-th link to the lB-th, forward of forces and momen...
Definition: iDynInv.cpp:1976
A base class for computing forces and torques in a serial link chain.
Definition: iDynInv.h:96
void computeLinAcc(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute linear acceleration of the reference frame of the link
Definition: iDynInv.cpp:492
NewEulMode mode
STATIC/DYNAMIC/DYNAMIC_W_ROTOR/DYNAMIC_CORIOLIS_GRAVITY.
Definition: iDynInv.h:100
virtual const yarp::sig::Vector & getrC(bool proj=false)
Definition: iDynInv.cpp:380
virtual bool setLinAccC(const yarp::sig::Vector &_ddpC)
Set the OneLink linear acceleration of the COM (ddpC), ie the corresponding iDynLink linear accelerat...
Definition: iDynInv.cpp:226
virtual const yarp::sig::Vector & getForce() const
Definition: iDynInv.cpp:348
void setVerbose(unsigned int verb=iCub::skinDynLib::VERBOSE)
Set the verbosity level of comments during operations.
Definition: iDynInv.cpp:117
void setInfo(const std::string &_info)
Set some information about this OneLink class.
Definition: iDynInv.cpp:256
OneLinkNewtonEuler(iDyn::iDynLink *dlink=NULL)
Default constructor.
Definition: iDynInv.cpp:46
virtual bool setAsFinal(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
Set the frame as the final one: this is useful to initialize the backward phase of Newton-Euler's met...
virtual const yarp::sig::Matrix & getR()
Definition: iDynInv.cpp:358
virtual const yarp::sig::Vector & getAngVel() const
Definition: iDynInv.cpp:338
void computeForceBackward(OneLinkNewtonEuler *next)
[Backward Newton-Euler] compute force from the following link
Definition: iDynInv.cpp:581
virtual bool setMoment(const yarp::sig::Vector &_Mu)
Set the OneLink moment: either the corresponding iDynLink moment, or the one declared as member in th...
Definition: iDynInv.cpp:161
virtual bool setAngAcc(const yarp::sig::Vector &_dw)
Set the OneLink angular acceleration (dw), ie the corresponding iDynLink angular acceleration (dw) (i...
Definition: iDynInv.cpp:196
void BackwardWrench(OneLinkNewtonEuler *next)
[Backward Newton-Euler] Compute F, Mu, Tau
Definition: iDynInv.cpp:737
virtual const yarp::sig::Matrix & getInertia() const
Definition: iDynInv.cpp:376
virtual double getDq() const
Definition: iDynInv.cpp:366
virtual const yarp::sig::Vector & getMoment(bool isBase=false) const
Definition: iDynInv.cpp:350
void computeLinAccBackward(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute linear acceleration of the reference frame of the previous link
Definition: iDynInv.cpp:517
virtual void computeTorque(OneLinkNewtonEuler *prev)
[all] Compute joint torque; moment must be pre-computed
Definition: iDynInv.cpp:698
virtual double getTorque() const
Definition: iDynInv.cpp:352
virtual const yarp::sig::Matrix & getH()
Definition: iDynInv.cpp:356
bool setZM(const yarp::sig::Vector &_zm)
Set the zM vector.
Definition: iDynInv.cpp:127
virtual bool setMeasuredTorque(const double _Tau)
Set measured torque in a joint torque sensor frame
Definition: iDynInv.cpp:286
void setMode(const NewEulMode _mode)
Set the operation mode (static,dynamic etc)
Definition: iDynInv.cpp:122
iDyn::iDynLink * link
the corresponding iDynLink
Definition: iDynInv.h:110
virtual const yarp::sig::Vector & getLinAccC() const
Definition: iDynInv.cpp:346
virtual const yarp::sig::Matrix & getRC()
Definition: iDynInv.cpp:360
virtual double getD2q() const
Definition: iDynInv.cpp:364
void zero()
Set everything to zero; R is set to an identity matrix.
Definition: iDynInv.cpp:66
virtual double getIm() const
Definition: iDynInv.cpp:362
std::string getInfo() const
Definition: iDynInv.cpp:354
virtual bool setAsFinal(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp)
Set the frame as the final one: this is useful to initialize the backward phase of Euler's method,...
virtual bool setAsBase(const yarp::sig::Vector &_w, const yarp::sig::Vector &_dw, const yarp::sig::Vector &_ddp)
Virtual method to set the frame as the base one: this is useful to initialize the forward phase of Ne...
virtual bool setMeasuredFMu(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
Set measured force and moment in a 'sensor' frame: this is useful to initialize the forward phase of ...
Definition: iDynInv.cpp:261
std::string info
info or useful notes
Definition: iDynInv.h:102
virtual bool setLinAcc(const yarp::sig::Vector &_ddp)
Set the OneLink linear acceleration (ddp), ie the corresponding iDynLink linear acceleration (ddp) (i...
Definition: iDynInv.cpp:211
void computeAngVelBackward(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute angular velocity of the previous link frame
Definition: iDynInv.cpp:408
void computeMomentForward(OneLinkNewtonEuler *prev)
[Inverse Newton-Euler] compute moment from the previous link
Definition: iDynInv.cpp:642
virtual const yarp::sig::Vector & getAngAccM() const
Definition: iDynInv.cpp:342
void computeAngAccM(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute angular acceleration of the rotor
Definition: iDynInv.cpp:563
virtual const yarp::sig::Vector & getr(bool proj=false)
Definition: iDynInv.cpp:378
virtual bool setAsBase(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
virtual double getFv() const
Definition: iDynInv.cpp:372
virtual bool setAngAccM(const yarp::sig::Vector &_dwM)
Set the OneLink angular acceleration of the motor (dwM), ie the corresponding iDynLink angular accele...
Definition: iDynInv.cpp:241
void ForwardWrench(OneLinkNewtonEuler *prev)
[Inverse Newton-Euler] Compute F, Mu, Tau
Definition: iDynInv.cpp:743
void computeLinAccC()
[Forward Newton-Euler] compute linear acceleration of the center of mass
Definition: iDynInv.cpp:542
void computeAngAcc(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute angular acceleration of the link
Definition: iDynInv.cpp:428
yarp::sig::Vector getZM() const
Definition: iDynInv.cpp:336
virtual bool setAngVel(const yarp::sig::Vector &_w)
Set the OneLink angular velocity (w), ie the corresponding iDynLink angular velocity (w) (in the chil...
Definition: iDynInv.cpp:181
void ForwardKinematics(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] Compute w, dw, ddp, ddpC, dwM
Definition: iDynInv.cpp:720
void computeAngVel(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute angular velocity of the link
Definition: iDynInv.cpp:388
void computeForceForward(OneLinkNewtonEuler *prev)
[Inverse Newton-Euler] compute force from the previous link
Definition: iDynInv.cpp:588
virtual ~OneLinkNewtonEuler()
Destructor.
Definition: iDynInv.h:267
virtual double getKr() const
Definition: iDynInv.cpp:368
void BackwardKinematics(OneLinkNewtonEuler *prev)
[Backward Kinematic computation] Compute w, dw, ddp, ddpC, dwM
Definition: iDynInv.cpp:729
yarp::sig::Vector z0
z0=[0 0 1]'
Definition: iDynInv.h:106
virtual const yarp::sig::Vector & getAngAcc() const
Definition: iDynInv.cpp:340
void computeMomentBackward(OneLinkNewtonEuler *next)
[Backward Newton-Euler] compute moment from the following link
Definition: iDynInv.cpp:596
yarp::sig::Vector zm
z^{i-1}_{m_{i}} versor rotating solidally with link i, projected in frame i ==>> constant
Definition: iDynInv.h:108
unsigned int verbose
verbosity flag
Definition: iDynInv.h:104
virtual void setTorque(const double _Tau)
Set the OneLink torque, ie the corresponding iDynLink joint torque (nothing in the child classes deri...
Definition: iDynInv.cpp:176
virtual std::string toString() const
Useful to print some information.
Definition: iDynInv.cpp:301
virtual const yarp::sig::Vector & getLinAcc() const
Definition: iDynInv.cpp:344
virtual bool setForce(const yarp::sig::Vector &_F)
Set the OneLink force: either the corresponding iDynLink force, or the one declared as member in the ...
Definition: iDynInv.cpp:146
virtual double getFs() const
Definition: iDynInv.cpp:370
virtual double getMass() const
Definition: iDynInv.cpp:374
NewEulMode getMode() const
Definition: iDynInv.cpp:334
void computeAngAccBackward(OneLinkNewtonEuler *prev)
[Forward Newton-Euler] compute angular acceleration of the previous link frame
Definition: iDynInv.cpp:460
A class for setting a virtual sensor link.
Definition: iDynInv.h:719
bool setAngAcc(const yarp::sig::Vector &_dw)
Set the OneLink angular acceleration (dw), ie the corresponding iDynLink angular acceleration (dw) (i...
Definition: iDynInv.cpp:1446
yarp::sig::Matrix H
the roto-translational matrix from the i-th link to the sensor: it's the matrix describing the sensor...
Definition: iDynInv.h:735
yarp::sig::Matrix I
the semi-link inertia
Definition: iDynInv.h:739
yarp::sig::Matrix COM
the roto-translational matrix of the COM of the semi-link (bewteen sensor and ith link frame)
Definition: iDynInv.h:737
bool setAngVel(const yarp::sig::Vector &_w)
Set the OneLink angular velocity (w), ie the corresponding iDynLink angular velocity (w) (in the chil...
Definition: iDynInv.cpp:1430
bool setMeasuredFMu(const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
Set the sensor measured force/moment - if measured by a FT sensor.
Definition: iDynInv.cpp:1260
const yarp::sig::Matrix & getRC()
Definition: iDynInv.cpp:1370
void computeMoment(iDynLink *link)
Definition: iDynInv.cpp:1612
const yarp::sig::Vector & getrC(bool proj=false)
Definition: iDynInv.cpp:1379
bool setAngAccM(const yarp::sig::Vector &_dwM)
Set the OneLink angular acceleration of the motor (dwM), ie the corresponding iDynLink angular accele...
Definition: iDynInv.cpp:1494
const yarp::sig::Vector & getForce() const
Definition: iDynInv.cpp:1352
const yarp::sig::Vector zeros0
Definition: iDynInv.h:749
void computeForceToLink(iDynLink *link)
Definition: iDynInv.cpp:1562
void computeMomentToLink(iDynLink *link)
Definition: iDynInv.cpp:1570
void BackwardAttachToLink(iDynLink *link)
Compute F,Mu given the reference frame of the link where the sensor is.
Definition: iDynInv.cpp:1334
void computeAngVel(iDynLink *link)
Definition: iDynInv.cpp:1507
void ForwardForcesMomentsToLink(iDynLink *link)
Forward the sensor forces and moments, measured by the sensor, to the reference frame of the link whe...
Definition: iDynInv.cpp:1340
yarp::sig::Vector rc_proj
Definition: iDynInv.h:748
virtual ~SensorLinkNewtonEuler()
Destructor.
Definition: iDynInv.h:770
const yarp::sig::Matrix & getR()
Definition: iDynInv.cpp:1368
yarp::sig::Vector getForceMoment() const
Get the sensor force and moment in a single (6x1) vector.
Definition: iDynInv.cpp:1650
virtual std::string getType() const
Definition: iDynInv.cpp:1658
const yarp::sig::Vector & getAngVel() const
Definition: iDynInv.cpp:1356
const yarp::sig::Matrix & getH() const
Definition: iDynInv.cpp:1394
SensorLinkNewtonEuler(const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_COM, const double _m, const yarp::sig::Matrix &_I, const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor.
void computeAngAcc(iDynLink *link)
Definition: iDynInv.cpp:1512
yarp::sig::Vector F
measured or estimated force
Definition: iDynInv.h:722
bool setForce(const yarp::sig::Vector &_F)
Set the OneLink force: either the corresponding iDynLink force, or the one declared as member in the ...
Definition: iDynInv.cpp:1396
void ForwardAttachToLink(iDynLink *link)
Compute w,dw,ddp,dppC given the reference frame of the link where the sensor is.
Definition: iDynInv.cpp:1326
const yarp::sig::Vector & getAngAcc() const
Definition: iDynInv.cpp:1358
bool setMoment(const yarp::sig::Vector &_Mu)
Set the OneLink moment: either the corresponding iDynLink moment, or the one declared as member in th...
Definition: iDynInv.cpp:1412
void computeLinAcc(iDynLink *link)
Definition: iDynInv.cpp:1517
const yarp::sig::Vector & getAngAccM() const
Definition: iDynInv.cpp:1392
std::string toString() const
Useful to print some information.
Definition: iDynInv.cpp:1310
yarp::sig::Vector ddpC
linear acceleration of the COM
Definition: iDynInv.h:733
const yarp::sig::Vector & getr(bool proj=false)
Definition: iDynInv.cpp:1372
const yarp::sig::Vector & getLinAcc() const
Definition: iDynInv.cpp:1360
bool setLinAccC(const yarp::sig::Vector &_ddpC)
Set the OneLink linear acceleration of the COM (ddpC), ie the corresponding iDynLink linear accelerat...
Definition: iDynInv.cpp:1478
yarp::sig::Vector dw
angular acceleration
Definition: iDynInv.h:729
void computeForce(iDynLink *link)
Definition: iDynInv.cpp:1555
const yarp::sig::Vector & getMoment(bool isBase=false) const
Definition: iDynInv.cpp:1354
yarp::sig::Vector ddp
linear acceleration
Definition: iDynInv.h:731
yarp::sig::Vector Mu
measured or estimated moment
Definition: iDynInv.h:724
void setTorque(const double _Tau)
Set the OneLink torque, ie the corresponding iDynLink joint torque (nothing in the child classes deri...
Definition: iDynInv.cpp:1428
SensorLinkNewtonEuler(const NewEulMode _mode, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Default constructor.
Definition: iDynInv.cpp:1229
yarp::sig::Vector r_proj
Definition: iDynInv.h:746
bool setSensor(const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I)
Set a new sensor or new sensor properties.
Definition: iDynInv.cpp:1280
double m
the semi-link mass (the portion of link defined by the sensor)
Definition: iDynInv.h:741
yarp::sig::Vector w
angular velocity
Definition: iDynInv.h:727
const yarp::sig::Matrix & getInertia() const
Definition: iDynInv.cpp:1366
bool setLinAcc(const yarp::sig::Vector &_ddp)
Set the OneLink linear acceleration (ddp), ie the corresponding iDynLink linear acceleration (ddp) (i...
Definition: iDynInv.cpp:1462
const yarp::sig::Vector & getLinAccC() const
Definition: iDynInv.cpp:1362
A class for defining the 7-DOF iCub Arm in the iDyn framework.
Definition: iDyn.h:1328
A class for defining the 7-DOF iCub Arm in the iDyn framework.
Definition: iDyn.h:1369
A class for defining the 6-DOF iCub Leg.
Definition: iDyn.h:1452
A Base class for defining a Serial Link Chain, using dynamics and kinematics.
Definition: iDyn.h:533
A class for computing force/moment of the FT sensor placed in the middle of the iCub's left or right ...
Definition: iDynInv.h:1490
iDynInvSensorArmNoTorso(iDyn::iCubArmNoTorsoDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2399
A class for computing force/moment of the FT sensor placed in the middle of the iCub's left or right ...
Definition: iDynInv.h:1450
iDynInvSensorArm(iDyn::iCubArmDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2338
std::string getType() const
Definition: iDynInv.cpp:2384
A class for computing force/moment of the FT sensor placed in the middle of the iCub's left or right ...
Definition: iDynInv.h:1530
std::string getType() const
Definition: iDynInv.cpp:2558
iDynInvSensorLeg(iDyn::iCubLegDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2512
A class for computing force/moment of a sensor placed anywhere in a kinematic chain; its position in ...
Definition: iDynInv.h:1223
yarp::sig::Matrix getCOM() const
Get the sensor roto-traslational matrix of the center of mass of the semi-link defined by the sensor ...
Definition: iDynInv.cpp:2223
void setSensorInfo(const std::string &_info)
Definition: iDynInv.cpp:2170
yarp::sig::Matrix getH() const
Get the sensor roto-translational matrix defining its position/orientation wrt the link.
Definition: iDynInv.cpp:2197
void setMode(const NewEulMode _mode=DYNAMIC)
Definition: iDynInv.cpp:2153
iDynInvSensor(iDyn::iDynChain *_c, unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I, const std::string &_info, const NewEulMode _mode=DYNAMIC, unsigned int verb=0)
Constructor with FT sensor.
void setInfo(const std::string &_info)
Definition: iDynInv.cpp:2165
NewEulMode mode
static/dynamic/etc..
Definition: iDynInv.h:1234
void setVerbose(unsigned int verb=iCub::skinDynLib::VERBOSE)
Definition: iDynInv.cpp:2159
yarp::sig::Matrix getInertia() const
Get the inertia of the portion of link defined between sensor and i-th frame.
Definition: iDynInv.cpp:2240
std::string info
a string with useful information if needed
Definition: iDynInv.h:1238
yarp::sig::Vector getSensorMoment() const
Returns the sensor estimated moment.
Definition: iDynInv.cpp:2130
bool setSensor(unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I)
Set a new sensor or new sensor properties.
std::string getSensorInfo() const
Definition: iDynInv.cpp:2253
std::string getInfo() const
Definition: iDynInv.cpp:2195
yarp::sig::Vector getSensorForceMoment() const
Get the sensor force and moment in a single (6x1) vector.
Definition: iDynInv.cpp:2265
bool setDynamicParameters(const double _m, const yarp::sig::Matrix &_HC, const yarp::sig::Matrix &_I)
Set the dynamic parameters of the the portion of link defined between sensor and i-th frame.
Definition: iDynInv.cpp:2175
yarp::sig::Vector getSensorForce() const
Returns the sensor estimated force.
Definition: iDynInv.cpp:2118
iDynInvSensor(iDyn::iDynChain *_c, const std::string &_info, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor without FT sensor: the sensor must be set with setSensor()
Definition: iDynInv.cpp:2025
SensorLinkNewtonEuler * sens
the sensor
Definition: iDynInv.h:1230
double getMass() const
Get the mass of the portion of link defined between sensor and i-th frame.
Definition: iDynInv.cpp:2210
void computeSensorForceMoment()
Compute forces and moments at the sensor frame; this method calls special Forward and Backward method...
Definition: iDynInv.cpp:2102
unsigned int getSensorLink() const
Definition: iDynInv.cpp:2277
unsigned int lSens
the link where the sensor is attached to
Definition: iDynInv.h:1228
unsigned int verbose
verbosity flag
Definition: iDynInv.h:1236
std::string toString() const
Print some information.
Definition: iDynInv.cpp:2057
yarp::sig::Vector getTorques() const
Definition: iDynInv.cpp:2142
iDynChain * chain
the iDynChain describing the robotic chain
Definition: iDynInv.h:1232
A class for computing joint force/moment/torque of an iCub arm (left/right) given the FT measurements...
Definition: iDynInv.h:1785
std::string getType() const
Definition: iDynInv.cpp:2770
iDynSensorArmNoTorso(iDyn::iCubArmNoTorsoDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2746
A class for computing joint force/moment/torque of an iCub arm (left/right) given the FT measurements...
Definition: iDynInv.h:1753
iDynSensorArm(iDyn::iCubArmDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2707
std::string getType() const
Definition: iDynInv.cpp:2730
A class for computing joint force/moment/torque of an iCub leg (left/right) given the FT measurements...
Definition: iDynInv.h:1816
iDynSensorLeg(iDyn::iCubLegDyn *_c, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor: the sensor is automatically set with "right" or "left" choice.
Definition: iDynInv.cpp:2787
std::string getType() const
Definition: iDynInv.cpp:2810
A class for computing forces and torques in a iDynChain, when a force/torque sensor is placed in the ...
Definition: iDynInv.h:1578
bool setSensorMeasures(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu)
Set the sensor measured force and moment.
bool setSensorMeasures(const yarp::sig::Vector &FM)
Set the sensor measured force and moment at once.
virtual void computeFromSensorNewtonEuler()
The main computation method: given the FT sensor measurements, compute forces moments and torques in ...
Definition: iDynInv.cpp:2611
virtual void computeWrenchFromSensorNewtonEuler()
The main computation method: given the FT sensor measurements, compute forces moments and torques in ...
Definition: iDynInv.cpp:2634
yarp::sig::Vector getForce(const unsigned int iLink) const
Returns the i-th link force.
Definition: iDynInv.cpp:2684
yarp::sig::Matrix getMomentsNewtonEuler() const
Returns the links moments as a matrix, where the i-th col is the i-th moment.
Definition: iDynInv.cpp:2692
double getTorque(const unsigned int iLink) const
Returns the i-th link torque.
Definition: iDynInv.cpp:2688
yarp::sig::Vector getTorquesNewtonEuler() const
Returns the links torque as a vector.
Definition: iDynInv.cpp:2694
iDynSensor(iDyn::iDynChain *_c, std::string _info, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor without FT sensor: the sensor must be set with setSensor()
Definition: iDynInv.cpp:2574
yarp::sig::Matrix getForcesNewtonEuler() const
Returns the links forces as a matrix, where the i-th col is the i-th force.
Definition: iDynInv.cpp:2690
iDynSensor(iDyn::iDynChain *_c, unsigned int i, const yarp::sig::Matrix &_H, const yarp::sig::Matrix &_HC, const double _m, const yarp::sig::Matrix &_I, std::string _info, const NewEulMode _mode=DYNAMIC, unsigned int verb=iCub::skinDynLib::NO_VERBOSE)
Constructor with FT sensor.
yarp::sig::Vector getMoment(const unsigned int iLink) const
Returns the i-th link moment.
Definition: iDynInv.cpp:2686
yarp::sig::Matrix getForces() const
Returns the links forces as a matrix, where the i-th col is the i-th force.
Definition: iDynInv.cpp:2678
virtual bool computeFromSensorNewtonEuler(const yarp::sig::Vector &FMu)
The main computation method: given the FT sensor measurements, compute forces moments and torques in ...
virtual bool computeFromSensorNewtonEuler(const yarp::sig::Vector &F, const yarp::sig::Vector &Mu)
The main computation method: given the FT sensor measurements, compute forces moments and torques in ...
yarp::sig::Matrix getMoments() const
Returns the links moments as a matrix, where the i-th col is the i-th moment.
Definition: iDynInv.cpp:2680
virtual yarp::sig::Vector getForceMomentEndEff() const
Returns the end-effector force-moment as a single (6x1) vector.
Definition: iDynInv.cpp:2696
yarp::sig::Vector getTorques() const
Returns the links torque as a vector.
Definition: iDynInv.cpp:2682
const std::string ChainIterationMode_s[2]
Definition: iDynInv.h:70
ChainComputationMode
Definition: iDynInv.h:69
@ KINBWD_WREFWD
Definition: iDynInv.h:69
@ KINFWD_WREBWD
Definition: iDynInv.h:69
@ KINBWD_WREBWD
Definition: iDynInv.h:69
@ KINFWD_WREFWD
Definition: iDynInv.h:69
@ DYNAMIC_W_ROTOR
Definition: iDynInv.h:64
@ DYNAMIC_CORIOLIS_GRAVITY
Definition: iDynInv.h:64
@ DYNAMIC
Definition: iDynInv.h:64
@ STATIC
Definition: iDynInv.h:64
ChainIterationMode
Definition: iDynInv.h:68
@ BACKWARD
Definition: iDynInv.h:68
@ FORWARD
Definition: iDynInv.h:68
const std::string NewEulMode_s[4]
Definition: iDynInv.h:65
const std::string ChainComputationMode_s[4]
Definition: iDynInv.h:71
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.