20 #ifndef __SOT_PATTERN_GENERATOR_H__
21 #define __SOT_PATTERN_GENERATOR_H__
28 #include <pinocchio/fwd.hpp>
33 #include <dynamic-graph/entity.h>
34 #include <dynamic-graph/pool.h>
35 #include <dynamic-graph/signal-ptr.h>
36 #include <dynamic-graph/signal-time-dependent.h>
39 #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;
124 pg::PatternGeneratorInterface *
m_PGI;
286 dynamicgraph::Vector &
getZMPRef(dynamicgraph::Vector &res,
int time);
289 dynamicgraph::Vector &
getCoMRef(dynamicgraph::Vector &res,
int time);
292 dynamicgraph::Vector &
getdCoMRef(dynamicgraph::Vector &res,
int time);
295 dynamicgraph::Vector &
getddCoMRef(dynamicgraph::Vector &res,
int time);
486 pg::FootAbsolutePosition aFootPosition, MatrixHomogeneous &aFootMH,
487 MatrixHomogeneous &adotFootMH);
492 MatrixHomogeneous &aFootMH);
499 pg::FootAbsolutePosition &NextFootPosition,
500 MatrixHomogeneous &FootPositionOut,
501 MatrixHomogeneous &dotFootPositionOut,
502 unsigned int &count);
505 dynamicgraph::Vector &NextPosition,
506 dynamicgraph::Vector &PositionOut,
507 unsigned int &count);
510 pg::FootAbsolutePosition &FootPositionOut);
565 SignalPtr<dynamicgraph::Vector, int>
comSIN;
571 SignalPtr<dynamicgraph::Vector, int>
zmpSIN;
576 SignalTimeDependent<dynamicgraph::Vector, int>
forceSOUT;
684 void addStep(
const double &x,
const double &y,
const double &th);
This class provides dynamically stable CoM, ZMP, feet trajectories. It wraps up the algorithms implem...
Definition: pg.h:84
SignalTimeDependent< dynamicgraph::Vector, int > CoMRefSOUT
Externalize the CoM reference.
Definition: pg.h:558
std::vector< double > m_filterWindow
Definition: pg.h:580
SignalTimeDependent< MatrixHomogeneous, int > InitRightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:660
pg::PatternGeneratorInterface * GetPatternGeneratorInterface()
Give access directly to the pattern generator... You really have to know what your are doing.
Definition: pg.h:260
MatrixHomogeneous & getRightFootRef(MatrixHomogeneous &res, int time)
Internal method to get the position of the right foot.
dynamicgraph::Vector m_WaistAttitude
Waist Attitude.
Definition: pg.h:440
unsigned int m_dataInProcess
true iff the pattern if dealing with data, false if pg is not working anymore/yet.
Definition: pg.h:462
void FromAbsoluteFootPosToDotHomogeneous(pg::FootAbsolutePosition aFootPosition, MatrixHomogeneous &aFootMH, MatrixHomogeneous &adotFootMH)
Transfert from a current absolute foot position to a dot homogeneous matrix.
unsigned int m_count
count for subsampling.
Definition: pg.h:187
void setParamPreviewFile(const std::string &filename)
Set the name of the file specifying the control parameters of the preview control.
SignalTimeDependent< dynamicgraph::Vector, int > ZMPRefSOUT
Externalize the ZMP reference .
Definition: pg.h:555
SignalTimeDependent< MatrixHomogeneous, int > waistattitudematrixabsoluteSOUT
Externalize the absolute waist attitude into a homogeneous matrix.
Definition: pg.h:633
dynamicgraph::Vector & getWaistPosition(dynamicgraph::Vector &res, int time)
Internal method to get the position of the waist.
int & getContactPhase(int &res, int time)
Internal method to get the information of contact phase leftFoot=1, rightFoot=-1, doubleSupport=0.
dynamicgraph::Vector m_initForce
Definition: pg.h:577
MatrixHomogeneous & getFlyingFootRef(MatrixHomogeneous &res, int time)
Internal method to get the position of the flying foot.
dynamicgraph::Vector & getExternalForces(dynamicgraph::Vector &forces, int time)
Internal method to get the external forces at a given time.
dynamicgraph::Vector m_NextSamplingddCOMRefPos
Definition: pg.h:421
SignalTimeDependent< VectorRollPitchYaw, int > waistattitudeabsoluteSOUT
Externalize the absolute waist attitude.
Definition: pg.h:629
std::deque< dynamicgraph::Vector > m_bufferForce
Definition: pg.h:579
dynamicgraph::Vector & getdComAttitude(dynamicgraph::Vector &res, int time)
Internal method to get the derivative of the com attitude.
void ParseCmdFile(std::istringstream &cmdArg, std::ostream &os)
dynamicgraph::Vector m_PrevSamplingddCOMRefPos
Definition: pg.h:420
bool m_feedBackControl
Booleans used to indicate if feedback signals shoul be used or not.
Definition: pg.h:466
SignalPtr< dynamicgraph::Vector, int > forceSIN
Take the current external force applied to the com (fx, fy, fz).
Definition: pg.h:575
std::string m_PreviewControlParametersFile
Some information related to the preview control.
Definition: pg.h:130
MatrixHomogeneous m_FlyingFootPosition
Relative Position of the flying foot.
Definition: pg.h:390
SignalTimeDependent< MatrixHomogeneous, int > RightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:598
SignalTimeDependent< VectorRollPitchYaw, int > waistattitudeSOUT
Externalize the waist attitude.
Definition: pg.h:626
void pgCommandLine(const std::string &cmdline)
dynamicgraph::Vector m_WaistAttitudeAbsolute
Waist Attitude Absolute.
Definition: pg.h:443
int & OneStepOfControl(int &dummy, int time)
Trigger one step of the algorithm.
void SubsamplingFootPos(pg::FootAbsolutePosition &PrevFootPosition, pg::FootAbsolutePosition &NextFootPosition, MatrixHomogeneous &FootPositionOut, MatrixHomogeneous &dotFootPositionOut, unsigned int &count)
dynamicgraph::Vector & getInitZMPRef(dynamicgraph::Vector &res, int time)
Internal method to get the initial reference ZMP at a given time.
SignalTimeDependent< MatrixHomogeneous, int > LeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:595
dynamicgraph::Vector m_WaistPosition
Waist position.
Definition: pg.h:434
void setSRDFFile(const std::string &filename)
Set the path which contains the SRDF files robot's model. More precisely this file describes which jo...
PatternGeneratorJRL::FootAbsolutePosition m_InitLeftFootAbsPos
Definition: pg.h:377
unsigned & getDataInProcess(unsigned &res, int time)
Internal method to get the dataInPorcess flag.
dynamicgraph::Vector m_PrevSamplingWaistAttAbs
Definition: pg.h:444
dynamicgraph::Vector & getjointWalkingErrorPosition(dynamicgraph::Vector &res, int time)
Internal method to get the joint position for walking.
SignalTimeDependent< dynamicgraph::Vector, int > InitCoMRefSOUT
Externalize the initial CoM reference.
Definition: pg.h:648
dynamicgraph::Vector m_InitWaistRefAtt
Definition: pg.h:428
MatrixHomogeneous & getInitRightFootRef(MatrixHomogeneous &res, int time)
Internal method to get the position of the right foot.
int & InitOneStepOfControl(int &dummy, int time)
Trigger the initialization of the algorithm.
bool m_leftFootContact
Definition: pg.h:473
dynamicgraph::Vector m_ddCOMRefPos
Absolute position of the reference ddCoM.
Definition: pg.h:419
void addOnLineStep(const double &x, const double &y, const double &th)
dynamicgraph::Vector & getCoMRef(dynamicgraph::Vector &res, int time)
Internal method to get the reference CoM at a given time.
PatternGeneratorJRL::FootAbsolutePosition m_NextSamplingLeftFootAbsPos
Definition: pg.h:375
int m_DSStartingTime
Definition: pg.h:181
void SubsamplingVector(dynamicgraph::Vector &PrevPosition, dynamicgraph::Vector &NextPosition, dynamicgraph::Vector &PositionOut, unsigned int &count)
DYNAMIC_GRAPH_ENTITY_DECL()
SignalTimeDependent< MatrixHomogeneous, int > FlyingFootRefSOUT
Externalize the foot which is not considered as support foot, the information are given in a relative...
Definition: pg.h:608
double m_AnkleSoilDistance
Distance between ankle and soil.
Definition: pg.h:173
pg::PinocchioRobot * m_PR
Pointer towards the robot model inside jrl-walkgen.
Definition: pg.h:120
bool m_init
Boolean variable to initialize the object by loading an object.
Definition: pg.h:159
pinocchio::Data * m_robotData
The pointor toward the robot data.
Definition: pg.h:122
int stringToReferenceEnum(const std::string &FrameReference)
SignalPtr< dynamicgraph::Vector, int > zmpSIN
Take the current zmp (x, y, z).
Definition: pg.h:571
std::string m_srdfFile
Directory+Name where the SRDF file of the robot's model is located.
Definition: pg.h:138
void useFeedBackSignals(const bool &feedBack)
int m_ReferenceFrame
Keep the frame reference.
Definition: pg.h:170
double m_TimeStep
Time step.
Definition: pg.h:176
dynamicgraph::Vector & getInitWaistPosRef(dynamicgraph::Vector &res, int time)
Internal method to get the initial reference CoM at a given time.
VectorRollPitchYaw & getWaistAttitudeAbsolute(VectorRollPitchYaw &res, int time)
Internal method to get the absolute attitude of the waist.
MatrixHomogeneous & getdotRightFootRef(MatrixHomogeneous &res, int time)
Internal method to get the derivative of the right foot.
SignalTimeDependent< dynamicgraph::Vector, int > comattitudeSOUT
Externalize the com attitude.
Definition: pg.h:617
bool addComplementaryFrames()
Add complementary frame.
bool & getLeftFootContact(bool &res, int time)
Internal method to get the information of contact or not on the feet.
bool buildPGI(void)
Build the pattern generator interface from the parameter "/robot_description" and the informations in...
std::string m_right_ankle_body_name
Definition: pg.h:195
pg::PatternGeneratorInterface * m_PGI
Pointer towards the interface of the pattern generator.
Definition: pg.h:124
dynamicgraph::Vector m_WaistPositionAbsolute
Waist position Absolute.
Definition: pg.h:437
SignalTimeDependent< dynamicgraph::Vector, int > dcomattitudeSOUT
Externalize the dcom attitude.
Definition: pg.h:620
void setReferenceFromString(const std::string &str)
dynamicgraph::Vector m_JointErrorValuesForWalking
Joint values for walking.
Definition: pg.h:451
bool & getRightFootContact(bool &res, int time)
int m_SupportFoot
Integer for the support foot.
Definition: pg.h:167
SignalTimeDependent< unsigned int, int > dataInProcessSOUT
true iff PG is processing. Use it for synchronize.
Definition: pg.h:642
SignalPtr< dynamicgraph::Vector, int > comStateSIN
Take the current CoM state (pos, vel, acc).
Definition: pg.h:568
pinocchio::Model m_robotModel
The model of the robot.
Definition: pg.h:118
Eigen::VectorXd m_ZMPPrevious
Definition: pg.h:677
dynamicgraph::Vector m_NextSamplingWaistAttAbs
Definition: pg.h:445
SignalTimeDependent< Dummy, int > firstSINTERN
Internal signal for initialization and one shot signals.
Definition: pg.h:274
PatternGeneratorJRL::FootAbsolutePosition m_PrevSamplingRightFootAbsPos
Definition: pg.h:372
int Dummy
Definition: pg.h:262
dynamicgraph::Vector m_PrevSamplingCOMRefPos
Definition: pg.h:410
void setSoleParameters(const double &inSoleLength, const double &inSoleWidth)
Set the foot parameters.
void addJointMapping(const std::string &link, const std::string &repName)
Set mapping between a link and actual robot name.
SignalPtr< MatrixHomogeneous, int > LeftFootCurrentPosSIN
Take the current left foot homogeneous position.
Definition: pg.h:589
bool m_InitPositionByRealState
Boolean variable to initialize the position: first through the real state of the robot,...
Definition: pg.h:164
std::string m_urdfFile
Directory+Name where the URDF file of the robot's model is located.
Definition: pg.h:134
dynamicgraph::Vector m_ddComAttitude
ddCom Attitude: does not really exist apart when the robot is seen as an inverted pendulum
Definition: pg.h:406
dynamicgraph::Vector m_dCOMRefPos
Absolute position of the reference dCoM.
Definition: pg.h:414
SignalTimeDependent< dynamicgraph::Vector, int > waistpositionabsoluteSOUT
Externalize the absolute waist position.
Definition: pg.h:639
SignalTimeDependent< dynamicgraph::Vector, int > InitZMPRefSOUT
Externalize the initial ZMP reference .
Definition: pg.h:645
std::vector< unsigned > m_wrml2urdfIndex
Definition: pg.h:144
MatrixHomogeneous m_dotLeftFootPosition
Absolute Derivate for the left and right feet.
Definition: pg.h:380
MatrixHomogeneous m_WaistAttitudeMatrixAbsolute
Waist Attitude Homogeneous Matrix.
Definition: pg.h:448
dynamicgraph::Vector m_dComAttitude
dCom Attitude: does not really exist apart when the robot is seen as an inverted pendulum
Definition: pg.h:402
SignalTimeDependent< dynamicgraph::Vector, int > ddcomattitudeSOUT
Externalize the ddcom attitude.
Definition: pg.h:623
double m_soleLength
Lenght of the sole.
Definition: pg.h:147
dynamicgraph::Vector & getInitCoMRef(dynamicgraph::Vector &res, int time)
Internal method to get the initial reference CoM at a given time.
SignalTimeDependent< int, int > contactPhaseSOUT
Int Vector of support phase: leftFoot=1, rightFoot=-1, doubleSupport=0 (see enum).
Definition: pg.h:669
bool m_forceFeedBack
Booleans used to indicate if force feedback signals shoul be used or not.
Definition: pg.h:470
std::string m_left_ankle_body_name
Definition: pg.h:192
SignalTimeDependent< dynamicgraph::Vector, int > InitWaistPosRefSOUT
Externalize the initial Waist reference.
Definition: pg.h:651
int m_LocalTime
iteration time.
Definition: pg.h:184
void setURDFFile(const std::string &filename)
Set the path which contains the URDF files robot's model.
SignalTimeDependent< dynamicgraph::Vector, int > ddCoMRefSOUT
Definition: pg.h:563
SignalPtr< dynamicgraph::Vector, int > motorControlJointPositionSIN
Motor control joint position values.
Definition: pg.h:549
dynamicgraph::Vector & getZMPRef(dynamicgraph::Vector &res, int time)
Internal method to get the reference ZMP at a given time.
dynamicgraph::Vector m_ZMPRefPos
Absolute position of the reference ZMP.
Definition: pg.h:393
SignalTimeDependent< dynamicgraph::Vector, int > dCoMRefSOUT
Externalize the CoM reference.
Definition: pg.h:561
MatrixHomogeneous m_InitLeftFootPosition
Initial Absolute Starting Position for the left and right feet.
Definition: pg.h:384
SignalTimeDependent< VectorRollPitchYaw, int > InitWaistAttRefSOUT
Externalize the initial Waist reference.
Definition: pg.h:654
dynamicgraph::Vector & getdCoMRef(dynamicgraph::Vector &res, int time)
Internal method to get the reference dCoM at a given time.
SignalPtr< MatrixHomogeneous, int > RightFootCurrentPosSIN
Take the current right foot homogeneous position.
Definition: pg.h:592
dynamicgraph::Vector m_InitZMPRefPos
Initial Absolute position of the reference ZMP.
Definition: pg.h:424
PatternGeneratorJRL::FootAbsolutePosition m_NextSamplingRightFootAbsPos
Definition: pg.h:374
SignalTimeDependent< bool, int > rightFootContactSOUT
Definition: pg.h:664
virtual ~PatternGenerator(void)
Default destructor.
MatrixHomogeneous & getdotLeftFootRef(MatrixHomogeneous &res, int time)
Internal method to get the derivative of the left foot.
std::string m_right_wrist_body_name
Definition: pg.h:201
MatrixHomogeneous & getWaistAttitudeMatrixAbsolute(MatrixHomogeneous &res, int time)
Internal method to get the absolute attitude of the waist into an homogeneous matrix.
void getAbsoluteWaistPosAttHomogeneousMatrix(MatrixHomogeneous &aWaistMH)
Provide an homogeneous matrix from the current waist position and attitude.
SignalPtr< dynamicgraph::Vector, int > ZMPPreviousControllerSIN
Previous ZMP value (ZMP send by the preceding controller).
Definition: pg.h:552
SignalTimeDependent< MatrixHomogeneous, int > InitLeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:657
SignalTimeDependent< int, int > SupportFootSOUT
Externalize the support foot.
Definition: pg.h:611
dynamicgraph::Vector m_InitCOMRefPos
Initial Absolute position of the reference CoM.
Definition: pg.h:431
bool m_trigger
trigger to start walking
Definition: pg.h:457
dynamicgraph::Vector m_ComAttitude
Com Attitude: does not really exist apart from when the robot is seen as an inverted pendulum.
Definition: pg.h:398
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:368
PatternGenerator(const std::string &name="PatternGenerator")
Default constructor.
dynamicgraph::Vector & getComAttitude(dynamicgraph::Vector &res, int time)
Internal method to get the attitude of the com.
SignalTimeDependent< bool, int > leftFootContactSOUT
Booleans for contact of the feet.
Definition: pg.h:663
std::string m_xmlRankFile
Directory+Name where the Rank of the joints are notified.
Definition: pg.h:142
dynamicgraph::Vector m_PrevSamplingdCOMRefPos
Definition: pg.h:415
SignalPtr< dynamicgraph::Vector, int > comSIN
Take the current CoM.
Definition: pg.h:565
SignalTimeDependent< MatrixHomogeneous, int > dotRightFootRefSOUT
Externalize the right foot position reference.
Definition: pg.h:604
VectorRollPitchYaw & getWaistAttitude(VectorRollPitchYaw &res, int time)
Internal method to get the attitude of the waist.
SignalTimeDependent< dynamicgraph::Vector, int > waistpositionSOUT
Externalize the waist position.
Definition: pg.h:636
SignalTimeDependent< dynamicgraph::Vector, int > jointWalkingErrorPositionSOUT
Externalize the joint values for walking.
Definition: pg.h:614
std::string m_left_wrist_body_name
Definition: pg.h:198
void useDynamicFilter(const bool &dynamicFilter)
dynamicgraph::Vector m_COMRefPos
Absolute position of the reference CoM.
Definition: pg.h:409
bool InitState(void)
Initialize the state of the robot.
dynamicgraph::Vector m_NextSamplingCOMRefPos
Definition: pg.h:411
SignalPtr< dynamicgraph::Vector, int > jointPositionSIN
Real state position values.
Definition: pg.h:546
dynamicgraph::Vector m_VelocityReference
Velocity reference for Herdt's PG.
Definition: pg.h:454
MatrixHomogeneous m_MotionSinceInstanciationToThisSequence
Keep track of the motion between sequence of motions.
Definition: pg.h:387
bool buildReducedModel(void)
Build the reduced model.
void addStep(const double &x, const double &y, const double &th)
void setXmlRankFile(const std::string &filename)
Set the path which contains the Joint Rank model.
void setPreviewControlParametersFile(const std::string &filename)
Set the directory which contains the parameters for the preview control.
PatternGeneratorJRL::FootAbsolutePosition m_PrevSamplingLeftFootAbsPos
Definition: pg.h:373
void CopyFootPosition(pg::FootAbsolutePosition &FootPositionIn, pg::FootAbsolutePosition &FootPositionOut)
SupportPhase m_ContactPhase
Current support/contact phase defined by enum: leftFoot=1, rightFoot=-1, doubleSupport=0.
Definition: pg.h:180
int & getSupportFoot(int &res, int time)
Getting the current support foot: 1 Left -1 Right.
PatternGeneratorJRL::FootAbsolutePosition m_InitRightFootAbsPos
Definition: pg.h:376
void FromAbsoluteFootPosToHomogeneous(pg::FootAbsolutePosition aFootPosition, MatrixHomogeneous &aFootMH)
Transfert from a current absolute foot position to a homogeneous matrix.
SignalPtr< bool, int > triggerSIN
Take the current trigger to start OneStepOfControl.
Definition: pg.h:586
SignalPtr< dynamicgraph::Vector, int > velocitydesSIN
Take the current desired velocity.
Definition: pg.h:583
SignalTimeDependent< dynamicgraph::Vector, int > forceSOUT
Definition: pg.h:576
dynamicgraph::Vector & getddCoMRef(dynamicgraph::Vector &res, int time)
Internal method to get the reference ddCoM at a given time.
std::map< std::string, std::string > specialJoints_
Definition: pg.h:153
SignalTimeDependent< Dummy, int > OneStepOfControlS
Internal signal to trigger one step of the algorithm.
Definition: pg.h:277
MatrixHomogeneous m_LeftFootPosition
Absolute Position for the left and right feet.
Definition: pg.h:371
MatrixHomogeneous & getLeftFootRef(MatrixHomogeneous &res, int time)
Internal method to get the position of the left foot.
dynamicgraph::Vector & getWaistPositionAbsolute(dynamicgraph::Vector &res, int time)
Internal method to get the absolute position of the waist.
void readFootParameters(std::string &rootFootPath, pg::PRFoot &aFoot)
readFootParameters
dynamicgraph::Vector m_NextSamplingdCOMRefPos
Definition: pg.h:416
SignalTimeDependent< MatrixHomogeneous, int > dotLeftFootRefSOUT
Externalize the left foot position reference.
Definition: pg.h:601
dynamicgraph::Vector & getddComAttitude(dynamicgraph::Vector &res, int time)
Internal method to get the second derivative of the com attitude.
dynamicgraph::Vector m_currentForces
Definition: pg.h:578
MatrixHomogeneous & getInitLeftFootRef(MatrixHomogeneous &res, int time)
Internal method to get the position of the left foot.
double m_soleWidth
Width of the sole.
Definition: pg.h:150
VectorRollPitchYaw & getInitWaistAttRef(VectorRollPitchYaw &res, int time)
Internal method to get the initial reference CoM at a given time.
SupportPhase
Define the support phase of the robot.
Definition: pg.h:66
@ LEFT_SUPPORT_PHASE
Definition: pg.h:68
@ DOUBLE_SUPPORT_PHASE
Definition: pg.h:67
@ RIGHT_SUPPORT_PHASE
Definition: pg.h:69
Definition: exception-pg.h:47
#define PatternGenerator_EXPORT
Definition: pg.h:59