Ask Your Question
0

Height difference between base link and odom

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

pmuthu2s gravatar image

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

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!

C:\fakepath\ros_q_A.png

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

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="500">
<xacro:macro name="mp_500_base" params="name">
<link name="${name}">
<inertial>
<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" />

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

</xacro:macro>

</robot>

Just putting the important snippet from gazebo xacro

<plugin name="b1_controller" filename="libgazebo_ros_planar_move.so">
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<odometryRate>20.0</odometryRate>
<robotBaseFrame>base_link</robotBaseFrame>
</plugin>
</gazebo>
</robot>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

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

Delb gravatar image

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

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"/>
 </joint>

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

Comments

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 imagepmuthu2s ( 2019-02-18 09:24:47 -0500 )edit
2

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 imageDelb ( 2019-02-18 09:45:58 -0500 )edit

Added them

pmuthu2s gravatar imagepmuthu2s ( 2019-02-18 12:55:28 -0500 )edit

Any idea ?

pmuthu2s gravatar imagepmuthu2s ( 2019-02-19 03:40:34 -0500 )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 imageDelb ( 2019-02-19 04:08:53 -0500 )edit

Yes! The offset is 0.06

pmuthu2s gravatar imagepmuthu2s ( 2019-02-19 04:23:23 -0500 )edit
1

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 imageDelb ( 2019-02-19 04:39:47 -0500 )edit

Thank you ! Worked fine!

pmuthu2s gravatar imagepmuthu2s ( 2019-02-19 07:43:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 170 times

Last updated: Feb 19