32 #include <VirtualRobot/math/Helpers.h>
33 #include <VirtualRobot/MathTools.h>
38 float maxPositionAcceleration,
39 float maxOrientationAcceleration,
40 float maxNullspaceAcceleration,
41 const VirtualRobot::RobotNodePtr& tcp)
44 Eigen::VectorXf::Constant(rns->getSize(), 0.f),
46 maxPositionAcceleration,
47 maxOrientationAcceleration,
48 maxNullspaceAcceleration,
49 tcp ? tcp : rns->getTCP()),
50 pcTcp(tcp ? tcp : rns->getTCP()),
53 lastJointVelocity(
Eigen::VectorXf::Constant(rns->getSize(), 0.f)),
62 if (maxValue.size() == 0)
66 if (maxValue.size() != 1 && (
int)maxValue.size() != vec.rows())
68 throw std::invalid_argument(
"maxValue.size != 1 and != maxValue.size");
71 for (
int i = 0; i < vec.rows(); i++)
73 int j = maxValue.size() == 1 ? 0 : i;
74 if (
std::abs(vec(i)) > maxValue.at(j) && maxValue.at(j) >= 0)
84 Eigen::VectorXf jvNT = Eigen::VectorXf(rns->getSize());
85 for (
size_t i = 0; i < rns->getSize(); i++)
94 if (rns->getNode(i)->isLimitless())
96 diff = ::math::Helpers::AngleModPI(diff);
128 Eigen::VectorXf jnvClamped = Eigen::VectorXf::Zero(rns->getSize());
131 Eigen::VectorXf jnv = Eigen::VectorXf::Zero(rns->getSize());
139 jnv = jvElb + jvLA + jvNT;
189 for (
size_t i = 0; i < rns->getSize(); i++)
197 this->
nullspaceTarget = Eigen::VectorXf::Constant(rns->getSize(), std::nanf(
""));
232 return ::math::Helpers::GetPosition(
tcpTarget);
264 std::stringstream ss;
292 cfg.maxPositionAcceleration,
293 cfg.maxOrientationAcceleration,
294 cfg.maxNullspaceAcceleration
296 if (cfg.jointCosts.size() > 0)
304 return (
vcTcp.
controller.
ik->getJacobianMatrix(VirtualRobot::IKSolver::All) * jointVel);