30 using namespace CoupledInteractionGroup;
54 float deviationForce = (curForce->
toEigen() - refForces->toEigen()).
norm();
55 float deviationTorque = (curTorque->
toEigen() - refTorques->toEigen()).
norm();
57 if (deviationForce > forceThreshhold && deviationTorque > torqueThreshhold)
72 std::string leftTcpName = in.getLeftHandName();
73 std::string rightTcpName = in.getRightHandName();
82 float maxDisplacement = in.getMaxDisplacement();
83 bool maxDisplacementReached =
false;
84 Eigen::Matrix4f leftTcpPoseBase = context->
getRobot()->getRobotNode(in.getLeftHandName())->getPoseInRootFrame();
85 Eigen::Matrix4f rightTcpPoseBase = context->
getRobot()->getRobotNode(in.getRightHandName())->getPoseInRootFrame();
86 float leftDisplacement = (leftTcpPoseBase(0, 3) - leftInitPos->x) * (leftTcpPoseBase(0, 3) - leftInitPos->x);
87 leftDisplacement += (leftTcpPoseBase(1, 3) - leftInitPos->y) * (leftTcpPoseBase(1, 3) - leftInitPos->y);
88 leftDisplacement += (leftTcpPoseBase(2, 3) - leftInitPos->z) * (leftTcpPoseBase(2, 3) - leftInitPos->z);
89 leftDisplacement = fabs(leftTcpPoseBase(2, 3) - leftInitPos->z);
90 float rightDisplacement = (rightTcpPoseBase(0, 3) - rightInitPos->x) * (rightTcpPoseBase(0, 3) - rightInitPos->x);
91 rightDisplacement += (rightTcpPoseBase(1, 3) - rightInitPos->y) * (rightTcpPoseBase(1, 3) - rightInitPos->y);
92 rightDisplacement += (rightTcpPoseBase(2, 3) - rightInitPos->z) * (rightTcpPoseBase(2, 3) - rightInitPos->z);
93 rightDisplacement = fabs(rightTcpPoseBase(2, 3) - rightInitPos->z);
95 if (leftDisplacement > maxDisplacement || rightDisplacement > maxDisplacement)
97 maxDisplacementReached =
true;
100 ARMARX_INFO <<
"Place Table displacements " << leftDisplacement <<
" " << maxDisplacement <<
" " << rightDisplacement <<
" " << maxDisplacement;
101 float minForceThreshold = in.getMinForceThreshhold();
102 float velocityInmms = in.getVelocityInMillimetersSecond();
104 if (maxDisplacementReached)
106 out.setRightHandStopped(in.getRightHandStopped());
107 out.setLeftHandStopped(in.getLeftHandStopped());
108 out.setLeftHandChecked(
true);
109 out.setRightHandChecked(
true);
110 Eigen::Vector3f handPositionVelocity;
111 handPositionVelocity << 0, 0, 0;
112 Eigen::Vector3f handOrientationVelocity;
113 handOrientationVelocity << 0, 0, 0;
115 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
116 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
122 if (in.getLeftHandChecked())
127 if (in.getRightHandChecked())
132 if (in.getLeftHandStopped())
137 if (in.getLeftHandStopped())
142 if (!in.getLeftHandStopped() && !in.getLeftHandChecked())
144 out.setRightHandStopped(in.getRightHandStopped());
146 if (in.getRightHandStopped())
148 out.setLeftHandChecked(
false);
152 out.setLeftHandChecked(
true);
155 out.setRightHandChecked(
false);
159 Eigen::Vector3f handPositionVelocity;
160 handPositionVelocity << 0, 0, 0;
161 Eigen::Vector3f handOrientationVelocity;
162 handOrientationVelocity << 0, 0, 0;
164 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
165 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
166 out.setLeftHandStopped(
true);
168 emitEvForcesLeftHandChanged();
173 Eigen::Vector3f handPositionVelocity;
174 handPositionVelocity << 0, 0, -velocityInmms;
175 Eigen::Vector3f handOrientationVelocity;
176 handOrientationVelocity << 0, 0, 0;
177 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
178 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
179 out.setLeftHandStopped(in.getLeftHandStopped());
180 emitEvForcesLeftHandNotChanged();
184 else if (!in.getRightHandStopped() && !in.getRightHandChecked())
186 out.setLeftHandStopped(in.getLeftHandStopped());
188 if (in.getLeftHandStopped())
190 out.setRightHandChecked(
false);
194 out.setRightHandChecked(
true);
197 out.setLeftHandChecked(
false);
201 Eigen::Vector3f handPositionVelocity;
202 handPositionVelocity << 0, 0, 0;
203 Eigen::Vector3f handOrientationVelocity;
204 handOrientationVelocity << 0, 0, 0;
206 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
207 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
208 out.setRightHandStopped(
true);
209 emitEvForcesRightHandChanged();
214 Eigen::Vector3f handPositionVelocity;
215 handPositionVelocity << 0, 0, -velocityInmms;
216 Eigen::Vector3f handOrientationVelocity;
217 handOrientationVelocity << 0, 0, 0;
218 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
219 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
220 out.setRightHandStopped(in.getRightHandStopped());
221 emitEvForcesRightHandNotChanged();
225 else if ((in.getRightHandStopped() && in.getLeftHandStopped()))
227 out.setRightHandStopped(in.getRightHandStopped());
228 out.setLeftHandStopped(in.getLeftHandStopped());
229 out.setLeftHandChecked(
true);
230 out.setRightHandChecked(
true);
231 Eigen::Vector3f handPositionVelocity;
232 handPositionVelocity << 0, 0, 0;
233 Eigen::Vector3f handOrientationVelocity;
234 handOrientationVelocity << 0, 0, 0;
236 out.setNewHandPositionVelocity(
FramedDirection(handPositionVelocity,
"Armar3_Base",
"Armar3"));
237 out.setNewHandOrientationVelocity(
FramedDirection(handOrientationVelocity,
"Armar3_Base",
"Armar3"));
270 return "CheckForcesChanged";