Go to the documentation of this file.
7 #ifndef CNOID_BODY_JOINT_PATH_H
8 #define CNOID_BODY_JOINT_PATH_H
12 #include <cnoid/EigenTypes>
15 #include "exportdecl.h"
30 static std::shared_ptr<JointPath> getCustomPath(
Body* body,
Link* baseLink,
Link* endLink);
38 return joints_.empty();
42 return static_cast<int>(joints_.size());
50 return joints_[index];
53 Link* operator[] (
int index)
const {
54 return joints_[index];
58 return linkPath_.baseLink();
62 return linkPath_.endLink();
66 return (index >= numUpwardJointConnections);
69 const std::vector<Link*>&
joints()
const {
return joints_; }
83 linkPath_.calcForwardKinematics(calcVelocity, calcAcceleration);
86 int indexOf(
const Link* link)
const;
88 virtual bool hasCustomIK()
const;
92 bool isBestEffortIkMode()
const;
93 void setBestEffortIkMode(
bool on);
94 void setNumericalIkMaxIkError(
double e);
95 void setNumericalIkDeltaScale(
double s);
96 void setNumericalIkMaxIterations(
int n);
97 void setNumericalIkDampingConstant(
double lambda);
98 static double numericalIkDefaultDeltaScale();
99 static int numericalIkDefaultMaxIterations();
100 static double numericalIkDefaultMaxIkError();
101 static double numericalIkDefaultDampingConstant();
103 void customizeTarget(
104 int numTargetElements,
105 std::function<
double(VectorXd& out_error)> errorFunc,
106 std::function<
void(MatrixXd& out_Jacobian)> jacobianFunc);
109 bool calcInverseKinematics();
115 virtual bool calcInverseKinematics(
const Isometry3& T)
override;
116 virtual bool calcRemainingPartForwardKinematicsForInverseKinematics()
override;
118 int numIterations()
const;
120 std::string
name()
const {
return name_; }
121 void setName(
const std::string& name){ name_ = name; }
124 void setNumericalIKtruncateRatio(
double r);
125 static double numericalIKdefaultTruncateRatio();
127 [[deprecated(
"Use calcInverseKinematics(const Isometry3& T)")]]
131 [[deprecated(
"Use calcInverseKinematics(const Isometry3& T)")]]
132 bool calcInverseKinematics(
135 void calcJacobian(Eigen::MatrixXd& out_J)
const;
136 [[deprecated(
"Use hasCustomIK")]]
137 bool hasAnalyticalIK()
const;
138 [[deprecated(
"Use setCustomIkDisabled.")]]
140 [[deprecated(
"Use isCustomIkDisabled.")]]
142 [[deprecated(
"Use isBestEffortIkMode.")]]
144 [[deprecated(
"Use setBestEffortIkMode.")]]
146 [[deprecated(
"Use setNumericalIkMaxIkError.")]]
148 [[deprecated(
"Use setNumericalIkDeltaScale.")]]
150 [[deprecated(
"Use setNumericalIkMaxIterations.")]]
152 [[deprecated(
"Use setNumericalIkDampingConstant.")]]
154 [[deprecated(
"Use numericalIkDefaultDeltaScale.")]]
156 [[deprecated(
"Use numericalIkDefaultMaxIterations.")]]
158 [[deprecated(
"Use numericalIkDefaultMaxIkError.")]]
160 [[deprecated(
"Use numericalIkDefaultDampingConstant.")]]
165 void extractJoints();
166 void doResetWhenJointPathUpdated();
167 NumericalIK* getOrCreateNumericalIK();
170 std::vector<Link*> joints_;
171 std::shared_ptr<LinkTraverse> remainingLinkTraverse;
172 NumericalIK* numericalIK;
173 int numUpwardJointConnections;
174 bool needForwardKinematicsBeforeIK;
175 bool isCustomIkDisabled_;
184 #ifdef CNOID_BACKWARD_COMPATIBILITY
185 typedef std::shared_ptr<JointPath> JointPathPtr;
LinkTraverse::iterator iterator
Definition: JointPath.h:71
void setCustomIkDisabled(bool on)
Definition: JointPath.h:90
void setNumericalIKdampingConstant(double lambda)
Definition: JointPath.h:153
void setName(const std::string &name)
Definition: JointPath.h:121
bool isJointDownward(int index) const
Definition: JointPath.h:65
int size() const
Definition: JointPath.h:41
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
Definition: LinkPath.h:14
bool isCustomIkDisabled() const
Definition: JointPath.h:89
iterator end()
Definition: JointPath.h:75
Definition: JointPath.h:23
static double numericalIKdefaultDampingConstant()
Definition: JointPath.h:161
static double numericalIKdefaultDeltaScale()
Definition: JointPath.h:155
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
void setNumericalIKdeltaScale(double s)
Definition: JointPath.h:149
void setNumericalIKmaxIKerror(double e)
Definition: JointPath.h:147
bool empty() const
Definition: JointPath.h:37
const std::vector< Link * > & joints() const
Definition: JointPath.h:69
void setBestEffortIKmode(bool on)
Definition: JointPath.h:145
Eigen::Matrix3d Matrix3
Definition: EigenTypes.h:56
const_iterator end() const
Definition: JointPath.h:77
Link * baseLink() const
Definition: JointPath.h:57
static double numericalIKdefaultMaxIKerror()
Definition: JointPath.h:159
void setNumericalIKenabled(bool on)
Definition: JointPath.h:139
std::string name() const
Definition: JointPath.h:120
const LinkPath & linkPath() const
Definition: JointPath.h:80
virtual bool calcInverseKinematics(const Isometry3 &T)=0
iterator begin()
Definition: JointPath.h:74
bool calcInverseKinematics(const Vector3 &p, const Matrix3 &R)
Definition: JointPath.h:128
LinkTraverse::const_iterator const_iterator
Definition: JointPath.h:72
Definition: AbstractSceneLoader.h:11
Link * endLink() const
Definition: JointPath.h:61
Definition: InverseKinematics.h:13
Link * joint(int index) const
Definition: JointPath.h:49
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false) const
Definition: JointPath.h:82
std::shared_ptr< JointPath > getCustomJointPath(Body *body, Link *baseLink, Link *endLink)
Definition: JointPath.h:180
container::const_iterator const_iterator
Definition: LinkTraverse.h:67
static std::shared_ptr< JointPath > getCustomPath(Body *body, Link *baseLink, Link *endLink)
Definition: JointPath.cpp:557
void setNumericalIKmaxIterations(int n)
Definition: JointPath.h:151
static int numericalIKdefaultMaxIterations()
Definition: JointPath.h:157
bool isNumericalIkEnabled() const
Definition: JointPath.h:141
const_iterator begin() const
Definition: JointPath.h:76
container::iterator iterator
Definition: LinkTraverse.h:66
int numJoints() const
Definition: JointPath.h:45
bool isBestEffortIKmode() const
Definition: JointPath.h:143
LinkPath & linkPath()
Definition: JointPath.h:79