Choreonoid  1.8
MprTagTraceStatement.h
Go to the documentation of this file.
1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_TAG_TRACE_STATEMENT_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_TAG_TRACE_STATEMENT_H
3 
4 #include "MprBasicStatements.h"
5 #include "MprProgram.h"
6 #include <cnoid/GeneralId>
7 #include <cnoid/PositionTagGroup>
8 #include <cnoid/ConnectionSet>
9 #include "exportdecl.h"
10 
11 namespace cnoid {
12 
13 class LinkKinematicsKit;
14 
15 class CNOID_EXPORT MprTagTraceStatement : public MprStructuredStatement
16 {
17 public:
18  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
19 
21 
22  virtual std::string label(int index) const override;
23 
24  void setTagGroupName(const std::string& name) { tagGroupName_ = name; }
25 
26  const std::string& tagGroupName() const { return tagGroupName_; }
27  [[deprecated]]
28  const std::string& originalTagGroupName() const { return tagGroupName(); }
29 
30  void setTagGroup(PositionTagGroup* tags, bool doUpdateTagGroupName, bool doUpdateTagTraceProgram);
31  PositionTagGroup* tagGroup() { return tagGroup_; }
32 
34  const Isometry3& tagGroupPosition() const { return T_tags; }
35  void setTagGroupPosition(const Isometry3& T) { T_tags = T; }
36 
37  const GeneralId& baseFrameId() const { return baseFrameId_; }
38  const GeneralId& offsetFrameId() const { return offsetFrameId_; }
39  void setBaseFrameId(const GeneralId& id){ baseFrameId_ = id; }
40  void setOffsetFrameId(const GeneralId& id){ offsetFrameId_ = id; }
41 
42  void updateFramesWithCurrentFrames(LinkKinematicsKit* kinematicsKit);
43  void updateTagGroupPositionWithGlobalCoordinate(
44  LinkKinematicsKit* kinematicsKit, const Isometry3& T_global);
45 
46  virtual bool updateTagTraceProgram() = 0;
47  bool decomposeIntoTagTraceStatements();
48 
49  virtual bool isExpandedByDefault() const override;
50  virtual bool read(MprProgram* program, const Mapping& archive) override;
51  virtual bool write(Mapping& archive) const override;
52 
53 protected:
54  MprTagTraceStatement(const MprTagTraceStatement& org, CloneMap* cloneMap);
55 
56  virtual void onTagAdded(int index);
57  virtual void onTagRemoved(int index);
58  virtual void onTagPositionUpdated(int index);
59  virtual void onTagGroupOriginOffsetChanged();
60 
61 private:
62  std::string tagGroupName_;
63  PositionTagGroupPtr tagGroup_;
64  Isometry3 T_tags;
65  GeneralId baseFrameId_;
66  GeneralId offsetFrameId_;
67  ScopedConnectionSet tagGroupConnections;
68 
69  void connectTagGroupUpdateSignals();
70 };
71 
73 
74 }
75 
76 #endif
cnoid::MprTagTraceStatement::offsetFrameId
const GeneralId & offsetFrameId() const
Definition: MprTagTraceStatement.h:38
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::MprStructuredStatement
Definition: MprStructuredStatement.h:10
cnoid::MprTagTraceStatement::setTagGroupPosition
void setTagGroupPosition(const Isometry3 &T)
Definition: MprTagTraceStatement.h:35
cnoid::GeneralId
Definition: GeneralId.h:11
cnoid::write
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::read
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
cnoid::MprTagTraceStatement::tagGroupName
const std::string & tagGroupName() const
Definition: MprTagTraceStatement.h:26
cnoid::MprTagTraceStatementPtr
ref_ptr< MprTagTraceStatement > MprTagTraceStatementPtr
Definition: MprTagTraceStatement.h:72
cnoid::MprTagTraceStatement::setTagGroupName
void setTagGroupName(const std::string &name)
Definition: MprTagTraceStatement.h:24
cnoid::ref_ptr< PositionTagGroup >
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::LinkKinematicsKit
Definition: LinkKinematicsKit.h:23
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::MprTagTraceStatement::tagGroup
PositionTagGroup * tagGroup()
Definition: MprTagTraceStatement.h:31
cnoid::MprTagTraceStatement::setOffsetFrameId
void setOffsetFrameId(const GeneralId &id)
Definition: MprTagTraceStatement.h:40
cnoid::MprTagTraceStatement::tagGroupPosition
const Isometry3 & tagGroupPosition() const
The position of the tag group on the base coordinate frame.
Definition: MprTagTraceStatement.h:34
cnoid::ScopedConnectionSet
Definition: ConnectionSet.h:96
cnoid::PositionTagGroup
Definition: PositionTagGroup.h:16
cnoid::MprTagTraceStatement::baseFrameId
const GeneralId & baseFrameId() const
Definition: MprTagTraceStatement.h:37
cnoid::MprTagTraceStatement
Definition: MprTagTraceStatement.h:15
cnoid::MprTagTraceStatement::originalTagGroupName
const std::string & originalTagGroupName() const
Definition: MprTagTraceStatement.h:28
cnoid::MprProgram
Definition: MprProgram.h:21
cnoid::MprTagTraceStatement::setBaseFrameId
void setBaseFrameId(const GeneralId &id)
Definition: MprTagTraceStatement.h:39
MprBasicStatements.h
MprProgram.h