29 using namespace FindAndGraspObjectGroup;
51 maxVel = fabs(getInput<float>(
"jointMaxSpeed"));
54 if (jointNames->getSize() != targetJointValues->getSize())
56 throw LocalException(
"Sizes of joint name list and joint value list do not match!");
62 Eigen::VectorXf errorJoint(jointNames->getSize());
63 Eigen::VectorXf currentJoint(jointNames->getSize());
64 ARMARX_VERBOSE <<
"number of joints that will be set: " << jointNames->getSize() <<
", maxVel:" << maxVel <<
flush;
66 for (
int i = 0; i < jointNames->getSize(); i++)
68 currentJoint(i) = robot->getRobotNode(jointNames->getVariant(i)->getString())->getJointValue();
69 errorJoint(i) = targetJointValues->getVariant(i)->getFloat() - currentJoint(i);
104 float VEL_GAIN = 1.0f;
105 float VEL_MAX_COEFF = 0.02f;
108 float maxV = fabs(errorJoint.maxCoeff());
110 if (maxV > VEL_MAX_COEFF)
112 errorJoint = errorJoint / maxV * VEL_MAX_COEFF * VEL_GAIN;
120 NameControlModeMap controlModes;
123 for (
int i = 0; i < jointNames->getSize(); i++)
125 std::string jName = jointNames->getVariant(i)->getString();
126 targetVelocities[jName] = errorJoint(i) * VEL_GAIN;
127 targetAngles[jName] = currentJoint(i) + errorJoint(i);
128 controlModes[jName] = ePositionVelocityControl;
138 sendEvent<EvJointsActuated>();
180 std::string kinChainName = getInput<std::string>(
"kinematicChain");
186 sendEvent<Failure>();
192 sendEvent<Failure>();
197 if (!robot->hasRobotNodeSet(kinChainName))
199 ARMARX_WARNING <<
"Robot does not know kinematic chain with name " << kinChainName <<
flush;
200 sendEvent<Failure>();
203 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(kinChainName);
208 for (
unsigned int i = 0; i < rns->getSize(); i++)
210 targetJointVelocities[rns->getNode(i)->getName()] = 0;
219 return "MoveJointsVelControl";