ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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.
2 | No.2 Revision |
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 cans see it in the gazebo tutorials (section Planar Move Plugin).
3 | No.3 Revision |
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 cans can see it in the gazebo tutorials (section Planar Move Plugin). You'll just have to change the robotBaseFrame
to base_footprint
.