Skip to content

Commit

Permalink
relax normalization tolerance. #196 was too strict for some use cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Apr 1, 2017
1 parent 120a532 commit 634fd0c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tf2/src/buffer_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
namespace tf2
{

// Tolerance for acceptable quaternion normalization
static double QUATERNION_NORMALIZATION_TOLERANCE = 10e-3;

/** \brief convert Transform msg to Transform */
void transformMsgToTF2(const geometry_msgs::Transform& msg, tf2::Transform& tf2)
{tf2 = tf2::Transform(tf2::Quaternion(msg.rotation.x, msg.rotation.y, msg.rotation.z, msg.rotation.w), tf2::Vector3(msg.translation.x, msg.translation.y, msg.translation.z));}
Expand Down Expand Up @@ -244,7 +247,7 @@ bool BufferCore::setTransform(const geometry_msgs::TransformStamped& transform_i
bool valid = std::abs((stripped.transform.rotation.w * stripped.transform.rotation.w
+ stripped.transform.rotation.x * stripped.transform.rotation.x
+ stripped.transform.rotation.y * stripped.transform.rotation.y
+ stripped.transform.rotation.z * stripped.transform.rotation.z) - 1.0f) < 10e-6;
+ stripped.transform.rotation.z * stripped.transform.rotation.z) - 1.0f) < QUATERNION_NORMALIZATION_TOLERANCE;

if (!valid)
{
Expand Down

0 comments on commit 634fd0c

Please sign in to comment.