3 #include <SimoxUtility/math/convert/mat4f_to_quat.h>
4 #include <VirtualRobot/MathTools.h>
17 const VirtualRobot::RobotNodeSetPtr& rns,
18 const VirtualRobot::RobotNodeSetPtr& rtRns,
19 const std::vector<size_t>& torqueControlledIndex,
20 const std::vector<size_t>& velocityControlledIndex)
32 rtTCP = rtRns->getTCP();
34 ik.reset(
new VirtualRobot::DifferentialIK(
35 rtRns, rtRns->getRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
42 const VirtualRobot::RobotNodeSetPtr& rns)
54 const std::vector<std::string>& nameList,
55 const std::map<std::string, std::string>& jointControlModeMap)
57 std::set<std::string> validModes = {
"velocity",
"torque"};
59 for (
const auto& pair : jointControlModeMap)
61 if (std::find(nameList.begin(), nameList.end(), pair.first) == nameList.end())
63 ARMARX_ERROR <<
"TaskspaceMixedImpedanceVelocityController: joint name '"
64 << pair.first <<
"' not found in robot node set.";
68 if (validModes.find(pair.second) == validModes.end())
71 <<
"TaskspaceMixedImpedanceVelocityController: Invalid control mode for joint '"
72 << pair.first <<
"': " << pair.second << std::endl;
112 c.desiredPose.block<3, 3>(0, 0) * rtStatus.
currentPose.block<3, 3>(0, 0).transpose();
123 else if ((
c.desiredPose.block<3, 1>(0, 3) - rtStatus.
currentPose.block<3, 1>(0, 3)).norm() >
124 c.safeDistanceMMToGoal or
127 VirtualRobot::MathTools::deg2rad(
c.safeRotAngleDegreeToGoal))
142 ik->getJacobianMatrix(
rtTCP, VirtualRobot::IKSolver::CartesianSelection::All);
147 rtStatus.
jpinv = ik->computePseudoInverseJacobianMatrix(
148 rtStatus.
jacobi, ik->getJacobiRegularization(VirtualRobot::IKSolver::CartesianSelection::All));
156 ik->computePseudoInverseJacobianMatrix(rtStatus.
jacobi.transpose(), lambda);
206 c.desiredNullspaceJointAngles.value() - rtStatus.
jointPos) -
207 c.kdNullspaceTorque.cwiseProduct(rtStatus.
jointVel);
209 c.kpNullspaceVel.cwiseProduct(
c.desiredNullspaceJointAngles.value() -
238 const size_t numDoFTorque,
239 const size_t numDoFVelocity)
282 jpinv.setZero(nDoF, 6);
293 currentPose = currentTCPPose;
294 desiredPose = currentTCPPose;