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

Revision history [back]

There is a bagfile with some example values in imu_filter_madgwick/sample/phidgets_imu_upside_down.bag. You can try playing back the bagfile to see how it looks like, and use rostopic echo or rqt_plot to look at the values there and visualize the result in RViz. The bagfile is from an IMU mounted on a moving robot, so basically only the yaw angle changes. There are also two more bagfiles in that directory.

I put the accelerometer values in the linear_acceleration field, the gyro in the angular_velocity field and the magnetometer in the magnetic_field. Additionally, I fill the covariance_matrices with 0, as I have no information about the covariances. Finally, on the orientation field, as my IMU does not produce an orientation estimate, I don't modify it and set orientation_covariance[0]=-1 , as suggested in the message definition.

That is all correct. The covariance matrices are not taken into account by the filters anyway.

Any idea on what am I doing wrong? I assumed the filters would take the available data fuse it and estimate the orientation quaternion. Am I right?

Yes, that is correct.

Am I suppose to provide an estimation of the orientation to the filters?

No, the filter will do that.

In your private email to me you also asked about the units in the message. They are as follows:

angular_velocity: radian/sec; please check that your gyros don't instead publish degree/sec.

linear_acceleration: m/s^2

magnetic field: Tesla. This is wrong in the bagfile above, which instead publishes Gauss (1 Gauss = 1e4 Tesla). However, this does not affect the result, since only the direction of the magnetic field vector is taken into account, not the scale.

Another thing: Start by setting the use_mag parameter to false. Once you get good results, you can set it back to true.

One more thing: imu_filter_madgwick and imu_complementary_filter are interchangable and do the same thing. However, while imu_complementary_filter is newer, imu_filter_madgwick is better tested and maintained, so I would start with that one. If you get the input values right for one filter, it should work for both.