Home | Tutorials | Wiki | Issues
Ask Your Question
0

After loading the urdf model in gazebo, there is no `map` frame on the tf tree.

asked 2019-04-02 08:06:54 -0500

dauker gravatar image

I defined a robot model with the urdf file, but after gazebo reads the urdf file, I check out the tf tree and find that there is no map frame on the tf tree. I wanna figure out how I can generate a map frame when I spawn my robot model in gazebo. Any advice will be appreciated.

Screenshot of tf tree: Imgur

My launch file:

<?xml version="1.0" encoding="utf-8"?>
<!-- Launch this file to spawn cambot model in gazebo. -->
<launch>
    <!-- these are the arguments you can pass this launch file, for example paused:=true -->
    <arg name="paused" default="false" />
    <arg name="use_sim_time" default="true" />
    <arg name="gui" default="true" />
    <arg name="headless" default="false" />
    <arg name="debug" default="false" />
    <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="debug" value="$(arg debug)" />
        <arg name="gui" value="$(arg gui)" />
        <arg name="paused" value="$(arg paused)" />
        <arg name="use_sim_time" value="$(arg use_sim_time)" />
        <arg name="headless" value="$(arg headless)" />
    </include>
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(find cambot_description)/urdf/cambot.urdf.xacro" />
    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model cambot -param robot_description"></node>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-02 09:32:13 -0500

shiveshkhaitan gravatar image

A transform between map and odom is published by any of the SLAM package e.g. gmapping, RTABmap or GoogleCartographer. You can use any of them to get a occupancy grid. The occupancy grid will be published on some topic (default topics are different for different mapping packages. You can check the documentation) and a transform between map to odom will be published by default.

edit flag offensive delete link more

Comments

Now I know the reason: the robot model I generated in gazebo was started in empty world(roslaunch gazebo_ros empty_world.launch), causing the data of the simulated laser to be all 0. Now I generate the robot in a world with some obstacles(roslaunch gazebo_ros shapes_world.launch), cartographer will update the map->odom transform on the tf tree according to the non-zero sensor_msgs/LaserScan data.

dauker gravatar imagedauker ( 2019-04-03 00:51:36 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-04-02 08:06:54 -0500

Seen: 142 times

Last updated: Apr 02