sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
joint-trajectory-entity.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2013,
3  * Olivier Stasse,
4  *
5  * CNRS
6  *
7  */
8 
9 #ifndef SOT_JOINT_TRAJECTORY_ENTITY_HH
10 #define SOT_JOINT_TRAJECTORY_ENTITY_HH
11 
12 #include <deque>
13 #include <list>
14 
15 // Maal
16 #include <dynamic-graph/linear-algebra.h>
17 
18 // SOT
19 #include <dynamic-graph/all-signals.h>
20 #include <dynamic-graph/entity.h>
21 
23 #include <sot/core/trajectory.hh>
24 #include <sstream>
25 // API
26 
27 #if defined(WIN32)
28 #if defined(joint_trajectory_entity_EXPORTS)
29 #define SOTJOINT_TRAJECTORY_ENTITY_EXPORT __declspec(dllexport)
30 #else
31 #define SOTJOINT_TRAJECTORY_ENTITY_EXPORT __declspec(dllimport)
32 #endif
33 #else
34 #define SOTJOINT_TRAJECTORY_ENTITY_EXPORT
35 #endif
36 
37 // Class
38 
39 namespace dynamicgraph {
40 namespace sot {
41 
48  : public dynamicgraph::Entity {
49  public:
51 
53  SotJointTrajectoryEntity(const std::string &name);
55 
56  void loadFile(const std::string &name);
57 
59  dynamicgraph::Vector &getNextPosition(dynamicgraph::Vector &pos,
60  const int &time);
61 
63  dynamicgraph::Vector &getNextCoM(dynamicgraph::Vector &com, const int &time);
64 
66  dynamicgraph::Vector &getNextCoP(dynamicgraph::Vector &cop, const int &time);
67 
70  const int &time);
71 
73  unsigned int &getSeqId(unsigned int &seqid, const int &time);
74 
77  const dynamicgraph::Vector &xyztheta);
78 
80  int &OneStepOfUpdate(int &dummy, const int &time);
81 
84  virtual void display(std::ostream &os) const;
86  friend std::ostream &operator<<(std::ostream &os,
87  const SotJointTrajectoryEntity &r) {
88  r.display(os);
89  return os;
90  }
92 
93  public:
94  typedef int Dummy;
95 
99  dynamicgraph::SignalTimeDependent<int, int> refresherSINTERN;
100 
102  SignalTimeDependent<Dummy, int> OneStepOfUpdateS;
103 
105  dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> positionSOUT;
106 
108  dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> comSOUT;
109 
111  dynamicgraph::SignalTimeDependent<dynamicgraph::Vector, int> zmpSOUT;
112 
114  dynamicgraph::SignalTimeDependent<sot::MatrixHomogeneous, int> waistSOUT;
115 
117  dynamicgraph::SignalTimeDependent<unsigned int, int> seqIdSOUT;
118 
120  dynamicgraph::SignalPtr<Trajectory, int> trajectorySIN;
122 
123  protected:
125  std::deque<sot::Trajectory>::size_type index_;
126 
129 
131  dynamicgraph::Vector pose_;
132 
134  dynamicgraph::Vector com_;
135 
137  dynamicgraph::Vector cop_;
138 
141 
143  unsigned int seqid_;
144 
147 
149  std::deque<sot::Trajectory> deque_traj_;
150 
153 
155  void UpdateTrajectory(const Trajectory &aTrajectory);
156 
158  void setInitTraj(const std::string &os);
159 };
160 
161 } /* namespace sot */
162 } /* namespace dynamicgraph */
163 
164 #endif // SOT_JOINT_TRAJECTORY_ENTITY_HH
Definition: trajectory.hh:115
This object handles trajectory of quantities and publish them as signals.
Definition: joint-trajectory-entity.hh:48
SignalTimeDependent< Dummy, int > OneStepOfUpdateS
Internal signal to trigger one step of the algorithm.
Definition: joint-trajectory-entity.hh:102
sot::MatrixHomogeneous waist_
Store the waist position.
Definition: joint-trajectory-entity.hh:140
dynamicgraph::SignalPtr< Trajectory, int > trajectorySIN
Read a trajectory.
Definition: joint-trajectory-entity.hh:120
sot::Trajectory init_traj_
Initial state of the trajectory.
Definition: joint-trajectory-entity.hh:146
void UpdatePoint(const JointTrajectoryPoint &aJTP)
Update the entity with the current point of the trajectory.
sot::MatrixHomogeneous XYZThetaToMatrixHomogeneous(const dynamicgraph::Vector &xyztheta)
Convert a xyztheta vector into an homogeneous matrix.
dynamicgraph::SignalTimeDependent< sot::MatrixHomogeneous, int > waistSOUT
Publish waist for each evaluation of the graph.
Definition: joint-trajectory-entity.hh:114
dynamicgraph::Vector & getNextCoM(dynamicgraph::Vector &com, const int &time)
Return the next com.
virtual void display(std::ostream &os) const
dynamicgraph::Vector pose_
Store the pos;.
Definition: joint-trajectory-entity.hh:131
dynamicgraph::SignalTimeDependent< int, int > refresherSINTERN
Definition: joint-trajectory-entity.hh:99
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > zmpSOUT
Publish zmp for each evaluation of the graph.
Definition: joint-trajectory-entity.hh:111
SotJointTrajectoryEntity(const std::string &name)
Constructor.
void loadFile(const std::string &name)
void UpdateTrajectory(const Trajectory &aTrajectory)
Update the entity with the trajectory aTrajectory.
virtual ~SotJointTrajectoryEntity()
Definition: joint-trajectory-entity.hh:54
dynamicgraph::Vector & getNextPosition(dynamicgraph::Vector &pos, const int &time)
Return the next pose for the legs.
dynamicgraph::Vector com_
Store the center of mass.
Definition: joint-trajectory-entity.hh:134
unsigned int seqid_
Store the current seq identifier.
Definition: joint-trajectory-entity.hh:143
int & OneStepOfUpdate(int &dummy, const int &time)
Perform one update of the signals.
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > comSOUT
Publish com for each evaluation of the graph.
Definition: joint-trajectory-entity.hh:108
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > positionSOUT
Publish pose for each evaluation of the graph.
Definition: joint-trajectory-entity.hh:105
SOTJOINT_TRAJECTORY_ENTITY_EXPORT friend std::ostream & operator<<(std::ostream &os, const SotJointTrajectoryEntity &r)
Definition: joint-trajectory-entity.hh:86
unsigned int & getSeqId(unsigned int &seqid, const int &time)
Return the current seq identified of the current trajectory.
std::deque< sot::Trajectory >::size_type index_
Index on the point along the trajectory.
Definition: joint-trajectory-entity.hh:125
dynamicgraph::Vector & getNextCoP(dynamicgraph::Vector &cop, const int &time)
Return the next cop.
timestamp traj_timestamp_
Keep the starting time as an identifier of the trajector.
Definition: joint-trajectory-entity.hh:128
dynamicgraph::SignalTimeDependent< unsigned int, int > seqIdSOUT
Publish ID of the trajectory currently realized.
Definition: joint-trajectory-entity.hh:117
void setInitTraj(const std::string &os)
Implements the parsing and the affectation of initial trajectory.
sot::MatrixHomogeneous & getNextWaist(sot::MatrixHomogeneous &waist, const int &time)
Return the next waist.
std::deque< sot::Trajectory > deque_traj_
Queue of trajectories.
Definition: joint-trajectory-entity.hh:149
dynamicgraph::Vector cop_
Store the center of pressure ZMP.
Definition: joint-trajectory-entity.hh:137
int Dummy
Definition: joint-trajectory-entity.hh:94
Definition: trajectory.hh:176
Definition: trajectory.hh:84
#define SOTJOINT_TRAJECTORY_ENTITY_EXPORT
Definition: joint-trajectory-entity.hh:34
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
Definition: matrix-geometry.hh:75
Definition: abstract-sot-external-interface.hh:17