Choreonoid  1.5
LeggedBodyHelper.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_LEGGED_BODY_HELPER_H
7 #define CNOID_BODY_LEGGED_BODY_HELPER_H
8 
9 #include "Body.h"
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
15 {
16 public:
18  LeggedBodyHelper(Body* body);
20 
21  bool isValid() const { return isValid_; }
22  virtual bool resetBody(Body* body);
23 
24  virtual ~LeggedBodyHelper();
25 
26  Body* body() const { return body_.get(); }
27 
28  int numFeet() const { return footInfos.size(); }
29 
30  Link* footLink(int index) const { return footInfos[index].link; }
31 
32  Link* kneePitchJoint(int footIndex) const { return footInfos[footIndex].kneePitchJoint; }
33 
34  bool doLegIkToMoveCm(const Vector3& c, bool onlyProjectionToFloor = false);
35  bool setStance(double width, Link* baseLink);
36 
37  const Vector3& centerOfSoleLocal(int footIndex) const { return footInfos[footIndex].soleCenter; }
38 
39  Vector3 centerOfSole(int footIndex) const;
40  Vector3 centerOfSoles() const;
41 
42  Vector3 homeCopOfSole(int footIndex) const;
43  Vector3 homeCopOfSoles() const;
44 
45 private:
46  BodyPtr body_;
47  bool isValid_;
48  struct FootInfo {
49  Link* link;
50  Link* kneePitchJoint;
51  Vector3 homeCop;
52  Vector3 soleCenter;
53  };
54  std::vector<FootInfo> footInfos;
55 };
56 
58 
60 
61 }
62 
63 #endif
Link * footLink(int index) const
Definition: LeggedBodyHelper.h:30
Definition: Body.h:28
ref_ptr< LeggedBodyHelper > LeggedBodyHelperPtr
Definition: LeggedBodyHelper.h:57
Definition: Referenced.h:67
const Vector3 & centerOfSoleLocal(int footIndex) const
Definition: LeggedBodyHelper.h:37
int numFeet() const
Definition: LeggedBodyHelper.h:28
Link * kneePitchJoint(int footIndex) const
Definition: LeggedBodyHelper.h:32
LeggedBodyHelper * getLeggedBodyHelper(Body *body)
Definition: LeggedBodyHelper.cpp:19
Defines the minimum processing for performing pasing file for STL.
Definition: AbstractSceneLoader.h:9
bool isValid() const
Definition: LeggedBodyHelper.h:21
Eigen::Vector3d Vector3
Definition: EigenTypes.h:58
#define CNOID_EXPORT
Definition: Util/exportdecl.h:37
Body * body() const
Definition: LeggedBodyHelper.h:26
Definition: LeggedBodyHelper.h:14