37 reportedJointVelocitiesBool =
false;
38 reportedJointAnglesBool =
false;
51 std::string headIKName,
54 std::scoped_lock lock(
mutex);
56 this->robotStateComponent = robotStateComponent;
80 headJointNames = {
"Neck_1_joint",
90 headJointNames = {
"Neck_1_Pitch",
"Neck_2_Roll",
"Neck_3_Yaw",
"Cameras",
"Eye_Right"};
98 std::scoped_lock lock(dataMutex);
101 if (!(reportedJointAnglesBool && reportedJointVelocitiesBool))
103 ARMARX_WARNING_S <<
"Try to access gaze stab input that haven't been reported";
111 PoseBasePtr globalPose = robotStateComponent->getSynchronizedRobot()
112 ->getRobotNode(
"Torso_Yaw_joint")
121 globalPose->position->x;
122 gs_input->
q_LB[1] = globalPose->position->y;
123 gs_input->
q_LB[2] = globalPose->position->z;
125 gs_input->
q_LB[3] = rpy(0);
126 gs_input->
q_LB[4] = rpy(1);
127 gs_input->
q_LB[5] = rpy(2);
129 gs_input->
q_LB[6] = this->reportedJointAngles[
"Torso_Yaw_joint"];
130 gs_input->
q_LB[7] = -1 * this->reportedJointAngles[
"Torso_Pitch_joint"];
141 gs_input->
qd_LB_des[6] = -1 * this->reportedJointVelocities[
"Torso_Yaw_joint"];
142 gs_input->
qd_LB_des[7] = this->reportedJointVelocities[
"Torso_Pitch_joint"];
146 PoseBasePtr globalPose = robotStateComponent->getSynchronizedRobot()->getGlobalPose();
152 gs_input->
q_LB[0] = globalPose->position->x / 1000.;
153 gs_input->
q_LB[1] = globalPose->position->y / 1000.;
154 gs_input->
q_LB[2] = globalPose->position->z / 1000.;
156 gs_input->
q_LB[3] = rpy(0);
157 gs_input->
q_LB[4] = rpy(1);
158 gs_input->
q_LB[5] = rpy(2);
160 gs_input->
q_LB[6] = 0.;
161 gs_input->
q_LB[7] = this->reportedJointAngles[
"Hip Pitch"];
162 gs_input->
q_LB[8] = this->reportedJointAngles[
"Hip Roll"];
163 gs_input->
q_LB[9] = this->reportedJointAngles[
"Hip Yaw"];
174 gs_input->
qd_LB_des[7] = -1 * this->reportedJointVelocities[
"Hip Pitch"];
175 gs_input->
qd_LB_des[8] = -1 * this->reportedJointVelocities[
"Hip Roll"];
176 gs_input->
qd_LB_des[9] = this->reportedJointVelocities[
"Hip Yaw"];
179 for (
int i = 0; i < 10; i++)
185 for (
size_t i = 0; i < headJointNames.size(); i++)
187 gs_input->
q_UB[i] = this->reportedJointAngles[headJointNames[i]];
188 gs_input->
qd_UB[i] = this->reportedJointVelocities[headJointNames[i]];
194 gs_input->
q_UB[0] *= -1;
195 gs_input->
q_UB[1] *= -1;
196 gs_input->
q_UB[6] *= -1;
212 std::map<std::string, float> targetJointAngles;
214 for (
size_t i = 0; i < headJointNames.size(); i++)
216 targetJointAngles[headJointNames[i]] = gs_output->
qd_UB_des[i];
220 targetJointAngles[headJointNames[0]] *= -1;
221 targetJointAngles[headJointNames[1]] *= -1;
222 targetJointAngles[headJointNames[6]] *= -1;
226 targetJointAngles[
"Eye_Left"] = targetJointAngles[
"Eye_Right"];
229 std::scoped_lock lock(
mutex);
237 std::scoped_lock lock(
mutex);
239 this->armar4 = armar4;
240 this->velocityBased = velocityBased;
246 const Ice::Current&
c)
248 std::scoped_lock lock(dataMutex);
250 reportedJointAnglesBool =
true;
251 this->reportedJointAngles =
values;
257 const Ice::Current&
c)
259 std::scoped_lock lock(dataMutex);
261 reportedJointVelocitiesBool =
true;
262 this->reportedJointVelocities =
values;
275 const FramedPositionBasePtr& targetPosition)
277 std::scoped_lock lock(dataMutex);
279 globalPos = FramedPositionPtr::dynamicCast(targetPosition);
281 Eigen::Vector3f x = globalPos->toEigen() / 1000.0f;
289 std::scoped_lock lock(dataMutex);
292 reportedJointVelocitiesBool =
false;
293 reportedJointAnglesBool =
false;