Go to the documentation of this file. 1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_POSITION_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_POSITION_H
4 #include <cnoid/CoordinateFrameList>
5 #include <cnoid/ClonableReferenced>
6 #include <cnoid/GeneralId>
7 #include <cnoid/EigenTypes>
8 #include <cnoid/Signal>
12 #include "exportdecl.h"
17 class LinkKinematicsKit;
20 class MprPositionList;
26 static constexpr
int MaxNumJoints = 8;
42 bool isIK()
const {
return (positionType_ == IK); };
43 bool isFK()
const {
return (positionType_ == FK); };
53 const std::string&
note()
const {
return note_; }
54 void setNote(
const std::string& note) { note_ = note; }
62 PositionUpdate = 1 << 2,
63 ObjectReplaced = 1 << 3
66 void notifyUpdate(
int flags);
74 PositionType positionType_;
78 Signal<void(
int flags)> sigUpdated_;
89 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
99 void setRpy(
const Vector3& rpy);
101 void setReferenceRpy(
const Vector3& rpy);
102 void resetReferenceRpy();
111 return (frameType == BaseFrame) ? baseFrameId_ : offsetFrameId_;
115 return baseFrames->
findFrame(baseFrameId_);
118 return offsetFrames->
findFrame(offsetFrameId_);
121 return (frameType == BaseFrame) ? findBaseFrame(frames) : findOffsetFrame(frames);
129 virtual bool read(
const Mapping& archive)
override;
141 std::array<int, MaxNumJoints> phase_;
149 typedef std::array<double, MaxNumJoints> JointDisplacementArray;
159 virtual bool read(
const Mapping& archive)
override;
169 iterator end() {
return jointDisplacements_.begin() + numJoints_; }
174 double&
q(
int index) {
return jointDisplacements_[index]; }
175 double q(
int index)
const {
return jointDisplacements_[index]; }
184 JointDisplacementArray jointDisplacements_;
185 std::bitset<MaxNumJoints> prismaticJointFlags_;
iterator begin()
Definition: MprPosition.h:167
Definition: ValueTree.h:253
MprPosition * clone() const
Definition: MprPosition.h:32
void setBaseFrameId(const GeneralId &id)
Definition: MprPosition.h:104
Definition: GeneralId.h:11
const GeneralId & id() const
Definition: MprPosition.h:36
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
Listing * write(Mapping *mapping, const std::string &key, const Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:145
double & q(int index)
Definition: MprPosition.h:174
double q(int index) const
Definition: MprPosition.h:175
Definition: MprPosition.h:86
SignalProxy< void(int flags)> sigUpdated()
Definition: MprPosition.h:65
const Vector3 referenceRpy() const
Definition: MprPosition.h:100
Definition: MprPosition.h:147
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
double & jointDisplacement(int index)
Definition: MprPosition.h:172
Definition: Referenced.h:276
CoordinateFrame * findFrame(CoordinateFrameList *frames, int frameType)
Definition: MprPosition.h:120
int numJoints() const
Definition: MprPosition.h:162
ref_ptr< MprIkPosition > MprIkPositionPtr
Definition: MprPosition.h:144
bool checkIfPrismaticJoint(int index) const
Definition: MprPosition.h:177
CoordinateFrame * findBaseFrame(CoordinateFrameList *baseFrames)
Definition: MprPosition.h:114
CoordinateFrame * findFrame(const GeneralId &id) const
Definition: CoordinateFrameList.cpp:160
bool read(const Mapping *mapping, const std::string &key, Eigen::MatrixBase< Derived > &x)
Definition: EigenArchive.h:43
const std::string & note() const
Definition: MprPosition.h:53
void setNote(const std::string ¬e)
Definition: MprPosition.h:54
ref_ptr< MprPosition > MprPositionPtr
Definition: MprPosition.h:83
Definition: Referenced.h:103
void setOffsetFrameId(const GeneralId &id)
Definition: MprPosition.h:105
int configuration() const
Definition: MprPosition.h:124
Definition: CoordinateFrame.h:16
UpdateFlag
Definition: MprPosition.h:59
const GeneralId & frameId(int frameType) const
Definition: MprPosition.h:110
Definition: AbstractSceneLoader.h:11
const_iterator end() const
Definition: MprPosition.h:170
Definition: CoordinateFrameList.h:12
Definition: ClonableReferenced.h:10
Definition: LinkKinematicsKit.h:23
Definition: CloneMap.h:13
int positionType() const
Definition: MprPosition.h:41
const GeneralId & offsetFrameId() const
Definition: MprPosition.h:107
const_iterator begin() const
Definition: MprPosition.h:168
FrameType
Definition: MprPosition.h:109
Definition: MprPosition.h:23
bool isIK() const
Definition: MprPosition.h:42
Definition: Referenced.h:54
void setPosition(const Isometry3 &T)
Definition: MprPosition.h:97
bool isFK() const
Definition: MprPosition.h:43
const GeneralId & baseFrameId() const
Definition: MprPosition.h:106
iterator end()
Definition: MprPosition.h:169
bool checkIfRevoluteJoint(int index) const
Definition: MprPosition.h:178
PositionType
Definition: MprPosition.h:28
JointDisplacementArray::iterator iterator
Definition: MprPosition.h:164
double jointDisplacement(int index) const
Definition: MprPosition.h:173
Definition: MprPositionList.h:14
CoordinateFrame * findOffsetFrame(CoordinateFrameList *offsetFrames)
Definition: MprPosition.h:117
JointDisplacementArray::const_iterator const_iterator
Definition: MprPosition.h:165
const Isometry3 & position() const
Definition: MprPosition.h:96
ref_ptr< MprFkPosition > MprFkPositionPtr
Definition: MprPosition.h:189