Choreonoid  1.8
CoordinateFrame.h
Go to the documentation of this file.
1 #ifndef CNOID_UTIL_COORDINATE_FRAME_H
2 #define CNOID_UTIL_COORDINATE_FRAME_H
3 
4 #include "GeneralId.h"
5 #include "Referenced.h"
6 #include <cnoid/EigenTypes>
7 #include <cnoid/Signal>
8 #include <string>
9 #include "exportdecl.h"
10 
11 namespace cnoid {
12 
13 class CoordinateFrameList;
14 class Mapping;
15 
16 class CNOID_EXPORT CoordinateFrame : public Referenced
17 {
18 public:
19  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
20 
22  CoordinateFrame(const GeneralId& id);
23  CoordinateFrame(const CoordinateFrame& org);
24 
30 
31  const GeneralId& id() const { return id_; }
32  bool resetId(const GeneralId& id);
33 
34  enum Mode { Local, Global };
35  void setMode(int mode) { mode_ = mode; }
36  int mode() const { return mode_; }
37  bool isLocal() const { return mode_ == Local; }
38  bool isGlobal() const { return mode_ == Global; }
39 
40  const Isometry3& T() const { return T_; }
41  const Isometry3& position() const { return T_; }
42  void setPosition(const Isometry3& T) { T_ = T; }
43 
44  const std::string& note() const { return note_; }
45  void setNote(const std::string& note) { note_ = note; }
46 
47  CoordinateFrameList* ownerFrameList() const;
48 
49  bool read(const Mapping& archive);
50  bool write(Mapping& archive) const;
51 
52  enum UpdateFlag {
53  IdUpdate = 1 << 0,
54  ModeUpdate = 1 << 1,
55  NoteUpdate = 1 << 2,
56  PositionUpdate = 1 << 3
57  };
58  SignalProxy<void(int flags)> sigUpdated() { return sigUpdated_; }
59  void notifyUpdate(int flags);
60 
61 private:
62  Isometry3 T_;
63  GeneralId id_;
64  int mode_;
65  std::string note_;
66  weak_ref_ptr<CoordinateFrameList> ownerFrameList_;
67  Signal<void(int flags)> sigUpdated_;
68 
69  friend class CoordinateFrameList;
70 };
71 
73 
74 }
75 
76 #endif
cnoid::CoordinateFramePtr
ref_ptr< CoordinateFrame > CoordinateFramePtr
Definition: CoordinateFrame.h:72
cnoid::CoordinateFrame::mode
int mode() const
Definition: CoordinateFrame.h:36
Referenced.h
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::GeneralId
Definition: GeneralId.h:11
cnoid::CoordinateFrame::id
const GeneralId & id() const
Definition: CoordinateFrame.h:31
cnoid::write
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
GeneralId.h
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::CoordinateFrame::position
const Isometry3 & position() const
Definition: CoordinateFrame.h:41
cnoid::CoordinateFrame::isGlobal
bool isGlobal() const
Definition: CoordinateFrame.h:38
cnoid::weak_ref_ptr
Definition: Referenced.h:276
cnoid::CoordinateFrame::Mode
Mode
Definition: CoordinateFrame.h:34
cnoid::CoordinateFrame::isLocal
bool isLocal() const
Definition: CoordinateFrame.h:37
cnoid::read
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
cnoid::ref_ptr< CoordinateFrame >
cnoid::CoordinateFrame
Definition: CoordinateFrame.h:16
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::CoordinateFrameList
Definition: CoordinateFrameList.h:12
cnoid::CoordinateFrame::setNote
void setNote(const std::string &note)
Definition: CoordinateFrame.h:45
cnoid::CoordinateFrame::T
const Isometry3 & T() const
Definition: CoordinateFrame.h:40
cnoid::Referenced
Definition: Referenced.h:54
cnoid::CoordinateFrame::note
const std::string & note() const
Definition: CoordinateFrame.h:44
cnoid::CoordinateFrame::setMode
void setMode(int mode)
Definition: CoordinateFrame.h:35
cnoid::Signal
Definition: Signal.h:165
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::CoordinateFrame::UpdateFlag
UpdateFlag
Definition: CoordinateFrame.h:52
cnoid::CoordinateFrame::setPosition
void setPosition(const Isometry3 &T)
Definition: CoordinateFrame.h:42
cnoid::CoordinateFrame::sigUpdated
SignalProxy< void(int flags)> sigUpdated()
Definition: CoordinateFrame.h:58