Robotics StackExchange | Archived questions

nav2_bringup not generates costmap

Hi. I'm studying NAV2 using the offical document but I stucked at costmap section. the /map topic published by slam_toolbox online_async_launch.py was fine but when I launch ros2 launch nav2_bringup navigation_launch.py , both /globalcostmap/costmap and /localcostmap/costmap exist but showing no map received in rviz. The ternimal usually stucks at Creating bond timer... phase. Sometimes with Robot is out of bounds of the costmap! and Resizing costmap to 42 X 38 at 0.050000 m/pix behind it. I also tried download tutorial source code directly in order to check if I missed anything but got same result. I'm using humble distro. Please help me solve this!

update: I kinda solve this by launch all node at once according to this page. Why did this work any way?

Asked by yyf202xz on 2022-07-22 03:29:34 UTC

Comments

Answers

Someone posted saying:

and I solved this problem by delete param "use_sim_time:=True".

Asked by stevemacenski on 2022-08-22 19:21:58 UTC

Comments

I simply launch them using ros2 launch sam_bot_description display.launch.py without any additional setting. Though use_sim_time is set as True in display.launch.py by default, so I trun it to false using ros2 launch sam_bot_description display.launch.py use_sim_time:=False. This time not only costmap, but alse all other map disappeared

Asked by yyf202xz on 2022-08-29 18:29:41 UTC

I do not have an answer for why launching all required nodes from one launch file works, but I wanted to share this snippet for any other people stumbling upon this issue.

I was following the First-Time Robot Setup Guide and also did not receive any costmaps in RViz.

I cloned the navigation2_tutorials which contains the sam_bot_description package. I then edited the display.launch.py file and added the following lines to the launch.Launchdescription([]) array near the bottom of the screen (with the corresponding imports, of course)

TimerAction(
        period=3.0,  # This should be large enough that Gazebo is loaded before SLAM is started
        actions=[
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(
                    os.path.join(get_package_share_directory('slam_toolbox'),
                                 "launch",
                                 "online_async_launch.py")
                )
            ),
        ]
    ),
    TimerAction(
        period=6.0,  # This sould be large enough that SLAM is fully started before the rest of nav2 is launched
        actions=[
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(
                    os.path.join(get_package_share_directory('nav2_bringup'),
                                 "launch",
                                 "navigation_launch.py")
                )
            ),
        ]
    ),

After launching this new file, I can see the costmaps in RViz.

Hopefully this helps other people to quickly get this example up and running.

Asked by Jelle H on 2022-11-25 05:31:00 UTC

Comments