30 using namespace FindAndGraspObjectGroup;
33 MoveJointsVelControl::SubClassRegistry
49 getInput<SingleTypeVariantList>(
"targetJointValues");
54 maxVel = fabs(getInput<float>(
"jointMaxSpeed"));
57 if (jointNames->getSize() != targetJointValues->getSize())
59 throw LocalException(
"Sizes of joint name list and joint value list do not match!");
66 Eigen::VectorXf errorJoint(jointNames->getSize());
67 Eigen::VectorXf currentJoint(jointNames->getSize());
68 ARMARX_VERBOSE <<
"number of joints that will be set: " << jointNames->getSize()
69 <<
", maxVel:" << maxVel <<
flush;
71 for (
int i = 0; i < jointNames->getSize(); i++)
74 robot->getRobotNode(jointNames->getVariant(i)->getString())->getJointValue();
75 errorJoint(i) = targetJointValues->getVariant(i)->getFloat() - currentJoint(i);
110 float VEL_GAIN = 1.0f;
111 float VEL_MAX_COEFF = 0.02f;
114 float maxV = fabs(errorJoint.maxCoeff());
116 if (maxV > VEL_MAX_COEFF)
118 errorJoint = errorJoint / maxV * VEL_MAX_COEFF * VEL_GAIN;
126 NameControlModeMap controlModes;
129 for (
int i = 0; i < jointNames->getSize(); i++)
131 std::string jName = jointNames->getVariant(i)->getString();
132 targetVelocities[jName] = errorJoint(i) * VEL_GAIN;
133 targetAngles[jName] = currentJoint(i) + errorJoint(i);
134 controlModes[jName] = ePositionVelocityControl;
144 sendEvent<EvJointsActuated>();
187 std::string kinChainName = getInput<std::string>(
"kinematicChain");
193 sendEvent<Failure>();
199 sendEvent<Failure>();
204 if (!robot->hasRobotNodeSet(kinChainName))
206 ARMARX_WARNING <<
"Robot does not know kinematic chain with name " << kinChainName <<
flush;
207 sendEvent<Failure>();
210 VirtualRobot::RobotNodeSetPtr rns = robot->getRobotNodeSet(kinChainName);
215 for (
unsigned int i = 0; i < rns->getSize(); i++)
217 targetJointVelocities[rns->getNode(i)->getName()] = 0;
227 return "MoveJointsVelControl";