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

Height difference between base link and odom

asked 2019-02-18 07:18:21 -0600

pmuthu2s gravatar image

updated 2019-02-19 04:24:03 -0600

Hey guys.

I was developing my robot model, I don't understand why the base link and odom is not aligned in rviz? Which parameter may cause this type of discrepancy? This makes the robot float in the air. Please look into the below image

Thanks guys!


EDIT: Adding the xacro files This is the base link xacro file

<?xml version="1.0"?>
<robot xmlns:xacro="" name="500">
<xacro:macro name="mp_500_base" params="name">
<link name="${name}">
<mass value="1.4" />
<origin xyz="0.000122063 0.106046383 0.229559509" rpy="0 0 0"/>
<inertia ixx="19.3007" ixy="-1.11893480243" ixz="-0.407945788144"
       iyy="131.584507173302" iyz="-53.615672236" 
       izz="25.601786" />

<visual name='body'>
<origin xyz="0.0 0.0 -0" rpy="0 0 1.570796" /><!-- for STL -->
 <mesh filename="package://path-to-BODY.dae" scale="0.001    0.001 0.001"/>
<collision name='body_collision'>
<origin xyz="0.0 0.0 0.0" rpy=" 0 0. 1.570796" />
 <mesh filename="package://path-to-BODY.dae" scale="0.001 0.001 0.001"/>



Just putting the important snippet from gazebo xacro

<plugin name="b1_controller" filename="">
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-18 07:39:27 -0600

Delb gravatar image

updated 2019-02-19 05:09:56 -0600

You should provide us your urdf model, it would be easier to help you.

Anyway, you have probably defined something like that :

 <joint name="my_joint" type="fixed">
    <origin xyz="0 0 1" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="odom"/>

The line <origin xyz="0 0 1" rpy="0 0 0"/> here is the important part, it should be 0 0 0 if you want your frames to be at the same position.

EDIT : You have the offset because of your mesh file. The plugin set odom at z=0 in order to have your robot at the level of the ground. Since you use mesh files but don't change the origin within the visual and collision tags of your urdf the frame is created at the middle of your mesh file, so in order to have odom at z=0 the frame base_link is created at z=your_mesh_height/2.

Since you know that you always have an offset of 0.06 between the frames (I guess your mesh height is then 0.12) all you have to do is changing from:

 <origin xyz="0.0 0.0 0.0" rpy=" 0 0. 1.570796" />

To :

<origin xyz="0.0 0.0 0.06" rpy=" 0 0. 1.570796" />

Within the tags collision and visual.

Note : A better way to do this would be to create another link base_footprint in your urdf and set a joint between base_link and base_footprint defining the offset between the two frames. You can see it in the gazebo tutorials (section Planar Move Plugin). You'll just have to change the robotBaseFrame to base_footprint.

edit flag offensive delete link more


I have used xacros! Plus I don't have a joint for base link and odom. Maybe is there a problem with the mesh files derived from the CAD software?

pmuthu2s gravatar image pmuthu2s  ( 2019-02-18 09:24:47 -0600 )edit

Mesh are only visuals so the frames aren't related. Can you provide more details about what you actually did to get that result ? Like giving the urdf file first and the commands you used. Moreover, have you created the frame odom or is it generated from another package ?

Delb gravatar image Delb  ( 2019-02-18 09:45:58 -0600 )edit

Added them

pmuthu2s gravatar image pmuthu2s  ( 2019-02-18 12:55:28 -0600 )edit

Any idea ?

pmuthu2s gravatar image pmuthu2s  ( 2019-02-19 03:40:34 -0600 )edit

I'm currently investigating. Do you always have the exact same offset between your frames ? (and I would like to know the value too, is it 0.23 ?)

Delb gravatar image Delb  ( 2019-02-19 04:08:53 -0600 )edit

Yes! The offset is 0.06

pmuthu2s gravatar image pmuthu2s  ( 2019-02-19 04:23:23 -0600 )edit

I got it : it's because of your mesh file, I believe that if you try with something else (or just a cylinder or any shape) you would get a different offset.

Delb gravatar image Delb  ( 2019-02-19 04:39:47 -0600 )edit

Thank you ! Worked fine!

pmuthu2s gravatar image pmuthu2s  ( 2019-02-19 07:43:19 -0600 )edit

Question Tools

1 follower


Asked: 2019-02-18 07:18:21 -0600

Seen: 1,115 times

Last updated: Feb 19 '19