diff --git a/VirtualRobot/IK/DifferentialIK.cpp b/VirtualRobot/IK/DifferentialIK.cpp index a37240e9d055530f97bd888f008b17ea1b893fdd..1c64868f1abd9d3e90302fff7eda7610c12533a1 100644 --- a/VirtualRobot/IK/DifferentialIK.cpp +++ b/VirtualRobot/IK/DifferentialIK.cpp @@ -384,9 +384,6 @@ namespace VirtualRobot const bool isParent = std::find(p.begin(), p.end(), dof) != p.end(); if (isParent) { - bool isHemisphere = dof->isHemisphereJoint(); - std::cout << "isHemisphere: " << isHemisphere << std::endl; - // Calculus for rotational joints is different as for prismatic joints. if (dof->isRotationalJoint()) { @@ -454,19 +451,20 @@ namespace VirtualRobot VR_ASSERT(hemisphere->first.has_value() xor hemisphere->second.has_value()); - if (hemisphere->isFirstHemisphereJointNode()) - { - // Nothing to do - everything is handled by second DoF. - } - else + if (hemisphere->isSecondHemisphereJointNode()) { - VR_ASSERT(hemisphere->isSecondHemisphereJointNode()); - // Set Jacobian for both DoFs. - const RobotNodeHemisphere::SecondData& second = hemisphere->getSecondData(); + RobotNodeHemisphere::SecondData& second = hemisphere->getSecondData(); const hemisphere::Maths::Jacobian jacobian = second.getJacobian(); - tmpUpdateJacobianPosition.block<6, 2>(0, i - 1) = jacobian.cast<float>(); + tmpUpdateJacobianPosition.block<3, 2>(0, i - 1) + = jacobian.block<3, 2>(0, 0).cast<float>(); + tmpUpdateJacobianOrientation.block<3, 2>(0, i - 1) + = jacobian.block<3, 2>(3, 0).cast<float>(); + } + else + { + // Nothing to do - everything is handled by second DoF. } } } diff --git a/VirtualRobot/Nodes/RobotNodeHemisphere.cpp b/VirtualRobot/Nodes/RobotNodeHemisphere.cpp index 5177eb2874f76b22b70f5bc23c022ab485d06ff6..2e6d5231ca8e73c3ef4bbd93a65e7d65cab68693 100644 --- a/VirtualRobot/Nodes/RobotNodeHemisphere.cpp +++ b/VirtualRobot/Nodes/RobotNodeHemisphere.cpp @@ -366,12 +366,12 @@ namespace VirtualRobot return firstNode->firstData->maths; } - hemisphere::Maths::Jacobian RobotNodeHemisphere::SecondData::getJacobian() const + hemisphere::Maths::Jacobian RobotNodeHemisphere::SecondData::getJacobian() { VR_ASSERT(firstNode); VR_ASSERT(secondNode); - hemisphere::CachedMaths& maths = firstNode->firstData->maths; + hemisphere::CachedMaths& maths = this->maths(); Eigen::Vector2f actuators(firstNode->getJointValue(), secondNode->getJointValue()); maths.update(actuators); diff --git a/VirtualRobot/Nodes/RobotNodeHemisphere.h b/VirtualRobot/Nodes/RobotNodeHemisphere.h index c1d969f226b9fca2c2c8f7913c86a00fdb653908..e041fad9c52183825dfefb09370b5e2f0e9965be 100644 --- a/VirtualRobot/Nodes/RobotNodeHemisphere.h +++ b/VirtualRobot/Nodes/RobotNodeHemisphere.h @@ -90,7 +90,7 @@ namespace VirtualRobot hemisphere::CachedMaths& maths(); const hemisphere::CachedMaths& maths() const; - hemisphere::Maths::Jacobian getJacobian() const; + hemisphere::Maths::Jacobian getJacobian(); }; friend class RobotFactory;