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">
<parent link="base_link"/>
<child link="imu_link"/>
<origin xyz="-0.032 0 0.068" rpy="0 0 0"/>
</joint>
<link name="imu_link"/>
Something to check: is your IMU mounted correctly wrt your URDF?
@gvdhoorn I just placed IMU on a robot as I thought it will initialize at 0.0 anyway.
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.
Depending on how well fixed to your robot the IMU is you can try flipping it the other way up and trying again.
@gvdhoorn 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.