0
$\begingroup$

I am currently creating an example for using Gazebo Garden in ROS2 Humble. Have issues getting local and global cost maps to publish in the setup I am creating. I can get the Nav2 stack started and navigation working with the static map. I could not get the inflation layer working for Nav2. I am using the nav2 bring_launch.py from my code using the launch file below:

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription

from launch.actions import IncludeLaunchDescription
from launch import LaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory


def generate_launch_description():
    pkg_path = get_package_share_directory("gazebo_garden_simulation_example")
    nav2_bringup_path = get_package_share_directory("nav2_bringup")

    nav = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(nav2_bringup_path, "launch", "bringup_launch.py"),
        ),
        launch_arguments={
            "use_sim_time": "true",
            "map": os.path.join(pkg_path, "map", "map.yaml"),
            "params_file": os.path.join(pkg_path, "params", "nav2_params.yaml"),
        }.items(),
    )

    return LaunchDescription([nav])

From Rviz I can see that navigation is activated.

RVIZ with nav2 activated. Local and Global costmap not published

Attached is the node graph of my setup.

Node Graph for Nav2

I have also tried both FastDDS and CycloneDDS. Both are giving me the same issue. Really appreciate it if anyone have come across this and have solve it before.

Full package that I created is here: https://github.com/dannyngweekiat/Gazebo-Garden-Simulation-Example


Updated to show the navigation of the robot.

enter image description here

$\endgroup$
2
  • $\begingroup$ Please add more specific details about this problem: from your graph, the costmap topics are being created, so how have you verified that they aren't producing data? Is anything being published from them? Is the scan topic producing data for them to use? What do you mean by "the inflation layer is not working"? $\endgroup$
    – cst0
    Aug 21, 2023 at 14:45
  • $\begingroup$ - Both ros2 topic hz /local_costmap/costmap and ros2 topic echo /local_costmap/costmap do not show any result. - Scan is having data. AMCL is consuming it for localization. Scan can be visualize on screen also. - Inflation layer on local costmap will prevent the robot to move too near to the static obstacle in the map. The static layer is working for navigation on the setup I am currently testing $\endgroup$
    – Danny Ng
    Aug 22, 2023 at 0:51

2 Answers 2

1
$\begingroup$

Remove the "use_sim_time": "true" from your launch arguments for nav2_bringup and it should work. I had exactly the same problem on ros-iron and couldn't figure out why the costmaps were not being published.

Here is a Github issue, Costmap not being published when using custom params #2541, which also describes this same problem.

$\endgroup$
0
$\begingroup$

You probably just don't have the right QoS settings in Rviz2 to connect to the costmap publishers. They use transient local QoS so that late-joining subscribers can get the information on discovery (since its kind of important).

$\endgroup$
2
  • $\begingroup$ I am currently using the settings below for both costmaps ` Topic: Depth: 5 Durability Policy: Transient Local Filter size: 10 History Policy: Keep Last Reliability Policy: Reliable Value: /global_costmap/costmap Topic: Depth: 5 Durability Policy: Transient Local Filter size: 10 History Policy: Keep Last Reliability Policy: Reliable Value: /local_costmap/costmap` $\endgroup$
    – Danny Ng
    Aug 22, 2023 at 0:55
  • $\begingroup$ I have also edited my question to show the navigation of the robot. The robot can navigate close to the static map obstacle. $\endgroup$
    – Danny Ng
    Aug 22, 2023 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.