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

Getting wrong IMU direction in RViz

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:

(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">
<origin xyz="-0.032 0 0.068" rpy="0 0 0"/>
</joint>


edit retag close merge delete

1

Does anyone know why?

( 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.

( 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.

( 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.

( 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

( 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.

( 2019-01-10 06:06:08 -0500 )edit

Sort by ยป oldest newest most voted

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.

more