Ask Your Question
0

inverse signs of imu data

asked 2014-06-26 05:43:04 -0500

fyxbird gravatar image

updated 2014-07-02 03:41:21 -0500

Tom Moore gravatar image

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));
tf::TransformBroadcaster bc;
bc.sendTransform(tf::StampedTransform(tf::Transform(tf::Quaternion(0,0,0,1),tf::Vector3(0,0,0)),imu_stamp_,base_footprint_frame_, imu->header.frame_id));

// Transforms imu data to base_footprint frame
robot_state_.waitForTransform(base_footprint_frame_, imu->header.frame_id, imu_stamp_, ros::Duration(0.5));
StampedTransform base_imu_offset;
robot_state_.lookupTransform(base_footprint_frame_, imu->header.frame_id, imu_stamp_, base_imu_offset);
imu_meas_ = imu_meas_ * base_imu_offset;
imu_broadcaster_.sendTransform(StampedTransform(imu_meas_.inverse(), imu_stamp_,  base_footprint_frame_, imu->header.frame_id));
edit retag flag offensive close merge delete

Comments

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.

Tom Moore gravatar image Tom Moore  ( 2014-06-28 08:18:56 -0500 )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.

fyxbird gravatar image fyxbird  ( 2014-06-30 10:03:39 -0500 )edit

Fixed the formatting for you.

Tom Moore gravatar image Tom Moore  ( 2014-07-02 03:46:02 -0500 )edit

Thanks, Tom.

fyxbird gravatar image fyxbird  ( 2014-07-02 08:37:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-07-02 03:59:47 -0500

Tom Moore gravatar image

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.
edit flag offensive delete link more

Comments

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.

fyxbird gravatar image fyxbird  ( 2014-07-05 16:55:20 -0500 )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.

fyxbird gravatar image fyxbird  ( 2014-07-05 18:24:28 -0500 )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.

Tom Moore gravatar image Tom Moore  ( 2014-07-15 15:59:40 -0500 )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.

Tom Moore gravatar image Tom Moore  ( 2014-07-15 16:04:24 -0500 )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

Tom Moore gravatar image Tom Moore  ( 2014-07-15 16:09:50 -0500 )edit

Hi, Tom. It works fine now. Thanks.

fyxbird gravatar image fyxbird  ( 2014-07-16 10:33:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-26 05:43:04 -0500

Seen: 655 times

Last updated: Jul 02 '14