ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Getting an error that my tf has been ignored

asked 2019-01-09 03:44:59 -0500

stevemartin gravatar image

I have Bosch BN055 9-axis accelerometer and I have installed this package to integrate with ROS: LINK

However, when I run the whole launch file with odometry (odometry gets the IMU values from /imu topic, will put the code at the end), I get this error:

Error:   TF_DENORMALIZED_QUATERNION: Ignoring transform for child_frame_id "base_footprint" from authority "unknown_publisher" because of an invalid quaternion in the transform (0.000000 0.000000 0.008824 -0.994081)

And here is the code where odometry gets the IMU orientation values (callback function):

void Odometry::ImuCb(const sensor_msgs::Imu::ConstPtr& data)
    orient_z = data->orientation.z;
    orient_w = data->orientation.w;


And here where it puts into tf message:

geometry_msgs::Quaternion odom_quat ;

    odom_quat.x = 0.0;
    odom_quat.y = 0.0;
    odom_quat.z = 0.0;

    odom_quat.z = this->orient_z;
    odom_quat.w = this->orient_w;

    geometry_msgs::TransformStamped odom_trans;
    odom_trans.header.stamp = now;
    odom_trans.header.frame_id = "odom";
    odom_trans.child_frame_id = "base_footprint";

        odom_trans.transform.translation.x = x_final;
        odom_trans.transform.translation.y = y_final;
        odom_trans.transform.translation.z = 0.0;
        odom_trans.transform.rotation = odom_quat;

edit retag flag offensive close merge delete


The magnitude of the quaternion should be one for it to be valid, the magnitude of the one shown is 0.9882748975, hence it is not valid.

jayess gravatar image jayess  ( 2019-01-09 03:57:41 -0500 )edit

@jayess Can it be -1?

stevemartin gravatar image stevemartin  ( 2019-01-09 04:01:40 -0500 )edit

It's part of the definition of a quaternion. Please see the quaternion tutorial on the wiki. Magnitudes are not negative, so, no it should not be -1

jayess gravatar image jayess  ( 2019-01-09 04:02:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-09 05:04:22 -0500

Quaternions are 4 element unit vectors, for some reason the code you've shown is only copying two of those four elements. Hence why the magnitude is smaller than it should be.

If you update the code so it copies all the elements of the quaternion (x y z and w) to the transform then hopefully this should fix your problem.

Let us know how you get on.

edit flag offensive delete link more


Yes, I figured this out and the problem disappeared :) Can you also look at my newest question? LINK

stevemartin gravatar image stevemartin  ( 2019-01-09 05:13:07 -0500 )edit

Question Tools



Asked: 2019-01-09 03:44:59 -0500

Seen: 1,218 times

Last updated: Jan 09 '19