26 #include "../MotionControlGroupStatechartContext.h"
29 using namespace MotionControlGroup;
46 auto targetValues = in.getJointTargetValues();
48 float jointVelocity = 0;
50 if (isInputParameterSet(
"JointVelocity"))
52 jointVelocity = in.getJointVelocity();
57 NameControlModeMap jointControlModes;
59 for (
auto& pair : targetValues)
61 targetVelocities[pair.first] = jointVelocity;
62 jointControlModes[pair.first] = ePositionControl;
66 if (isInputParameterSet(
"JointVelocities"))
68 auto givenVelocities = in.getJointVelocities();
70 for (
auto& pair : givenVelocities)
72 targetVelocities[pair.first] = pair.second;
76 std::set<std::string> blacklist;
78 float tolerance = in.getJointTargetTolerance();
80 for (
auto& pair : targetValues)
84 if (!dataFieldIdentifier)
86 ARMARX_WARNING <<
"Could not generate DataFieldIdentifier from '" << pair.first <<
"'";
87 blacklist.insert(pair.first);
93 if (!dataField || !dataField->getInitialized())
95 ARMARX_WARNING <<
"Could not obtain DataField of '" << pair.first <<
"'";
96 blacklist.insert(pair.first);
100 float currentValue = dataField->getFloat();
102 if (currentValue >= pair.second - tolerance && currentValue <= pair.second + tolerance)
105 targetVelocities[pair.first] = 0;
109 targetVelocities[pair.first] = fabs(targetVelocities[pair.first]);
115 bool stillWaitingForJoint =
false;
117 for (
auto& pair : targetValues)
119 if (blacklist.find(pair.first) != blacklist.end())
127 if (targetVelocities[pair.first] == 0)
134 condition = condition || approx;
136 stillWaitingForJoint =
true;
139 if (stillWaitingForJoint)
141 installConditionForJointReachedTarget(condition);
145 int timeout = in.getTimeout();
149 setTimeoutEvent(timeout, createEventTimeout());
159 if (!stillWaitingForJoint)