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);
39 return joints_.empty();
43 return static_cast<int>(joints_.size());
51 return joints_[index];
54 Link* operator[] (
int index)
const {
55 return joints_[index];
59 return linkPath_.baseLink();
63 return linkPath_.endLink();
67 return (index >= numUpwardJointConnections);
70 const std::vector<Link*>&
joints()
const {
return joints_; }
84 linkPath_.calcForwardKinematics(calcVelocity, calcAcceleration);
87 int indexOf(
const Link* link)
const;
89 virtual bool hasCustomIK()
const;
93 bool isBestEffortIkMode()
const;
94 void setBestEffortIkMode(
bool on);
95 void setNumericalIkMaxIkError(
double e);
96 void setNumericalIkDeltaScale(
double s);
97 void setNumericalIkMaxIterations(
int n);
98 void setNumericalIkDampingConstant(
double lambda);
99 static double numericalIkDefaultDeltaScale();
100 static int numericalIkDefaultMaxIterations();
101 static double numericalIkDefaultMaxIkError();
102 static double numericalIkDefaultDampingConstant();
104 void customizeTarget(
105 int numTargetElements,
106 std::function<
double(VectorXd& out_error)> errorFunc,
107 std::function<
void(MatrixXd& out_Jacobian)> jacobianFunc);
110 bool calcInverseKinematics();
116 virtual bool calcInverseKinematics(
const Isometry3& T)
override;
117 virtual bool calcRemainingPartForwardKinematicsForInverseKinematics()
override;
119 int numIterations()
const;
121 std::string
name()
const {
return name_; }
122 void setName(
const std::string& name){ name_ = name; }
124 [[deprecated(
"Use calcInverseKinematics(const Isometry3& T)")]]
128 [[deprecated(
"Use calcInverseKinematics(const Isometry3& T)")]]
129 bool calcInverseKinematics(
132 void calcJacobian(Eigen::MatrixXd& out_J)
const;
133 [[deprecated(
"Use hasCustomIK")]]
134 bool hasAnalyticalIK()
const;
135 [[deprecated(
"Use setCustomIkDisabled.")]]
137 [[deprecated(
"Use isCustomIkDisabled.")]]
139 [[deprecated(
"Use isBestEffortIkMode.")]]
141 [[deprecated(
"Use setBestEffortIkMode.")]]
143 [[deprecated(
"Use setNumericalIkMaxIkError.")]]
145 [[deprecated(
"Use setNumericalIkDeltaScale.")]]
147 [[deprecated(
"Use setNumericalIkMaxIterations.")]]
149 [[deprecated(
"Use setNumericalIkDampingConstant.")]]
151 [[deprecated(
"Use numericalIkDefaultDeltaScale.")]]
153 [[deprecated(
"Use numericalIkDefaultMaxIterations.")]]
155 [[deprecated(
"Use numericalIkDefaultMaxIkError.")]]
157 [[deprecated(
"Use numericalIkDefaultDampingConstant.")]]
160 void setNumericalIkTruncateRatio(
double r);
162 static double numericalIkDefaultTruncateRatio();
166 void extractJoints();
167 void doResetWhenJointPathUpdated();
168 NumericalIK* getOrCreateNumericalIK();
171 std::vector<Link*> joints_;
172 std::shared_ptr<LinkTraverse> remainingLinkTraverse;
173 NumericalIK* numericalIK;
174 int numUpwardJointConnections;
175 bool needForwardKinematicsBeforeIK;
176 bool isCustomIkDisabled_;
185 #ifdef CNOID_BACKWARD_COMPATIBILITY
186 typedef std::shared_ptr<JointPath> JointPathPtr;
LinkTraverse::iterator iterator
Definition: JointPath.h:72
void setCustomIkDisabled(bool on)
Definition: JointPath.h:91
void setNumericalIKdampingConstant(double lambda)
Definition: JointPath.h:150
void setName(const std::string &name)
Definition: JointPath.h:122
bool isJointDownward(int index) const
Definition: JointPath.h:66
int size() const
Definition: JointPath.h:42
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
Definition: LinkPath.h:14
bool isCustomIkDisabled() const
Definition: JointPath.h:90
iterator end()
Definition: JointPath.h:76
Definition: JointPath.h:23
static double numericalIKdefaultDampingConstant()
Definition: JointPath.h:158
static double numericalIKdefaultDeltaScale()
Definition: JointPath.h:152
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
void setNumericalIKdeltaScale(double s)
Definition: JointPath.h:146
void setNumericalIKmaxIKerror(double e)
Definition: JointPath.h:144
bool empty() const
Definition: JointPath.h:38
const std::vector< Link * > & joints() const
Definition: JointPath.h:70
void setBestEffortIKmode(bool on)
Definition: JointPath.h:142
Eigen::Matrix3d Matrix3
Definition: EigenTypes.h:56
const_iterator end() const
Definition: JointPath.h:78
Link * baseLink() const
Definition: JointPath.h:58
static double numericalIKdefaultMaxIKerror()
Definition: JointPath.h:156
void setNumericalIKenabled(bool on)
Definition: JointPath.h:136
std::string name() const
Definition: JointPath.h:121
const LinkPath & linkPath() const
Definition: JointPath.h:81
virtual bool calcInverseKinematics(const Isometry3 &T)=0
iterator begin()
Definition: JointPath.h:75
bool calcInverseKinematics(const Vector3 &p, const Matrix3 &R)
Definition: JointPath.h:125
LinkTraverse::const_iterator const_iterator
Definition: JointPath.h:73
Definition: AbstractSceneLoader.h:11
Link * endLink() const
Definition: JointPath.h:62
Definition: InverseKinematics.h:13
Link * joint(int index) const
Definition: JointPath.h:50
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false) const
Definition: JointPath.h:83
std::shared_ptr< JointPath > getCustomJointPath(Body *body, Link *baseLink, Link *endLink)
Definition: JointPath.h:181
container::const_iterator const_iterator
Definition: LinkTraverse.h:67
static std::shared_ptr< JointPath > getCustomPath(Body *body, Link *baseLink, Link *endLink)
Definition: JointPath.cpp:563
void setNumericalIKmaxIterations(int n)
Definition: JointPath.h:148
static int numericalIKdefaultMaxIterations()
Definition: JointPath.h:154
bool isNumericalIkEnabled() const
Definition: JointPath.h:138
const_iterator begin() const
Definition: JointPath.h:77
container::iterator iterator
Definition: LinkTraverse.h:66
int numJoints() const
Definition: JointPath.h:46
bool isBestEffortIKmode() const
Definition: JointPath.h:140
LinkPath & linkPath()
Definition: JointPath.h:80