11 auto handNodeSet = rtRobot->getRobotNodeSet(pair.first);
12 hands.emplace(pair.first, std::make_unique<HandData>(handNodeSet, pair.second));
20 const std::string& jointName)
23 hands.at(handNodeSet)->sensorDevices.append(sv, jointName);
26 auto* casted_ct = ct->
asA<ControlTarget1DoFActuatorPosition>();
28 hands.at(handNodeSet)->targets.push_back(casted_ct);
34 for (
auto& pair :
hands)
36 auto& hand = pair.second;
37 hand->bufferNonRTToRT.getWriteBuffer() = hand->targetNonRT;
38 hand->bufferNonRTToRT.commitWrite();
45 for (
auto& pair :
hands)
47 auto& hand = pair.second;
48 hand->targetNonRT = hand->bufferUserToNonRT.getUpToDateReadBuffer();
55 for (
auto& pair :
hands)
57 pair.second->rts.deltaT = deltaT;
58 pair.second->sensorDevices.getJointAngles(pair.second->rts.jointPosition.value());
59 pair.second->bufferRTToNonRT.getWriteBuffer() = pair.second->rts;
60 pair.second->bufferRTToNonRT.commitWrite();
67 for (
auto& pair :
hands)
69 pair.second->setTarget();
76 for (
auto& pair : cfg)
78 if (pair.second.jointPosition.has_value())
80 auto&
target =
hands.at(pair.first)->bufferUserToNonRT.getWriteBuffer();
81 target.jointPosition = pair.second.jointPosition;
82 hands.at(pair.first)->bufferUserToNonRT.commitWrite();
90 for (
auto& pair :
hands)
92 cfgToUpdate.at(pair.first) = pair.second->bufferNonRTToRT.getUpToDateReadBuffer();
99 for (
auto& pair :
hands)
101 cfgToUpdate.at(pair.first) = pair.second->targetNonRT;
102 pair.second->bufferNonRTToRT.reinitAllBuffers(pair.second->targetNonRT);
103 pair.second->bufferUserToNonRT.reinitAllBuffers(pair.second->targetNonRT);
110 for (
auto& pair :
hands)
112 ARMARX_INFO <<
"rtPreActivate for hand " << pair.first;
113 pair.second->rtPreActivate();
135 targetRT = bufferNonRTToRT.getUpToDateReadBuffer();
136 if (targetRT.jointPosition.has_value())
139 for (
size_t i = 0; i < targets.size(); i++)
141 targets[i]->position = targetRT.jointPosition.value()(i);
148 kinematicChainName(robotNodeSet->getName()),
149 jointNames(robotNodeSet->getNodeNames()),
150 nJoints(robotNodeSet->getSize()),
155 rts.jointPosition = Eigen::VectorXf::Zero(
nJoints);
156 jointLimMin = Eigen::Map<Eigen::VectorXf>(robotNodeSet->getNodeLimitsLo().data(),
nJoints);
157 jointLimMax = Eigen::Map<Eigen::VectorXf>(robotNodeSet->getNodeLimitsHi().data(),
nJoints);
166 <<
"In your class constructor, did you forget to call HandControlBase::appendDevice( "
169 sensorDevices.getJointAngles(rts.jointPosition.value());
170 rts.jointPosition.value() =
171 rts.jointPosition.value().cwiseMax(jointLimMin).cwiseMin(jointLimMax);
173 if (not targetRT.jointPosition.has_value())
175 targetRT.jointPosition = rts.jointPosition;
176 targetNonRT = targetRT;
178 ARMARX_CHECK_EQUAL(
static_cast<size_t>(targetRT.jointPosition.value().size()), nJoints);
179 bufferNonRTToRT.reinitAllBuffers(targetRT);
180 bufferRTToNonRT.reinitAllBuffers(rts);
181 bufferUserToNonRT.reinitAllBuffers(targetRT);
182 bufferRTToUser.reinitAllBuffers(targetRT);
183 ARMARX_INFO_S << kinematicChainName <<
" joints " << targetRT.jointPosition.value();