20 #ifndef __SOT_PATTERN_GENERATOR_H__ 21 #define __SOT_PATTERN_GENERATOR_H__ 30 #include <pinocchio/fwd.hpp> 34 #include <dynamic-graph/entity.h> 35 #include <dynamic-graph/pool.h> 36 #include <dynamic-graph/signal-ptr.h> 37 #include <dynamic-graph/signal-time-dependent.h> 38 #include <pinocchio/fwd.hpp> 40 #include <sot/core/flags.hh> 41 #include <sot/core/matrix-geometry.hh> 44 #include <jrl/walkgen/patterngeneratorinterface.hh> 45 #include <jrl/walkgen/pinocchiorobot.hh> 46 namespace pg = PatternGeneratorJRL;
53 #if defined(pg_EXPORTS) 54 #define PatternGenerator_EXPORT __declspec(dllexport) 56 #define PatternGenerator_EXPORT __declspec(dllimport) 59 #define PatternGenerator_EXPORT 87 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
95 static const int WORLD_FRAME = 0;
99 static const int EGOCENTERED_FRAME = 1;
103 static const int LEFT_FOOT_CENTERED_FRAME = 2;
107 static const int WAIST_CENTERED_FRAME = 3;
114 DYNAMIC_GRAPH_ENTITY_DECL();
124 pg::PatternGeneratorInterface *
m_PGI;
220 bool addComplementaryFrames();
223 bool buildReducedModel(
void);
226 void readFootParameters(std::string &rootFootPath, pg::PRFoot &aFoot);
229 bool InitState(
void);
233 void setPreviewControlParametersFile(
const std::string &filename);
236 void setURDFFile(
const std::string &filename);
242 void setSRDFFile(
const std::string &filename);
245 void setXmlRankFile(
const std::string &filename);
249 void setParamPreviewFile(
const std::string &filename);
252 void setSoleParameters(
const double &inSoleLength,
const double &inSoleWidth);
255 void addJointMapping(
const std::string &link,
const std::string &repName);
285 dynamicgraph::Vector &getZMPRef(dynamicgraph::Vector &res,
int time);
288 dynamicgraph::Vector &getCoMRef(dynamicgraph::Vector &res,
int time);
291 dynamicgraph::Vector &getdCoMRef(dynamicgraph::Vector &res,
int time);
294 dynamicgraph::Vector &getddCoMRef(dynamicgraph::Vector &res,
int time);
297 dynamicgraph::Vector &getExternalForces(dynamicgraph::Vector &forces,
301 MatrixHomogeneous &getLeftFootRef(MatrixHomogeneous &res,
int time);
304 MatrixHomogeneous &getRightFootRef(MatrixHomogeneous &res,
int time);
307 MatrixHomogeneous &getdotLeftFootRef(MatrixHomogeneous &res,
int time);
310 MatrixHomogeneous &getdotRightFootRef(MatrixHomogeneous &res,
int time);
313 MatrixHomogeneous &getFlyingFootRef(MatrixHomogeneous &res,
int time);
316 dynamicgraph::Vector &getjointWalkingErrorPosition(dynamicgraph::Vector &res,
320 dynamicgraph::Vector &getdComAttitude(dynamicgraph::Vector &res,
int time);
324 dynamicgraph::Vector &getddComAttitude(dynamicgraph::Vector &res,
int time);
327 dynamicgraph::Vector &getComAttitude(dynamicgraph::Vector &res,
int time);
330 VectorRollPitchYaw &getWaistAttitude(VectorRollPitchYaw &res,
int time);
333 VectorRollPitchYaw &getWaistAttitudeAbsolute(VectorRollPitchYaw &res,
338 MatrixHomogeneous &getWaistAttitudeMatrixAbsolute(MatrixHomogeneous &res,
342 unsigned &getDataInProcess(
unsigned &res,
int time);
345 dynamicgraph::Vector &getWaistPosition(dynamicgraph::Vector &res,
int time);
348 dynamicgraph::Vector &getWaistPositionAbsolute(dynamicgraph::Vector &res,
354 int &getSupportFoot(
int &res,
int time);
357 int &InitOneStepOfControl(
int &dummy,
int time);
359 int &OneStepOfControl(
int &dummy,
int time);
372 m_PrevSamplingLeftFootAbsPos;
374 m_NextSamplingLeftFootAbsPos;
376 m_InitLeftFootAbsPos;
480 void ParseCmdFile(std::istringstream &cmdArg, std::ostream &os);
484 void FromAbsoluteFootPosToDotHomogeneous(
485 pg::FootAbsolutePosition aFootPosition, MatrixHomogeneous &aFootMH,
486 MatrixHomogeneous &adotFootMH);
490 void FromAbsoluteFootPosToHomogeneous(pg::FootAbsolutePosition aFootPosition,
491 MatrixHomogeneous &aFootMH);
495 void getAbsoluteWaistPosAttHomogeneousMatrix(MatrixHomogeneous &aWaistMH);
497 void SubsamplingFootPos(pg::FootAbsolutePosition &PrevFootPosition,
498 pg::FootAbsolutePosition &NextFootPosition,
499 MatrixHomogeneous &FootPositionOut,
500 MatrixHomogeneous &dotFootPositionOut,
501 unsigned int &count);
503 void SubsamplingVector(dynamicgraph::Vector &PrevPosition,
504 dynamicgraph::Vector &NextPosition,
505 dynamicgraph::Vector &PositionOut,
506 unsigned int &count);
508 void CopyFootPosition(pg::FootAbsolutePosition &FootPositionIn,
509 pg::FootAbsolutePosition &FootPositionOut);
513 dynamicgraph::Vector &getInitZMPRef(dynamicgraph::Vector &res,
int time);
517 dynamicgraph::Vector &getInitCoMRef(dynamicgraph::Vector &res,
int time);
521 dynamicgraph::Vector &getInitWaistPosRef(dynamicgraph::Vector &res,
int time);
525 VectorRollPitchYaw &getInitWaistAttRef(VectorRollPitchYaw &res,
int time);
528 MatrixHomogeneous &getInitLeftFootRef(MatrixHomogeneous &res,
int time);
531 MatrixHomogeneous &getInitRightFootRef(MatrixHomogeneous &res,
int time);
535 bool &getLeftFootContact(
bool &res,
int time);
536 bool &getRightFootContact(
bool &res,
int time);
538 int &getContactPhase(
int &res,
int time);
563 SignalPtr<dynamicgraph::Vector, int>
comSIN;
569 SignalPtr<dynamicgraph::Vector, int>
zmpSIN;
574 SignalTimeDependent<dynamicgraph::Vector, int>
forceSOUT;
677 void initCommands(
void);
678 int stringToReferenceEnum(
const std::string &FrameReference);
679 void setReferenceFromString(
const std::string &str);
680 void addOnLineStep(
const double &x,
const double &y,
const double &th);
681 void addStep(
const double &x,
const double &y,
const double &th);
682 void pgCommandLine(
const std::string &cmdline);
683 void useFeedBackSignals(
const bool &feedBack);
684 void useDynamicFilter(
const bool &dynamicFilter);
692 #endif // #ifndef __SOT_PATTERN_GENERATOR_H__ Eigen::VectorXd m_ZMPPrevious
Definition: pg.h:674
SignalTimeDependent< unsigned int, int > dataInProcessSOUT
true iff PG is processing. Use it for synchronize.
Definition: pg.h:640
double m_AnkleSoilDistance
Distance between ankle and soil.
Definition: pg.h:173
SignalTimeDependent< dynamicgraph::Vector, int > comattitudeSOUT
Externalize the com attitude.
Definition: pg.h:615
std::string m_right_wrist_body_name
Definition: pg.h:200
SignalTimeDependent< MatrixHomogeneous, int > dotLeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:599
dynamicgraph::Vector m_ZMPRefPos
Absolute position of the reference ZMP.
Definition: pg.h:392
SignalTimeDependent< dynamicgraph::Vector, int > dcomattitudeSOUT
Externalize the dcom attitude.
Definition: pg.h:618
SignalTimeDependent< int, int > SupportFootSOUT
Externalize the support foot.
Definition: pg.h:609
MatrixHomogeneous m_RightFootPosition
Definition: pg.h:370
SignalPtr< dynamicgraph::Vector, int > jointPositionSIN
Real state position values.
Definition: pg.h:544
std::string m_right_ankle_body_name
Definition: pg.h:194
MatrixHomogeneous m_k_Waist_kp1
Rigit motion between two waist positions at the beginning of the walking and at the end of the walkin...
Definition: pg.h:367
PatternGeneratorJRL::FootAbsolutePosition m_NextSamplingRightFootAbsPos
Definition: pg.h:373
pg::PatternGeneratorInterface * GetPatternGeneratorInterface()
Give access directly to the pattern generator... You really have to know what your are doing...
Definition: pg.h:259
dynamicgraph::Vector m_dComAttitude
dCom Attitude: does not really exist apart when the robot is seen as an inverted pendulum ...
Definition: pg.h:401
int m_LocalTime
iteration time.
Definition: pg.h:183
#define PatternGenerator_EXPORT
Definition: pg.h:59
dynamicgraph::Vector m_PrevSamplingWaistAttAbs
Definition: pg.h:443
SignalTimeDependent< VectorRollPitchYaw, int > InitWaistAttRefSOUT
Externalize the initial Waist reference.
Definition: pg.h:652
dynamicgraph::Vector m_WaistAttitude
Waist Attitude.
Definition: pg.h:439
SignalTimeDependent< dynamicgraph::Vector, int > CoMRefSOUT
Externalize the CoM reference.
Definition: pg.h:556
pinocchio::Data * m_robotData
The pointor toward the robot data.
Definition: pg.h:122
MatrixHomogeneous m_dotRightFootPosition
Definition: pg.h:379
SignalPtr< dynamicgraph::Vector, int > comStateSIN
Take the current CoM state (pos, vel, acc).
Definition: pg.h:566
SupportPhase m_ContactPhase
Current support/contact phase defined by enum: leftFoot=1, rightFoot=-1, doubleSupport=0.
Definition: pg.h:179
SignalTimeDependent< MatrixHomogeneous, int > LeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:593
pinocchio::Model m_robotModel
The model of the robot.
Definition: pg.h:118
dynamicgraph::Vector m_WaistPosition
Waist position.
Definition: pg.h:433
std::string m_srdfFile
Directory+Name where the SRDF file of the robot's model is located.
Definition: pg.h:138
SignalTimeDependent< bool, int > leftFootContactSOUT
Booleans for contact of the feet.
Definition: pg.h:661
dynamicgraph::Vector m_currentForces
Definition: pg.h:576
SignalTimeDependent< MatrixHomogeneous, int > InitRightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:658
int m_SupportFoot
Integer for the support foot.
Definition: pg.h:167
bool m_trigger
trigger to start walking
Definition: pg.h:456
dynamicgraph::Vector m_dCOMRefPos
Absolute position of the reference dCoM.
Definition: pg.h:413
SignalTimeDependent< VectorRollPitchYaw, int > waistattitudeSOUT
Externalize the waist attitude.
Definition: pg.h:624
PatternGeneratorJRL::FootAbsolutePosition m_InitRightFootAbsPos
Definition: pg.h:375
unsigned int m_dataInProcess
true iff the pattern if dealing with data, false if pg is not working anymore/yet.
Definition: pg.h:461
dynamicgraph::Vector m_InitCOMRefPos
Initial Absolute position of the reference CoM.
Definition: pg.h:430
dynamicgraph::Vector m_PrevSamplingddCOMRefPos
Definition: pg.h:419
dynamicgraph::Vector m_WaistPositionAbsolute
Waist position Absolute.
Definition: pg.h:436
This class provides dynamically stable CoM, ZMP, feet trajectories. It wraps up the algorithms implem...
Definition: pg.h:84
bool m_feedBackControl
Booleans used to indicate if feedback signals shoul be used or not.
Definition: pg.h:465
bool m_init
Boolean variable to initialize the object by loading an object.
Definition: pg.h:159
dynamicgraph::Vector m_COMRefPos
Absolute position of the reference CoM.
Definition: pg.h:408
std::deque< dynamicgraph::Vector > m_bufferForce
Definition: pg.h:577
dynamicgraph::Vector m_NextSamplingdCOMRefPos
Definition: pg.h:415
pg::PinocchioRobot * m_PR
Pointer towards the robot model inside jrl-walkgen.
Definition: pg.h:120
SignalTimeDependent< Dummy, int > OneStepOfControlS
Internal signal to trigger one step of the algorithm.
Definition: pg.h:276
SignalTimeDependent< VectorRollPitchYaw, int > waistattitudeabsoluteSOUT
Externalize the absolute waist attitude.
Definition: pg.h:627
dynamicgraph::Vector m_PrevSamplingCOMRefPos
Definition: pg.h:409
dynamicgraph::Vector m_NextSamplingCOMRefPos
Definition: pg.h:410
SignalTimeDependent< dynamicgraph::Vector, int > ddcomattitudeSOUT
Externalize the ddcom attitude.
Definition: pg.h:621
dynamicgraph::Vector m_NextSamplingddCOMRefPos
Definition: pg.h:420
std::map< std::string, std::string > specialJoints_
Definition: pg.h:153
SignalTimeDependent< dynamicgraph::Vector, int > waistpositionSOUT
Externalize the waist position.
Definition: pg.h:634
dynamicgraph::Vector m_NextSamplingWaistAttAbs
Definition: pg.h:444
SignalTimeDependent< MatrixHomogeneous, int > dotRightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:602
SignalPtr< MatrixHomogeneous, int > RightFootCurrentPosSIN
Take the current right foot homogeneous position.
Definition: pg.h:590
SignalPtr< dynamicgraph::Vector, int > motorControlJointPositionSIN
Motor control joint position values.
Definition: pg.h:547
std::string m_PreviewControlParametersFile
Some information related to the preview control.
Definition: pg.h:130
SignalTimeDependent< dynamicgraph::Vector, int > ddCoMRefSOUT
Definition: pg.h:561
int m_DSStartingTime
Definition: pg.h:180
SignalTimeDependent< bool, int > rightFootContactSOUT
Definition: pg.h:662
dynamicgraph::Vector m_InitZMPRefPos
Initial Absolute position of the reference ZMP.
Definition: pg.h:423
SignalTimeDependent< dynamicgraph::Vector, int > forceSOUT
Definition: pg.h:574
PatternGeneratorJRL::FootAbsolutePosition m_PrevSamplingRightFootAbsPos
Definition: pg.h:371
unsigned int m_count
count for subsampling.
Definition: pg.h:186
int m_ReferenceFrame
Keep the frame reference.
Definition: pg.h:170
SignalPtr< dynamicgraph::Vector, int > velocitydesSIN
Take the current desired velocity.
Definition: pg.h:581
MatrixHomogeneous m_FlyingFootPosition
Relative Position of the flying foot.
Definition: pg.h:389
std::string m_left_wrist_body_name
Definition: pg.h:197
SignalTimeDependent< dynamicgraph::Vector, int > jointWalkingErrorPositionSOUT
Externalize the joint values for walking.
Definition: pg.h:612
SignalTimeDependent< dynamicgraph::Vector, int > ZMPRefSOUT
Externalize the ZMP reference .
Definition: pg.h:553
dynamicgraph::Vector m_VelocityReference
Velocity reference for Herdt's PG.
Definition: pg.h:453
double m_soleWidth
Width of the sole.
Definition: pg.h:150
dynamicgraph::Vector m_ComAttitude
Com Attitude: does not really exist apart from when the robot is seen as an inverted pendulum...
Definition: pg.h:397
dynamicgraph::Vector m_WaistAttitudeAbsolute
Waist Attitude Absolute.
Definition: pg.h:442
SignalPtr< dynamicgraph::Vector, int > zmpSIN
Take the current zmp (x, y, z).
Definition: pg.h:569
SupportPhase
Define the support phase of the robot.
Definition: pg.h:66
bool m_forceFeedBack
Booleans used to indicate if force feedback signals shoul be used or not.
Definition: pg.h:469
SignalPtr< dynamicgraph::Vector, int > ZMPPreviousControllerSIN
Previous ZMP value (ZMP send by the preceding controller).
Definition: pg.h:550
SignalPtr< MatrixHomogeneous, int > LeftFootCurrentPosSIN
Take the current left foot homogeneous position.
Definition: pg.h:587
SignalTimeDependent< MatrixHomogeneous, int > InitLeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:655
MatrixHomogeneous m_MotionSinceInstanciationToThisSequence
Keep track of the motion between sequence of motions.
Definition: pg.h:386
std::string m_left_ankle_body_name
Definition: pg.h:191
SignalPtr< dynamicgraph::Vector, int > comSIN
Take the current CoM.
Definition: pg.h:563
SignalPtr< dynamicgraph::Vector, int > forceSIN
Take the current external force applied to the com (fx, fy, fz).
Definition: pg.h:573
dynamicgraph::Vector m_ddComAttitude
ddCom Attitude: does not really exist apart when the robot is seen as an inverted pendulum ...
Definition: pg.h:405
SignalTimeDependent< MatrixHomogeneous, int > FlyingFootRefSOUT
Externalize the foot which is not considered as support foot, the information are given in a relative...
Definition: pg.h:606
std::vector< unsigned > m_wrml2urdfIndex
Definition: pg.h:144
SignalTimeDependent< int, int > contactPhaseSOUT
Int Vector of support phase: leftFoot=1, rightFoot=-1, doubleSupport=0 (see enum).
Definition: pg.h:666
std::string m_urdfFile
Directory+Name where the URDF file of the robot's model is located.
Definition: pg.h:134
SignalTimeDependent< dynamicgraph::Vector, int > waistpositionabsoluteSOUT
Externalize the absolute waist position.
Definition: pg.h:637
bool m_InitPositionByRealState
Boolean variable to initialize the position: first through the real state of the robot, then through the motor command.
Definition: pg.h:164
double m_TimeStep
Time step.
Definition: pg.h:176
dynamicgraph::Vector m_JointErrorValuesForWalking
Joint values for walking.
Definition: pg.h:450
dynamicgraph::Vector m_PrevSamplingdCOMRefPos
Definition: pg.h:414
std::string m_xmlRankFile
Directory+Name where the Rank of the joints are notified.
Definition: pg.h:142
SignalTimeDependent< dynamicgraph::Vector, int > dCoMRefSOUT
Externalize the CoM reference.
Definition: pg.h:559
double m_soleLength
Lenght of the sole.
Definition: pg.h:147
dynamicgraph::Vector m_InitWaistRefPos
Initial Absolute position and attitude of the reference Waist.
Definition: pg.h:427
SignalPtr< bool, int > triggerSIN
Take the current trigger to start OneStepOfControl.
Definition: pg.h:584
SignalTimeDependent< MatrixHomogeneous, int > waistattitudematrixabsoluteSOUT
Externalize the absolute waist attitude into a homogeneous matrix.
Definition: pg.h:631
dynamicgraph::Vector m_ddCOMRefPos
Absolute position of the reference ddCoM.
Definition: pg.h:418
SignalTimeDependent< dynamicgraph::Vector, int > InitCoMRefSOUT
Externalize the initial CoM reference.
Definition: pg.h:646
SignalTimeDependent< dynamicgraph::Vector, int > InitZMPRefSOUT
Externalize the initial ZMP reference .
Definition: pg.h:643
MatrixHomogeneous m_InitRightFootPosition
Definition: pg.h:383
std::vector< double > m_filterWindow
Definition: pg.h:578
SignalTimeDependent< dynamicgraph::Vector, int > InitWaistPosRefSOUT
Externalize the initial Waist reference.
Definition: pg.h:649
MatrixHomogeneous m_WaistAttitudeMatrixAbsolute
Waist Attitude Homogeneous Matrix.
Definition: pg.h:447
dynamicgraph::Vector m_initForce
Definition: pg.h:575
SignalTimeDependent< Dummy, int > firstSINTERN
Internal signal for initialization and one shot signals.
Definition: pg.h:273
SignalTimeDependent< MatrixHomogeneous, int > RightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:596
bool m_rightFootContact
Booleans used to indicate feet contacts.
Definition: pg.h:472
Definition: exception-pg.h:47
pg::PatternGeneratorInterface * m_PGI
Pointer towards the interface of the pattern generator.
Definition: pg.h:124