21 std::vector<std::string> tcpNodeNames;
22 for (
auto& pair : rtCfg.ctrlCfg)
24 const auto nodeset = rtRobot->getRobotNodeSet(pair.first);
25 std::string tcpName = nodeset->getTCP()->getName();
26 tcpNodeNames.push_back(tcpName);
27 if (pair.second.distanceThreshold > preFilterDistance)
29 preFilterDistance = pair.second.distanceThreshold;
37 rtRobot->getRobotNodeSet(rtCfg.actuatedRobotNodeSetName)->getNodeNames();
40 const bool reduceModel =
true;
51 collisionPairs = std::make_shared<DistanceResults>(rtCfg.maxCollisionPairs);
68 auto node = rtRobot->getRobotNode(nodeName);
69 if (node->isTranslationalJoint())
73 ARMARX_INFO <<
"-- adding translation joint " << nodeName
74 <<
" with scaling 0.001 from mm to meter";
80 for (
auto& pair : rtCfg.ctrlCfg)
83 std::make_shared<CollisionAvoidanceArmData>(rtRobot,
99 const std::string& robotNodeSetName,
104 nodeSetName(robotNodeSetName),
105 rtRNS(rtRobot->getRobotNodeSet(robotNodeSetName)),
108 collisionPairsPtr(collisionPairs),
111 simoxReducedRobotPtr(simoxReducedRobot)
125 c.ctrlCfg.at(robotNodeSetName),
controller.numOfJoints,
c.maxCollisionPairs,
rtRNS);
126 inertiaPtr = std::make_shared<simox::control::geodesics::metric::Inertia>(
127 *simoxControlRobot, robotNodeSetName);
137 std::fill(pointsOnArm->begin(), pointsOnArm->end(), -1);
138 pointsOnArmIndex = 0;
140 c.ctrlCfg.at(rtRNS->getName()),
controller.numOfJoints,
c.maxCollisionPairs, rtRNS);
148 pair.second->rts.rtPreActivate();
157 pair.second->reset(rtCfg);
174 ->getJointValuesEigen()
194 double timeMeasure = IceUtil::Time::now().toMicroSecondsDouble();
206 double collisionPairTime = IceUtil::Time::now().toMicroSecondsDouble() - timeMeasure;
211 pair.second->pointsOnArmIndex = 0;
212 pair.second->rts.collisionPairTime = collisionPairTime;
222 timeMeasure = IceUtil::Time::now().toMicroSecondsDouble();
228 if (
static_cast<float>(
collisionPairs->at(i).minDistance) <= preFilterDistance)
235 auto& arm = pair.second;
236 if (arm->pointsOnArmIndex >= rtCfg.maxCollisionPairs)
238 if (std::find(arm->jointNames.begin(),
239 arm->jointNames.end(),
246 arm->pointsOnArm->at(arm->pointsOnArmIndex) = i;
247 arm->pointsOnArmIndex++;
249 else if (std::find(arm->jointNames.begin(),
250 arm->jointNames.end(),
254 arm->pointsOnArm->at(arm->pointsOnArmIndex) = i;
255 arm->pointsOnArmIndex++;
261 double preFilterTime = IceUtil::Time::now().toMicroSecondsDouble() - timeMeasure;
263 if (preFilterTime > 100 or collisionPairTime > 100)
266 "preFilterTime: %.2f\n"
267 "collisionPairTime: %.2f\n",
270 .deactivateSpam(1.0f);
276 Eigen::VectorXf& qpos,
277 Eigen::VectorXf& qvelFiltered,
279 Eigen::VectorXf& impedanceJointTorque)
281 auto& arm =
collLimb.at(robotNodeSetName);
283 for (
size_t i = arm->pointsOnArmIndex; i < arm->pointsOnArm->size(); ++i)
285 arm->pointsOnArm->at(i) = -1;
290 ARMARX_CHECK_EQUAL(arm->rts.impedanceJointTorque.size(), impedanceJointTorque.size());
291 arm->rts.impedanceJointTorque = impedanceJointTorque;
292 arm->controller.run(rtCfg.ctrlCfg.at(robotNodeSetName),
294 arm->collisionPairsPtr,
296 arm->pointsOnArmIndex,
302 arm->bufferRTtoPublish.getWriteBuffer() = arm->rts;
303 arm->bufferRTtoPublish.commitWrite();
312 for (
auto& pair : cfg.ctrlCfg)