Choreonoid  1.1
Link.h
説明を見る。
1 
6 #ifndef CNOID_BODY_LINK_H_INCLUDED
7 #define CNOID_BODY_LINK_H_INCLUDED
8 
9 #include <string>
10 #include <ostream>
11 #include <vector>
12 #include <cnoid/EigenTypes>
13 #include <cnoid/ColdetModel>
14 #include "exportdecl.h"
15 
16 namespace cnoid {
17  class Link;
18 }
19 
20 CNOID_EXPORT std::ostream& operator<<(std::ostream &out, cnoid::Link& link);
21 
22 namespace cnoid {
23 
24  class Body;
25 
27 
28  public:
29 
30  Link();
31  Link(const Link& link);
32  ~Link();
33 
34  inline const std::string& name() {
35  return name_;
36  }
37  inline void setName(const std::string& name){
38  name_ = name;
39  }
40 
41  inline bool isValid() { return (index >= 0); }
42  void addChild(Link* link);
43  bool detachChild(Link* link);
44  inline bool isRoot() { return !parent; }
45 
46  inline void setAttitude(const Matrix3& R) { this->R = R * Rs.transpose(); }
47  inline Matrix3 attitude() { return this->R * Rs; }
48  inline Matrix3 calcRfromAttitude(const Matrix3& R) { return R * Rs.transpose(); }
49 
54  void calcSubMassCM();
55 
59  inline void setSegmentAttitude(const Matrix3& R) { this->R = R * Rs.transpose(); }
60 
64  inline Matrix3 segmentAttitude() { return this->R * Rs; }
65 
67  coldetModel->setPosition(R, p);
68  }
69 
71 
72  int index;
73  int jointId;
74 
75  enum JointType {
79  SLIDE_JOINT
80  };
81 
83 
87 
89 
99 
104 
105  double q;
106  double dq;
107  double ddq;
108  double u;
109 
113 
115 
116  double m;
120 
123 
127 
131 
134 
137 
138  // needed ?
139  //Vector3 f; ///< force from the parent link
140  //Vector3 tau; ///< torque from the parent link
141 
149  double uu;
150  double dd;
151 
152  double Jm2;
153 
154  double ulimit;
155  double llimit;
156  double uvlimit;
157  double lvlimit;
158 
160  double torqueConst;
161  double encoderPulse;
162  double Ir;
163  double gearRatio;
166 
168 
170 
174  };
175 
176  typedef std::vector<ConstraintForce> ConstraintForceArray;
178 
179  double subm;
181 
182  private:
183 
184  std::string name_;
185 
186  Link& operator=(const Link& link); // no implementation is given to disable the copy operator
187  void setBodyIter(Body* body);
188  friend std::ostream& ::operator<<(std::ostream &out, Link& link);
189  void putInformation(std::ostream& out); // for the iostream output
190  };
191 
192 };
193 
194 
195 #endif