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

Getting wrong IMU direction in RViz

asked 2019-01-10 05:07:59 -0500

stevemartin gravatar image

Hi all,

I have an IMU and for some reason, RViz rotates my robot in the opposite direction.
So I have started at 0 degrees. Then I have decided to rotate the robot to the left by 113 degrees and echoed what odometry shows me:

pose: 
  pose: 
    position: 
      x: 0.0658873253904
      y: 0.106568772922
      z: 0.0
    orientation: 
      x: 0.0247469395399
      y: -0.0142682446167
      z: 0.833991229534
      w: -0.551037847996

So it is actually 113 degrees when converting to degrees. But on RViz, it shows that the robot has rotated to the right, which is -113 degrees I guess:

image description

(On the image, the odometry arrow was pointing to the north at the beginning and it turned right by 113 degrees).

Does anyone know why?

My URDF for the IMU link looks like this:

<joint name="imu_joint" type="fixed">
    <parent link="base_link"/>
    <child link="imu_link"/>
    <origin xyz="-0.032 0 0.068" rpy="0 0 0"/>
  </joint>

  <link name="imu_link"/>
edit retag flag offensive close merge delete

Comments

1

Does anyone know why?

Something to check: is your IMU mounted correctly wrt your URDF?

gvdhoorn gravatar image gvdhoorn  ( 2019-01-10 05:37:45 -0500 )edit

@gvdhoorn I just placed IMU on a robot as I thought it will initialize at 0.0 anyway.

stevemartin gravatar image stevemartin  ( 2019-01-10 05:41:19 -0500 )edit
1

IMUs have local coordinate systems, with + and - rotational directions. Depending on how the output is processed, that matters. Should not take you too long to check.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-10 05:46:22 -0500 )edit

Depending on how well fixed to your robot the IMU is you can try flipping it the other way up and trying again.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-10 05:50:40 -0500 )edit

@gvdhoorn Are you suggesting to play around with a position of IMU to get the right direction? I will try that now

stevemartin gravatar image stevemartin  ( 2019-01-10 06:02:49 -0500 )edit
1

Are you suggesting to play around with a position of IMU to get the right direction? I will try that now

well, my preferred approach would be to check the documentation of the IMU, figure out its local coordinate system and then reconcile that with how you've modelled your robot.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-10 06:06:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-10 09:28:05 -0500

stevemartin gravatar image

I have found the answer. I was using the RTIMUlib in order to read data from my IMU. For some reason, I had my w value in the opposite direction so I simply multiplied that value by -1 and now I am getting correct direction.

edit flag offensive delete link more

Comments

Hi, I think I'm having the same problem as you. In what file did you multiply the w value by -1?

emlynw gravatar image emlynw  ( 2020-01-14 05:24:10 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-01-10 05:07:59 -0500

Seen: 744 times

Last updated: Jan 10 '19