17 sotJTE__INIT sotJTE_initiator;
18 #endif // #ifdef VP_DEBUG 22 #include <dynamic-graph/factory.h> 34 "SotJointTrajectoryEntity");
36 SotJointTrajectoryEntity::SotJointTrajectoryEntity(
const std::string &
n)
38 refresherSINTERN(
"SotJointTrajectoryEntity(" + n +
39 ")::intern(dummy)::refresher"),
42 refresherSINTERN << trajectorySIN,
43 "SotJointTrajectory(" + n +
")::onestepofupdate"),
47 "SotJointTrajectory(" + n +
")::output(vector)::position"),
50 "SotJointTrajectory(" + n +
")::output(vector)::com"),
53 "SotJointTrajectory(" + n +
")::output(vector)::zmp"),
57 "SotJointTrajectory(" + n +
")::output(MatrixHomogeneous)::waist"),
60 "SotJointTrajectory(" + n +
")::output(uint)::seqid"),
61 trajectorySIN(NULL,
"SotJointTrajectory(" + n +
62 ")::input(trajectory)::trajectoryIN"),
64 traj_timestamp_(0, 0),
67 using namespace command;
75 std::string docstring;
78 " initialize the first trajectory.\n" 86 "string (trajectory)")));
93 std::vector<JointTrajectoryPoint>::size_type possize = aJTP.
positions_.size();
94 if (possize == 0)
return;
97 for (std::vector<JointTrajectoryPoint>::size_type
i = 0;
i < possize - 5;
105 for (std::vector<JointTrajectoryPoint>::size_type
i = possize - 5, j = 0;
106 i < possize - 2;
i++, j++)
113 waistXYZTheta.resize(4);
115 waistXYZTheta(0) =
com_(0);
116 waistXYZTheta(1) =
com_(1);
117 waistXYZTheta(2) = 0.65;
118 waistXYZTheta(3) =
com_(2);
124 for (std::vector<JointTrajectoryPoint>::size_type
i = possize - 2, j = 0;
125 i < possize;
i++, j++)
135 <<
" aTrajectory.header_.stamp_" << aTrajectory.
header_.
stamp_;
143 sotDEBUG(3) <<
"index: " <<
index_ <<
" aTrajectory.points_.size(): " 161 sotDEBUG(3) <<
"step 1 " << std::endl
162 <<
"header: " << std::endl
170 <<
" aTrajectory.points_.size():" << aTrajectory.
points_.size()
184 sotDEBUG(3) <<
"current_traj_.points_.size()=" 185 <<
deque_traj_.front().points_.size() << std::endl;
195 sotDEBUG(3) <<
"index_=current_traj_.points_.size()-1;" << std::endl;
198 sotDEBUG(3) <<
"index_:" <<
index_ <<
" current_traj_.points_.size():" 199 <<
deque_traj_.front().points_.size() << std::endl;
214 sotDEBUG(4) <<
"Overwrite trajectory without completion." <<
index_ <<
" " 215 <<
deque_traj_.front().points_.size() << std::endl;
218 sotDEBUG(4) <<
"Finished to read trajectorySIN" << std::endl;
221 sotDEBUG(4) <<
"Finished to update trajectory" << std::endl;
229 assert(xyztheta.size() == 4);
234 Eigen::Affine3d trans;
235 trans = Eigen::Translation3d(t);
236 Eigen::Affine3d _Rd(Eigen::AngleAxisd(xyztheta(3), Eigen::Vector3d::UnitZ()));
302 std::istringstream is(as);
virtual void display(std::ostream &os) const
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
dynamicgraph::Vector & getNextCoM(dynamicgraph::Vector &com, const int &time)
Return the next com.
int deserialize(std::istringstream &is)
sot::MatrixHomogeneous waist_
Store the waist position.
void UpdatePoint(const JointTrajectoryPoint &aJTP)
Update the entity with the current point of the trajectory.
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > positionSOUT
Publish pose for each evaluation of the graph.
unsigned int seqid_
Store the current seq identifier.
std::deque< sot::Trajectory > deque_traj_
Queue of trajectories.
std::deque< sot::Trajectory >::size_type index_
Index on the point along the trajectory.
void signalRegistration(const SignalArray< int > &signals)
void UpdateTrajectory(const Trajectory &aTrajectory)
Update the entity with the trajectory aTrajectory.
dynamicgraph::SignalTimeDependent< unsigned int, int > seqIdSOUT
Publish ID of the trajectory currently realized.
std::vector< double > positions_
#define sotDEBUGOUT(level)
dynamicgraph::SignalTimeDependent< sot::MatrixHomogeneous, int > waistSOUT
Publish waist for each evaluation of the graph.
dynamicgraph::Vector & getNextCoP(dynamicgraph::Vector &cop, const int &time)
Return the next cop.
dynamicgraph::Vector & getNextPosition(dynamicgraph::Vector &pos, const int &time)
Return the next pose for the legs.
dynamicgraph::Vector pose_
Store the pos;.
dynamicgraph::SignalPtr< Trajectory, int > trajectorySIN
Read a trajectory.
int & OneStepOfUpdate(int &dummy, const int &time)
Perform one update of the signals.
CommandVoid1< E, T > * makeCommandVoid1(E &entity, boost::function< void(const T &)> function, const std::string &docString)
dynamicgraph::SignalTimeDependent< int, int > refresherSINTERN
static void openFile(const char *filename=DEBUG_FILENAME_DEFAULT)
void setDependencyType(DependencyType dep)
#define sotDEBUGIN(level)
std::string docCommandVoid1(const std::string &doc, const std::string &type)
This object handles trajectory of quantities and publish them as signals.
sot::Trajectory init_traj_
Initial state of the trajectory.
SignalTimeDependent< Dummy, int > OneStepOfUpdateS
Internal signal to trigger one step of the algorithm.
void setInitTraj(const std::string &os)
Implements the parsing and the affectation of initial trajectory.
timestamp traj_timestamp_
Keep the starting time as an identifier of the trajector.
std::vector< JointTrajectoryPoint > points_
unsigned int & getSeqId(unsigned int &seqid, const int &time)
Return the current seq identified of the current trajectory.
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > comSOUT
Publish com for each evaluation of the graph.
void loadFile(const std::string &name)
dynamicgraph::Vector cop_
Store the center of pressure ZMP.
dynamicgraph::Vector com_
Store the center of mass.
sot::MatrixHomogeneous XYZThetaToMatrixHomogeneous(const dynamicgraph::Vector &xyztheta)
Convert a xyztheta vector into an homogeneous matrix.
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(SotJointTrajectoryEntity, "SotJointTrajectoryEntity")
sot::MatrixHomogeneous & getNextWaist(sot::MatrixHomogeneous &waist, const int &time)
Return the next waist.
void setReady(const bool sready=true)
void addCommand(const std::string &name, command::Command *command)
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > zmpSOUT
Publish zmp for each evaluation of the graph.