Choreonoid  1.8
CompositeIK.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_COMPOSITE_IK_H
7 #define CNOID_BODY_COMPOSITE_IK_H
8 
9 #include "InverseKinematics.h"
10 #include <cnoid/Referenced>
11 #include <vector>
12 #include <memory>
13 #include "exportdecl.h"
14 
15 namespace cnoid {
16 
17 class Body;
18 class Link;
19 class LinkTraverse;
20 class JointPath;
21 
22 class CNOID_EXPORT CompositeIK : public InverseKinematics
23 {
24 public:
25  CompositeIK();
26  CompositeIK(Body* body, Link* targetLink);
27 
28  void reset(Body* body, Link* targetLink);
29  bool addBaseLink(Link* link);
30 
31  Body* body() { return body_; }
32  Link* targetLink() { return targetLink_; }
33  int numJointPaths() const { return paths.size(); }
34  std::shared_ptr<JointPath> jointPath(int index) const { return paths[index]; }
35  Link* baseLink(int index) const;
36 
37  void setMaxIkError(double e);
38  bool hasCustomIK() const { return hasCustomIK_; }
39 
40  virtual bool calcInverseKinematics(const Isometry3& T) override;
41  virtual bool calcRemainingPartForwardKinematicsForInverseKinematics() override;
42 
43  [[deprecated("Use calcInverseKinematics(const Isometry3& T).")]]
44  bool calcInverseKinematics(const Vector3& p, const Matrix3& R) {
46  }
47  [[deprecated("Use setMaxIkError.")]]
48  void setMaxIKerror(double e) { setMaxIkError(e); }
49  [[deprecated("Use hasCustomIK.")]]
50  bool hasAnalyticalIK() const { return hasCustomIK(); }
51 
52 private:
53  ref_ptr<Body> body_;
54  Link* targetLink_;
55  std::vector<std::shared_ptr<JointPath>> paths;
56  std::vector<double> q0;
57  std::shared_ptr<LinkTraverse> remainingLinkTraverse;
58  bool hasCustomIK_;
59 };
60 
61 }
62 
63 #endif
cnoid::CompositeIK::numJointPaths
int numJointPaths() const
Definition: CompositeIK.h:33
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::Matrix3
Eigen::Matrix3d Matrix3
Definition: EigenTypes.h:56
cnoid::ref_ptr< Body >
cnoid::CompositeIK::calcInverseKinematics
bool calcInverseKinematics(const Vector3 &p, const Matrix3 &R)
Definition: CompositeIK.h:44
cnoid::InverseKinematics::calcInverseKinematics
virtual bool calcInverseKinematics(const Isometry3 &T)=0
cnoid::CompositeIK::hasCustomIK
bool hasCustomIK() const
Definition: CompositeIK.h:38
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::InverseKinematics
Definition: InverseKinematics.h:13
cnoid::CompositeIK::targetLink
Link * targetLink()
Definition: CompositeIK.h:32
cnoid::CompositeIK::body
Body * body()
Definition: CompositeIK.h:31
cnoid::CompositeIK::hasAnalyticalIK
bool hasAnalyticalIK() const
Definition: CompositeIK.h:50
cnoid::Body
Definition: Body.h:28
InverseKinematics.h
cnoid::CompositeIK::setMaxIKerror
void setMaxIKerror(double e)
Definition: CompositeIK.h:48
cnoid::CompositeIK::jointPath
std::shared_ptr< JointPath > jointPath(int index) const
Definition: CompositeIK.h:34
cnoid::CompositeIK
Definition: CompositeIK.h:22