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

IMU plugin has strange measurements in RViz

asked 2019-07-15 02:59:14 -0600

dofrey gravatar image

updated 2019-07-15 03:34:35 -0600

My robot has an IMU attached to its arm. The following URDF xacro macro is defining the IMU:

<xacro:macro name="xsens_imu" params="prefix parent xyz rpy simulation:=false">

    <material name="xsens-orange">
        <color rgba="0.8862745098 0.56862745098 0.09019607843 1"/>
    </material>

    <joint name="${parent}_to_xsens_imu" type="fixed">
        <parent link="${parent}"/>
        <child link="xsens_imu"/>
        <origin xyz="${xyz}" rpy="${rpy}"/>
    </joint>

    <link name="xsens_imu">
        <visual>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <geometry>
                <box size="0.057 0.041 0.024"/> <!--a simple box is used with the outer dimensions for simplicity-->
            </geometry>
            <material name="xsens-orange"/>
        </visual>
        <collision>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <geometry>
                <box size="0.057 0.041 0.024"/>
            </geometry>
        </collision>
        <inertial>
            <mass value="0.055"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="1.60333333333e-05" ixy="0.0" ixz="0.0" iyy="2.80333333333e-05" iyz="0.0"
                     izz="1.60333333333e-05"/>
        </inertial>
    </link>

    <xacro:if value="${simulation}">
        <gazebo>
            <plugin name="imu_controller" filename="libhector_gazebo_ros_imu.so">
                <alwaysOn>true</alwaysOn>
                <updateRate>400.0</updateRate>
                <bodyName>xsens_imu</bodyName>
                <topicName>imu</topicName>
                <robotNamespace>sensors</robotNamespace>
                <serviceName>imu/is_calibrated</serviceName>
                <gaussianNoise>0.00000001</gaussianNoise>
                <xyzOffsets>0 0 0</xyzOffsets>
                <rpyOffsets>0 0 0</rpyOffsets>
                <frameId>world</frameId>
            </plugin>
        </gazebo>
    </xacro:if>
</xacro:macro>

But when I attach it to my robot, the outputs of the IMU are wrong. The resulting direction of the linear acceleration does not make sense to me. As the robot is stationary in this moment, I expect the acceleration to be in z direction -9.81 and zero otherwise.

header: 
  seq: 150358
  stamp: 
    secs: 376
    nsecs: 345000000
  frame_id: "kinova_link_6"
orientation: 
  x: -0.707163260091
  y: 0.492549225252
  z: 0.00974669647696
  w: -0.507168991746
orientation_covariance: [1.0391111027982223e-18, 0.0, 0.0, 0.0, 1.0391111027982223e-18, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 2.01395400932e-08
  y: -1.39027463744e-08
  z: -1.25824759946e-09
angular_velocity_covariance: [1.0000000000000001e-16, 0.0, 0.0, 0.0, 1.0000000000000001e-16, 0.0, 0.0, 0.0, 1.0000000000000001e-16]
linear_acceleration: 
  x: 4.7659779885
  y: 7.13092593212
  z: -4.76145551598
linear_acceleration_covariance: [1.0000000000000001e-16, 0.0, 0.0, 0.0, 1.0000000000000001e-16, 0.0, 0.0, 0.0, 1.0000000000000001e-16]

One thing that makes me think is the frame of the IMU measurement. I want to have it in world coordinates, not in the kinova_link_6 (which is just the last link of the robot).

Does anyone see a mistake in my URDF that could fix this problem?

Thanks a lot!

edit: I added <frameId>world</frameId> but still do not get the desired result.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-15 06:29:43 -0600

dofrey gravatar image

So I solved it by myself. Even though it's kind of a hack. The problem actually did not occur in the shown URDF above but in its parent URDF. I found, that only the joint after the last not fixed joint affects the wrong measurement. This means that after the last non fixed joint I got some fixed joints in between to place the IMU where I wanted it to be.

With adding a joint/link combination between the last non fixed joint and the first joint of my sensormount that had <origin rpy="0 0 0" xyz="0 0 0"/> the measurement were right then.

In the following question the same problem is described with the hector gazebo plugins but with another hack: https://answers.ros.org/question/4473...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-07-15 02:59:14 -0600

Seen: 828 times

Last updated: Jul 15 '19