Skip to content

Commit c0c6a4f

Browse files
kutipa-kut
authored andcommitted
update comparePoses function with better comparison
1 parent 62ae86e commit c0c6a4f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/moveit_custom_api.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ bool MoveitCustomApi::
4343
double delta_posistion,
4444
double delta_orientation)
4545
{
46-
tf::Quaternion q1, q2;
47-
tf::quaternionMsgToTF(pose1.orientation, q1);
48-
tf::quaternionMsgToTF(pose2.orientation, q2);
49-
5046
if (abs(pose1.position.x - pose2.position.x) <= delta_posistion &&
5147
abs(pose1.position.y - pose2.position.y) <= delta_posistion &&
5248
abs(pose1.position.z - pose2.position.z) <= delta_posistion &&
@@ -59,8 +55,13 @@ bool MoveitCustomApi::
5955
}
6056
else
6157
{
62-
ROS_WARN_STREAM("Expected delty pos " << delta_posistion << " vs actual (" << abs(pose1.position.x - pose2.position.x) << ", " << abs(pose1.position.y - pose2.position.y) << ", " << abs(pose1.position.z - pose2.position.z) << ")");
63-
ROS_WARN_STREAM("Expected delta ori " << delta_orientation << " vs actual " << tf::angleShortestPath(q1, q2));
58+
tf::Quaternion q1, q2;
59+
tf::quaternionMsgToTF(pose1.orientation, q1);
60+
tf::quaternionMsgToTF(pose2.orientation, q2);
61+
if (tf::angleShortestPath(q1, q2) == 0)
62+
{
63+
return true;
64+
}
6465
return false;
6566
}
6667
}

0 commit comments

Comments
 (0)