Choreonoid  1.8
BodyMotionPoseProvider.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_BODY_MOTION_POSE_PROVIDER_H
7 #define CNOID_BODY_BODY_MOTION_POSE_PROVIDER_H
8 
9 #include "Body.h"
10 #include "PoseProvider.h"
11 #include "BodyMotion.h"
12 #include "ZMPSeq.h"
13 #include <cnoid/MultiSE3MatrixSeq>
14 #include "exportdecl.h"
15 
16 namespace cnoid {
17 
18 class Link;
19 
20 class JointPath;
21 
22 class CNOID_EXPORT BodyMotionPoseProvider : public PoseProvider
23 {
24 public:
25  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
26 
28  BodyMotionPoseProvider(Body* body, std::shared_ptr<BodyMotion> motion);
29 
30  void initialize(Body* body, std::shared_ptr<BodyMotion> motion);
31 
32  bool updateMotion();
33 
34  virtual Body* body() const;
35  virtual double beginningTime() const;
36  virtual double endingTime() const;
37  virtual bool seek(double time);
38  virtual bool seek(double time, int waistLinkIndex, const Vector3& waistTranslation);
39  virtual int baseLinkIndex() const;
40  virtual bool getBaseLinkPosition(Isometry3& out_T) const;
41  virtual void getJointPositions(std::vector<stdx::optional<double>>& out_q) const;
42  virtual stdx::optional<Vector3> ZMP() const;
43 
44 private:
45  BodyPtr body_;
46  std::shared_ptr<BodyMotion> motion;
47  std::shared_ptr<ZMPSeq> zmpSeq;
48  int minNumJoints;
49  std::vector<Link*> footLinks;
50  std::vector<std::shared_ptr<JointPath>> ikPaths;
51  std::shared_ptr<MultiSE3MatrixSeq> footLinkPositions;
52  std::vector<double> qTranslated;
53  Isometry3 T_waist;
54  Vector3 ZMP_;
55 
56  bool seek(double time, int waistLinkIndex, const Vector3& waistTranslation, bool applyWaistTranslation);
57 };
58 
59 }
60 
61 #endif
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
PoseProvider.h
cnoid::PoseProvider
Definition: PoseProvider.h:16
cnoid::ref_ptr< Body >
cnoid::BodyMotionPoseProvider
Definition: BodyMotionPoseProvider.h:22
cnoid
Definition: AbstractSceneLoader.h:11
ZMPSeq.h
BodyMotion.h
Body.h
cnoid::Body
Definition: Body.h:28