36 reportedJointVelocitiesBool =
false;
37 reportedJointAnglesBool =
false;
51 std::scoped_lock lock(
mutex);
53 this->robotStateComponent = robotStateComponent;
105 std::scoped_lock lock(dataMutex);
108 if (!(reportedJointAnglesBool && reportedJointVelocitiesBool))
110 ARMARX_WARNING_S <<
"Try to access gaze stab input that haven't been reported";
118 PoseBasePtr globalPose = robotStateComponent->getSynchronizedRobot()->getRobotNode(
"Torso_Yaw_joint")->getGlobalPose();
124 gs_input->
q_LB[0] = globalPose->position->x;
125 gs_input->
q_LB[1] = globalPose->position->y;
126 gs_input->
q_LB[2] = globalPose->position->z;
128 gs_input->
q_LB[3] = rpy(0);
129 gs_input->
q_LB[4] = rpy(1);
130 gs_input->
q_LB[5] = rpy(2);
132 gs_input->
q_LB[6] = this->reportedJointAngles[
"Torso_Yaw_joint"];
133 gs_input->
q_LB[7] = -1 * this->reportedJointAngles[
"Torso_Pitch_joint"];
144 gs_input->
qd_LB_des[6] = -1 * this->reportedJointVelocities[
"Torso_Yaw_joint"];
145 gs_input->
qd_LB_des[7] = this->reportedJointVelocities[
"Torso_Pitch_joint"];
149 PoseBasePtr globalPose = robotStateComponent->getSynchronizedRobot()->getGlobalPose();
154 gs_input->
q_LB[0] = globalPose->position->x / 1000.;
155 gs_input->
q_LB[1] = globalPose->position->y / 1000.;
156 gs_input->
q_LB[2] = globalPose->position->z / 1000.;
158 gs_input->
q_LB[3] = rpy(0);
159 gs_input->
q_LB[4] = rpy(1);
160 gs_input->
q_LB[5] = rpy(2);
162 gs_input->
q_LB[6] = 0.;
163 gs_input->
q_LB[7] = this->reportedJointAngles[
"Hip Pitch"];
164 gs_input->
q_LB[8] = this->reportedJointAngles[
"Hip Roll"];
165 gs_input->
q_LB[9] = this->reportedJointAngles[
"Hip Yaw"];
176 gs_input->
qd_LB_des[7] = -1 * this->reportedJointVelocities[
"Hip Pitch"];
177 gs_input->
qd_LB_des[8] = -1 * this->reportedJointVelocities[
"Hip Roll"];
178 gs_input->
qd_LB_des[9] = this->reportedJointVelocities[
"Hip Yaw"];
181 for (
int i = 0; i < 10; i++)
188 for (
size_t i = 0; i < headJointNames.size(); i++)
190 gs_input->
q_UB[i] = this->reportedJointAngles[headJointNames[i]];
191 gs_input->
qd_UB[i] = this->reportedJointVelocities[headJointNames[i]];
197 gs_input->
q_UB[0] *= -1;
198 gs_input->
q_UB[1] *= -1;
199 gs_input->
q_UB[6] *= -1;
215 std::map<std::string, float> targetJointAngles;
217 for (
size_t i = 0; i < headJointNames.size(); i++)
219 targetJointAngles[headJointNames[i]] = gs_output->
qd_UB_des[i];
223 targetJointAngles[headJointNames[0]] *= -1;
224 targetJointAngles[headJointNames[1]] *= -1;
225 targetJointAngles[headJointNames[6]] *= -1;
229 targetJointAngles[
"Eye_Left"] = targetJointAngles[
"Eye_Right"];
233 std::scoped_lock lock(
mutex);
241 std::scoped_lock lock(
mutex);
243 this->armar4 = armar4;
244 this->velocityBased = velocityBased;
249 std::scoped_lock lock(dataMutex);
251 reportedJointAnglesBool =
true;
252 this->reportedJointAngles =
values;
258 std::scoped_lock lock(dataMutex);
260 reportedJointVelocitiesBool =
true;
261 this->reportedJointVelocities =
values;
275 std::scoped_lock lock(dataMutex);
277 globalPos = FramedPositionPtr::dynamicCast(targetPosition);
279 Eigen::Vector3f x = globalPos->toEigen() / 1000.0f;
287 std::scoped_lock lock(dataMutex);
290 reportedJointVelocitiesBool =
false;
291 reportedJointAnglesBool =
false;