Skip to content

Commit

Permalink
Check for empty quaternion message (moveit#2089)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixvd authored and v4hn committed May 20, 2020
1 parent 1be0665 commit edf77ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion moveit_core/planning_scene/src/planning_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,15 @@ void PlanningScene::poseMsgToEigen(const geometry_msgs::Pose& msg, Eigen::Isomet
{
Eigen::Translation3d translation(msg.position.x, msg.position.y, msg.position.z);
Eigen::Quaterniond quaternion(msg.orientation.w, msg.orientation.x, msg.orientation.y, msg.orientation.z);
quaternion.normalize();
if ((quaternion.x() == 0) && (quaternion.y() == 0) && (quaternion.z() == 0) && (quaternion.w() == 0))
{
ROS_WARN_NAMED(LOGNAME, "Empty quaternion found in pose message. Setting to neutral orientation.");
quaternion.setIdentity();
}
else
{
quaternion.normalize();
}
out = translation * quaternion;
}

Expand Down

0 comments on commit edf77ad

Please sign in to comment.