Choreonoid  1.8
LinkKinematicsKit.h
Go to the documentation of this file.
1 #ifndef CNOID_BODY_LINK_KINEMATICS_KIT_H
2 #define CNOID_BODY_LINK_KINEMATICS_KIT_H
3 
4 #include <cnoid/EigenTypes>
5 #include <cnoid/ClonableReferenced>
6 #include <cnoid/Signal>
7 #include <cnoid/GeneralId>
8 #include <memory>
9 #include <string>
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class Body;
15 class Link;
16 class JointPath;
17 class JointSpaceConfigurationHandler;
18 class CoordinateFrame;
19 class CoordinateFrameList;
20 class InverseKinematics;
21 class Mapping;
22 
23 class CNOID_EXPORT LinkKinematicsKit : public ClonableReferenced
24 {
25 public:
26  LinkKinematicsKit(Link* link);
28 
29  void setBaseLink(Link* baseLink);
30  void setInverseKinematics(std::shared_ptr<InverseKinematics> ik);
31  void setBaseFrames(CoordinateFrameList* frames);
32  void setOffsetFrames(CoordinateFrameList* frames);
33 
34  Body* body();
35  const Body* body() const;
36  Link* link();
37  const Link* link() const;
38  Link* baseLink();
39  const Link* baseLink() const;
40  bool isManipulator() const;
41 
42  bool hasJointPath() const;
43  std::shared_ptr<JointPath> jointPath();
44  std::shared_ptr<InverseKinematics> inverseKinematics();
45 
46  std::shared_ptr<JointSpaceConfigurationHandler> configurationHandler();
47  int currentConfigurationType() const;
48  std::string configurationLabel(int id) const;
49 
50  bool isCustomIkAvaiable() const;
51  bool isCustomIkDisabled() const;
52  void setCustomIkDisabled(bool on);
53 
54  Vector3 referenceRpy() const;
55  void setReferenceRpy(const Vector3& rpy);
56  void resetReferenceRpy();
57 
58  CoordinateFrameList* baseFrames();
59  CoordinateFrameList* offsetFrames();
60  CoordinateFrame* baseFrame(const GeneralId& id);
61  const CoordinateFrame* baseFrame(const GeneralId& id) const;
62  CoordinateFrame* offsetFrame(const GeneralId& id);
63  const CoordinateFrame* offsetFrame(const GeneralId& id) const;
64  const GeneralId& currentBaseFrameId() const;
65  const GeneralId& currentOffsetFrameId() const;
66  CoordinateFrame* currentBaseFrame();
67  const CoordinateFrame* currentBaseFrame() const;
68  CoordinateFrame* currentOffsetFrame();
69  const CoordinateFrame* currentOffsetFrame() const;
70  void setCurrentBaseFrame(const GeneralId& id);
71  void setCurrentOffsetFrame(const GeneralId& id);
72 
74  Isometry3 endPosition(
75  const GeneralId& baseFrameId = GeneralId() /* Current */,
76  const GeneralId& offsetFrameId = GeneralId() /* Current */) const;
77 
78  Isometry3 globalEndPosition(
79  const GeneralId& offsetFrameId = GeneralId() /* current */) const;
80 
82  Isometry3 globalBasePosition(const GeneralId& baseFrameId = GeneralId() /* current */) const;
83 
84  bool setEndPosition(
85  const Isometry3& T,
86  const GeneralId& baseFrameId = GeneralId() /* Current */,
87  const GeneralId& offsetFrameId = GeneralId() /* Current */,
88  int configuration = 0 /* Auto */);
89 
90  bool setGlobalEndPosition(
91  const Isometry3& T_global,
92  const GeneralId& offsetFrameId = GeneralId() /* Current */,
93  int configuration = 0 /* Auto */);
94 
95  // Any update on frames (frame lists, current frames, etc.)
96  SignalProxy<void()> sigFrameUpdate();
97  void notifyFrameUpdate();
98 
99  SignalProxy<void(const Isometry3& T_frameCoordinate)> sigPositionError();
100  void notifyPositionError(const Isometry3& T_frameCoordinate);
101 
102  bool storeState(Mapping& archive) const;
103  bool restoreState(const Mapping& archive);
104 
105 protected:
106  LinkKinematicsKit(const LinkKinematicsKit& org, CloneMap* cloneMap);
107  virtual Referenced* doClone(CloneMap* cloneMap) const override;
108 
109 private:
110  class Impl;
111  Impl* impl;
112 };
113 
115 
116 }
117 
118 #endif
cnoid::LinkKinematicsKitPtr
ref_ptr< LinkKinematicsKit > LinkKinematicsKitPtr
Definition: LinkKinematicsKit.h:114
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::GeneralId
Definition: GeneralId.h:11
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::ref_ptr< LinkKinematicsKit >
cnoid::CoordinateFrame
Definition: CoordinateFrame.h:16
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::CoordinateFrameList
Definition: CoordinateFrameList.h:12
cnoid::ClonableReferenced
Definition: ClonableReferenced.h:10
cnoid::LinkKinematicsKit
Definition: LinkKinematicsKit.h:23
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Body
Definition: Body.h:28
cnoid::SignalProxy
Definition: Signal.h:470