# inverse signs of imu data

I am using orientation data from imu as an absolute orientation for robot_pose_ekf. However, the data published by imu and ekf are same value but in inverse signs. Like from imu, x is 0.64, but from ekf, x is -0.64. All x, y ,z ,w are inverse signs. The transformation is like below. I am really confused with this. Can anybody help. Thx.

tf::Quaternion orientation;
quaternionMsgToTF(imu->orientation, orientation);
imu_meas_ = tf::Transform(orientation, tf::Vector3(0,0,0));

// Transforms imu data to base_footprint frame
StampedTransform base_imu_offset;
imu_meas_ = imu_meas_ * base_imu_offset;

edit retag close merge delete

Any chance you can use the preformatted text markup for your code so that it's a bit easier to read? Just select all the code and hit the little icon with ones and zeros.

( 2014-06-28 08:18:56 -0600 )edit

Hi, Tom, sorry for the delay. I tried to edit the code again but it is still not formatted. Where is the little icon with ones and zeros. Thanks.

( 2014-06-30 10:03:39 -0600 )edit

Fixed the formatting for you.

( 2014-07-02 03:46:02 -0600 )edit

Thanks, Tom.

( 2014-07-02 08:37:26 -0600 )edit

Sort by » oldest newest most voted

I'm a bit confused as to what you're trying to do. I believe robot_pose_ekf lets you specify an IMU topic to fuse with the state estimate. It looks like you've written a new node that is (a) creating a static (identity) transform and then publishing it, (b) using that same transform to transform the measurement into base_footprint_frame_, and then (c) re-broadcasting the IMU data as a transform.

If I'm correct, then:

1. (a) can be accomplished by static_transform_publisher,
2. I think (b) should be imu_meas_ = base_imu_offset * imu_meas_;
3. You're broadcasting the inverse of the imu_meas_ for (c). Since the base_imu_offset is the identity, you're effectively broadcasting the inverse of the IMU measurement. That might account for the negated values.
4. I'm not sure that any of this is necessary, but again, I'm not sure what you're trying to accomplish. I'm willing to bet that robot_pose_ekf transforms all the incoming measurements into the target frame before integrating them.
more

Hi, Tom. Thanks for the answer and sorry for the delay. 1. My intention of creating a static transform and broadcast it is to establish a transformation between the two frames for waitfortransform(). As the imu broadcaster is publishing transformation after waitfortransform(), I will get an error without broadcaster bc. The transformation that bc broadcast is actually tf::Transform(tf::Quaternion(x,y,z,1),tf::Vector3(0,0,0), but as I haven't got the exact value for x,y,z, I write it to be (0,0,0,1). Sorry for this. 2. I have tried imu_meas_ = base_imu_offset * imu_meas_; but this is no difference. The result is the same as imu_meas_ = imu_meas_ * base_imu_offset; 3. Most of these codes are from robot_pose_ekf package. The inverse is from the package. I have checked through the code and I think inverse is necessary.

( 2014-07-05 16:55:20 -0600 )edit

When I compare orientation from imu and ekf, I find that when I rotate imu around x axis. The data from imu keeps growing smoothly, like from 0.22 to 0.24. But data from ekf will change, it keeps the same growing from 0.22 to 0.23, and suddenly becomes -0.23x. The value is the same but with the opposite signs.

( 2014-07-05 18:24:28 -0600 )edit

Ok, after some investigation, I think I see what you're trying to do. You actually modified the source for robot_pose_ekf by adding the first block of code, right? The second block (after the "// Transforms imu data to base_footprint frame") is code from robot_pose_ekf.

( 2014-07-15 15:59:40 -0600 )edit

If I'm correct, then part of my previous answer stands: you need to get rid of the first block wherein you broadcast the transform. Revert robot_pose_ekf back to the way it was, and instead use a static_transform_publisher in the launch file.

( 2014-07-15 16:04:24 -0600 )edit

Put this in your launch file: <node pkg="tf" type="static_transform_publisher" name="base_imu" args="0 0 0 0 0 0 base_footprint imu 100"/> Replace "base_footprint" and "imu" with the names of your frames for your robot and IMU. Let me know if it works. Add your tf tree to the question if needed

( 2014-07-15 16:09:50 -0600 )edit

Hi, Tom. It works fine now. Thanks.

( 2014-07-16 10:33:21 -0600 )edit