32 const VirtualRobot::RobotNodePtr& referenceFrame)
33 : tcp(tcp), referenceFrame(referenceFrame ? referenceFrame : tcp->getRobot()->getRootNode())
42 Eigen::VectorXf cartesianVel(posLen + oriLen);
47 Eigen::Vector3f targetPos = targetPose.block<3, 1>(0, 3);
48 Eigen::Vector3f currentPos = tcp->getPositionInFrame(referenceFrame);
49 Eigen::Vector3f errPos = targetPos - currentPos;
50 Eigen::Vector3f posVel = errPos *
KpPos;
55 cartesianVel.block<3, 1>(0, 0) = posVel;
62 Eigen::Matrix3f tcpOri = tcp->getPoseInFrame(referenceFrame).block<3, 3>(0, 0);
64 Eigen::AngleAxisf aa(oriDir);
65 Eigen::Vector3f errOri = aa.axis() * aa.angle();
66 Eigen::Vector3f oriVel = errOri *
KpOri;
72 cartesianVel.block<3, 1>(posLen, 0) = oriVel;
80 Eigen::VectorXf cartesianVel(3);
81 Eigen::Vector3f currentPos = tcp->getPositionInFrame(referenceFrame);
82 Eigen::Vector3f errPos = targetPos - currentPos;
83 Eigen::Vector3f posVel = errPos *
KpPos;
89 cartesianVel.block<3, 1>(0, 0) = posVel;
104 const VirtualRobot::RobotNodePtr& tcp,
105 const VirtualRobot::RobotNodePtr& referenceFrame)
108 Eigen::Vector3f targetPos = targetPose.block<3, 1>(0, 3);
109 Eigen::Vector3f tcpPos = referenceFrame ? tcp->getPositionInFrame(referenceFrame) : tcp->getPositionInRootFrame();
110 Eigen::Vector3f errPos = targetPos - tcpPos;
111 return errPos.norm();
115 const VirtualRobot::RobotNodePtr& tcp,
116 const VirtualRobot::RobotNodePtr& referenceFrame)
120 Eigen::Matrix4f tcpPose = referenceFrame ? tcp->getPoseInFrame(referenceFrame) : tcp->getPoseInRootFrame();
123 Eigen::AngleAxisf aa(oriDir);
128 const VirtualRobot::RobotNodePtr& tcp,
130 float thresholdPosReached,
131 float thresholdOriReached,
132 const VirtualRobot::RobotNodePtr& referenceFrame)
134 return GetPositionError(targetPose, tcp, referenceFrame) < thresholdPosReached
135 && (!checkOri ||
GetOrientationError(targetPose, tcp, referenceFrame) < thresholdOriReached);
143 if (
GetPositionError(targetPose, tcp, referenceFrame) > thresholdPosReached)
161 Eigen::Vector3f targetPos = targetPose.block<3, 1>(0, 3);
162 return targetPos - tcp->getPositionInFrame(referenceFrame);
167 return targetPosition - tcp->getPositionInFrame(referenceFrame);
174 Eigen::Matrix3f tcpOri = tcp->getPoseInFrame(referenceFrame).block<3, 3>(0, 0);
176 Eigen::AngleAxisf aa(oriDir);
177 return aa.axis() * aa.angle();
187 #define SS_OUT(x) ss << #x << " = " << x << "\n"
188 #define SET_FLT(x) obj->setFloat(#x, x)
189 #define GET_FLT(x) x = obj->getFloat(#x);
197 std::stringstream ss;
203 SS_OUT(thresholdOrientationNear);
204 SS_OUT(thresholdOrientationReached);
205 SS_OUT(thresholdPositionNear);
206 SS_OUT(thresholdPositionReached);
219 SET_FLT(thresholdOrientationNear);
220 SET_FLT(thresholdOrientationReached);
221 SET_FLT(thresholdPositionNear);
222 SET_FLT(thresholdPositionReached);
234 GET_FLT(thresholdOrientationNear);
235 GET_FLT(thresholdOrientationReached);
236 GET_FLT(thresholdPositionNear);
237 GET_FLT(thresholdPositionReached);