Gazebo | Ignition | Community
Ask Your Question
1

GAZEBO SPAWNING UNWANTED ODOM TO BASE LINK TRANSFORM. FIX NEEDED.

asked 2019-04-05 08:27:13 -0600

afroRoboticist gravatar image

updated 2019-04-05 08:54:35 -0600

Hi all, I built my custom 4wheeler and after spawning it in gazebo, everything worked out just fine. I then decided to bring it alive by including a diff_drive controller. At this point, it all goes wrong. When I spawn the robot, in Gazebo it looks okay. But in RVIZ, there's a complaint about missing transforms between the base_footprint and the rest of the robot. As you can see from the TF diagram attached, the base_footprint link has been displaced by a new connection between the odom frame and the base_link frame. See my Robot URDF bellow

image description

<robot name="Rover" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:property name="wheel_thickness" value="0.12"/> <xacro:property name="wheel_diameter" value="0.22"/> <xacro:property name="wheel_guide_thickness" value="0.05"/> <xacro:property name="wheel_guide_length" value="0.4"/> <xacro:property name="wheel_guide_height" value="0.1"/> <xacro:property name="body_length" value="0.6"/> <xacro:property name="body_width" value="0.5"/> <xacro:property name="body_height" value="0.3"/> <xacro:property name="camera_width" value="0.01"/> <xacro:property name="wheel_mass" value="0.5"/> <xacro:property name="body_mass" value="1"/> <xacro:property name="guide_mass" value="0.5"/> <xacro:property name="axel_mass" value="0.5"/> <xacro:property name="camera_mass" value="0.1"/> <xacro:property name="kinect_mass" value="0.5"/> <xacro:property name="pi" value="3.1415"/>

<xacro:macro name="default_inertial" params="mass"> <inertial> <mass value="${mass}"/> <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial> </xacro:macro>

<xacro:macro name="shape_visual" params="length width height color"> <visual> <pose xyz="0 0 1.0"/> <geometry> <box size="${length} ${width} ${height}"/> </geometry> <material name="${color}"/> </visual> <collision> <geometry> <box size="${length} ${width} ${height}"/> </geometry>
</collision>

</xacro:macro>

<xacro:macro name="camera_visual" params="length width height color"> <visual> <geometry> <box size="${length} ${width} ${height}"/> </geometry> <material name="${color}"/> </visual> <collision> <geometry> <box size="${length} ${width} ${height}"/> </geometry>
</collision>

</xacro:macro>

<xacro:macro name="wheel_guide_macro" params="prefix reflect"> <link name="${prefix}_wheel_guide"> <visual> <origin xyz="0 ${reflect*wheel_guide_thickness/2} 0"/> <geometry> <box size="${wheel_guide_length} ${wheel_guide_thickness} ${wheel_guide_height}"/> </geometry> <material name="black"/> </visual> <collision> <geometry> <box size="${wheel_guide_length} ${wheel_guide_thickness} ${wheel_guide_height}"/> </geometry>
</collision> <xacro:default_inertial mass="${guide_mass}"/> </link> <joint name="${prefix}_wheel_guide_joint" type="fixed"> <axis xyz="0 1 0" rpy="0 0 0"/> <parent link="base_link"/> <child link="${prefix}_wheel_guide"/> <origin xyz="0 ${reflect*body_width/2} 0" rpy="0 0 0"/> </joint> <gazebo reference="${prefix}_wheel_guide"> <gravity value="true"/> <mindepth>0.00001</mindepth> <material>Gazebo/Grey</material> </gazebo> </xacro:macro>

<xacro:macro name="wheel_axle_macro" params="prefix suffix reflect1 reflect2"> <link name="${prefix}_${suffix}_wheel_axle"> <visual> <origin xyz="0 0 0" rpy="0 ${reflect2*2.0*pi/3} 0"/> <geometry> <cylinder radius="${wheel_guide_height*0.2}" length="${wheel_guide_length/2}"/> </geometry> <material name="black"/> </visual> <collision> <geometry> <cylinder radius="${wheel_guide_height*0.2}" length="${wheel_guide_length/2}"/> </geometry>
</collision> <xacro:default_inertial mass="${axel_mass}"/> </link> <joint name="${prefix}_${suffix}_wheel_axle_joint" type="fixed"> <parent link="${prefix}_wheel_guide"/> <child link="${prefix}_${suffix}_wheel_axle"/> <origin xyz="${reflect2*wheel_guide_length ...

(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-04-09 06:32:54 -0600

afroRoboticist gravatar image

So I found out you can stop gazebo from broadcasting the odom -> Base_footprint transform by going to the launch file where you launch your empty_world or whatever world it is you use and insert the following as an argument

<remap from="tf" to="gazebo_tf"/>

This takes away the gazebo transform. However, this requires you to be entirely responsible for broadcasting the odom->base_footprint transform yourself. Was able to get this done.

For some reason though, the issue with the map not being as good still persists. Hopefully I find a fix soon.

edit flag offensive delete link more

Comments

Hi, I am facing the same problem and I can't create the map, what I did is using the plugin differential_drive_controller instead of gazebo_ros_control, but my robot is not stable. Did you found a solution to use gazebo_ros_control and create the map correctly ? Thanks.

BTW you can check my problem in the following link: https://answers.ros.org/question/3286...

Youssef_Lah gravatar imageYoussef_Lah ( 2019-07-24 16:27:21 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-04-05 08:27:13 -0600

Seen: 1,822 times

Last updated: Apr 09 '19