Getting an error that my tf has been ignored
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;
odom_broadcaster.sendTransform(odom_trans);
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 Can it be -1?
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