36 float infNorm = vec.lpNorm<Eigen::Infinity>();
37 if (infNorm > maxValue)
39 vec = vec / infNorm * maxValue;
55 for (VirtualRobot::RobotNodePtr rn : rns->getAllRobotNodes())
57 if (rn->isLimitless())
63 rn->setJointValue((rn->getJointLimitHi() + rn->getJointLimitLo()) / 2);
76 std::vector<IKStep> ikSteps;
77 Eigen::VectorXf currentJointValues = rns->getJointValuesEigen();
84 Eigen::Vector3f pdTcp = posLen ? pcTcp.
getPositionDiff(targetPose) : Eigen::Vector3f::Zero();
85 Eigen::Vector3f odTcp = oriLen ? pcTcp.
getOrientationDiff(targetPose) : Eigen::Vector3f::Zero();
86 Eigen::VectorXf cartesianVel(posLen + oriLen);
89 cartesianVel.block<3, 1>(0, 0) = pdTcp;
93 cartesianVel.block<3, 1>(posLen, 0) = odTcp;
97 Eigen::VectorXf cartesianVelElb(3);
98 cartesianVelElb.block<3, 1>(0, 0) = pdElb;
101 Eigen::VectorXf jv = vcTcp.
calculate(cartesianVel, jvElb + jvLA, mode);
105 Eigen::VectorXf jvClamped = jv * stepLength;
114 s.tcpPose = tcp->getPoseInRootFrame();
115 s.elbPose = elbow->getPoseInRootFrame();
116 s.cartesianVel = cartesianVel;
117 s.cartesianVelElb = cartesianVelElb;
121 s.jvClamped = jvClamped;
122 ikSteps.emplace_back(
s);
126 Eigen::VectorXf newJointValues = currentJointValues + jvClamped;
127 rns->setJointValues(newJointValues);
128 currentJointValues = newJointValues;
148 if (posMet > 2 && oriMet > 2)
169 for (
size_t i = 0; i < rns->getSize(); i++)
171 VirtualRobot::RobotNodePtr rn = rns->getNode(i);
172 if (rn->isLimitless())
178 result.
jointLimitMargins(i) =
std::min(rn->getJointValue() - rn->getJointLimitLo(), rn->getJointLimitHi() - rn->getJointValue());