0
$\begingroup$

Rosanswers logo

With the lates update of Kinetic the display of laser scan data in some old bag files stopped working. I get the message

[ERROR] [1490090873.307973855]: Ignoring transform for child_frame_id "uav0/vicon_laser" from authority "unknown_publisher" because of an invalid quaternion in the transform (-0,018510 0,706860 -0,018510 0,706860)

in the terminal where rviz is started. This transform might be generated from a ros2 static transform but it worked before the latest update.

Is the quaternion invalid or is the check here buggy? And it did display properly before so can I disable this new check?

The launch file line generaing the transform that do now work is:

<node  pkg="tf2_ros" type="static_transform_publisher" name="laser_frame_publisher" args="0.12 0 -0.1 -0.01851 0.70686 -0.01851 0.70686 /uav0/vicon /uav0/vicon_laser" />

Originally posted by tompe17 on ROS Answers with karma: 140 on 2017-03-21

Post score: 2


Original comments

Comment by William on 2017-03-21:
You cannot disable the check (what would it do with what it thinks is an invalid quaternion). This would not be in rviz, but rather in tf2 or tf. Do you mean tf2 or ros2? @tfoote that quaternion looks valid, do you know of recent changes that might affect this?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

We recently added this assertion in #196 Plugging the values into the calculator the quaternion appears to be just outside the epsilon threshold of 10e-6.

0.018510^2 + 0.706860^2 + 0.018510^2 + 0.706860^2 = 0.9999873594

That's a larger error than I would expect for a quaternion based on floating point calculation errors. There's currently not a way to adjust or change this check.


Originally posted by tfoote with karma: 58457 on 2017-03-21

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by tompe17 on 2017-03-21:
These numbers are computed by a program (Python or C++) and then printed. Then the numbers are taken from the printout to be arguments to the static transform program. So of course the whole double precision is not preserved because of truncation in the printing.

Comment by tompe17 on 2017-03-21:
I think it is unreasonable to expect the double precision to be kept since this small error will not influence the measurments at all from the laser. I cannot be the only person that have used a program to compute the quaternion for a simple rotation and put it into a static transform.

Comment by tompe17 on 2017-03-21:
OK, saw you said floating point precision but I think my argument is still valid.

Comment by William on 2017-03-21:
Can you post a bag file with the raw float values? Or do the calculations yourself and show them here, avoiding the truncation of precision due to printing? Ultimately, I think you'll want to raise this on the issue tracker of tf: https://github.com/ros/geometry2/pull/196

Comment by tompe17 on 2017-03-22:
I am not sure how I got the values I have above in the launch file line that starts the static transform publisher. One theory is that I computed it from the angles -90, -87, -90 and then just used 5 of the decimals that was printed. In Python more decimals are printed. Maybe C++ gives 5 decimals.

Comment by tompe17 on 2017-03-22:
Here is the Python calculation with the order messed up somewhat:

HPR: -90.0 -87.0 -90.0
[-0.70686447  0.0185099  -0.70686447  0.0185099 ]

Comment by tompe17 on 2017-03-22:
I added a comment on https://github.com/ros/geometry2/pull/196

Comment by wong_jowo on 2017-04-28:
I tried to publish TF from IMU via Arduino, here is the data: Q = 0.001404 -0.001587 -0.903198 0.42926 printed from Arduino 2560. and resulting the epsilon 3.52645890000502e-5 which still larger then 10e-6 and RVIZ confirms error. How do we solve this issue, otherwise Arduino devices are unusable

$\endgroup$
0
$\begingroup$

Rosanswers logo

Old question, but here is an answer.

You should use built-in libraries such as numpy in Python and not normalize yourself.

Here is how to do it in Python

quat = [q.x, q.y, q.z, q.w]
quat_norm = quat / np.linalg.norm(quat)

This should solve the issue


Originally posted by Oded with karma: 105 on 2019-07-29

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.