Skip to content
Snippets Groups Projects
Commit 24ec42a4 authored by Fabian Paus's avatar Fabian Paus
Browse files

SimpleDiffIK: Update all joint values at once and not per node

Improves performance significantly, since for every joint angle update Simox will recursively update all node poses.
Now, this update is only done once
parent 8c53a522
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ SimpleDiffIK::Result SimpleDiffIK::CalculateDiffIK(const Eigen::Matrix4f targetP
CartesianVelocityController velocityController(rns);
CartesianPositionController positionController(tcp);
Eigen::VectorXf currentJointValues = rns->getJointValuesEigen();
for (size_t i = 0; i <= params.stepsInitial + params.stepsFineTune; i++)
{
Eigen::Vector3f posDiff = positionController.getPositionDiff(targetPose);
......@@ -51,10 +52,9 @@ SimpleDiffIK::Result SimpleDiffIK::CalculateDiffIK(const Eigen::Matrix4f targetP
float stepLength = i < params.stepsInitial ? params.ikStepLengthInitial : params.ikStepLengthFineTune;
jv = jv * stepLength;
for (size_t n = 0; n < rns->getSize(); n++)
{
rns->getNode(n)->setJointValue(rns->getNode(n)->getJointValue() + jv(n));
}
Eigen::VectorXf newJointValues = currentJointValues + jv;
rns->setJointValues(newJointValues);
currentJointValues = newJointValues;
}
Result result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment