I've been working on a project using the Navigation2 stack to navigate a robot through GPS waypoints. When using a pre-built map, the robot successfully navigates to all waypoints. However, I encounter issues when I switch to an empty map.

Tutorials Followed: I have followed the tutorials by Ricardo Tellez (with Clearpath robotics, but they closed their open source project repo now to the outdoor nav product which uses ros2) on GPS integration within the Nav stack and tried to adjust it for the Nav2 stack (I have disabled SLAM and AMCL as the tutorial does not use them) :

ROS Extra Class #1: Outdoors Robot Navigation for Agricultural Robots Using ROS How to use GPS to do autonomous robot navigation? // ROS Extra Class #2

Or is it possible use NAV2+GPS without any map ? (even empty) as suggested in this answer: Navigation Without Pre-Built Map for Collision-Free Movement

Despite following these tutorials, I'm still stuck on this issue.

Working Scenario: With a pre-built map, the robot navigates successfully to all waypoints. Here's a video showcasing the successful navigation: GPS Waypoint Follower Planner NAV2 Stack (Previous Mapped Area) .

Issue Scenario: When using an empty map, the robot starts showing warnings and errors related to path planning and does not move, remaining stuck. Here's the output I get:

[controller_server-7] [WARN] ... Received plan with zero length [controller_server-7] [ERROR] ... Controller patience exceeded [controller_server-7] [WARN] ... [ActionServer] Aborting handle. [recoveries_server-9] [INFO] ... Attempting spin

Here's a video showcasing the issues with the empty map: GPS follower Empty map (Issue with Plan length = 0)

Request: I'm looking for insights into why the Navigation2 stack behaves differently with an empty map compared to a pre-built one. Any suggestions or best practices for navigating in an unknown environment using Navigation2 or/and SLAM would be greatly appreciated.

I've already read this feature request discussion: https://github.com/ros-planning/navigation2/issues/2517 , but I confess I did not deeply understand how to adjust, trick or find a solution for my case:

Thank you for your time and assistance!


2 Answers 2


Send us your local costmap / controller parameters. Its likely to me that you're not allowing unknown space to be traversed and you're not setting your default background costmap to free instead of unknown -- so the controller sees any potential move as invalid.

You could also prove this to yourself by uploading just an empty white map and seeing it works or not.

GPS should work fine in an empty map. There are three major ways to configure this:

  1. With a map, to size the costmap and do larger scale planning between waypoints

  2. Without a map, but static sized space, for larger but finitely known spaces

  3. Without a map and using a global rolling costmap for massive or unknown sized spaces. The only requirement here is that any 2 pairs of waypoints must be within the scope of the size of the global rolling costmap set so it can do the planning between them

  • $\begingroup$ There's also a tutorial coming up about this and setting up GPS with Nav2 shortly! $\endgroup$ Sep 19, 2023 at 17:35
  • $\begingroup$ Hi Steve, Thank you for your suggestions. Here's a checklist of what we've done based on your recommendations: 1- Changed the unknown_cost_value from 255 (unknown) to 0 (free). 2- The track_unknown_space parameter was already set to true. 3- Tested with an empty map. Here is the requested configuration file of costmap, etc: pastebin.com/spGSypvX We're now considering trying out the other two approaches you mentioned: Navigating without a map but within a static sized space. Using a global rolling costmap for navigation. However I had issues requesting a map... $\endgroup$ Sep 19, 2023 at 19:56
  • $\begingroup$ Why are you requesting a map if there is no map? Remove the static layer! $\endgroup$ Sep 20, 2023 at 23:39
  • $\begingroup$ I have already removed it from the configuration files. The configuration file I sent you is related to the setup using the empty map. When I tried the approaches you suggested (without the map, 1- using a static-sized map for global costmap and 2- Global Rolling Costmap), I removed the static layer from the conf file, and even so, it did not work.... From Ricardo's ROS1 tutorials, it seems a map is required (they tricked this using an empty map), but I'm not sure if it works without a map, as you said it could work. Do you have another approach in mind that could help? Thanks in advance :) $\endgroup$ Sep 21, 2023 at 0:03
  • $\begingroup$ The errors I got in each approach (without map usage) 1 - Navigating without a map but within a static-sized space: Conf file: pastebin.com/LCRz6BL2 Set width, height, and resolution for the global costmap and removed static layer. Errors: pastebin.com/0YFc4SCG 2 - Using a global rolling costmap for navigation: Config file:pastebin.com/UymDkCJS I've set the rolling_window to true in global costmap and removed the static layer too Errors: pastebin.com/R7yNcp3R $\endgroup$ Sep 21, 2023 at 0:27

After extensive troubleshooting, I've identified and resolved the problem. The solution involves two critical steps:

1 Map Creation in GIMP:

While creating a map in GIMP, saving it in the appropriate format, such as .pgm is essential. However, another crucial detail: the map must be saved in ASCII format. enter image description here

If not saved in this format, the map doesn't populate correctly with the 255 value (White). Instead, it gets filled with question mark points (???????????), as illustrated in the attached figure (the right side is the right one in ASCII format). enter image description here

2-Map Resolution Adjustment:

The initial resolution of the map was set at 1.0. Surprisingly, the planner couldn't compute a path at this resolution. By reducing the resolution to 0.5, the planner was able to calculate a path, effectively resolving the "plan with zero length" issue. enter image description here

With these adjustments, the primary navigation issue was addressed. However, I've now encountered a new challenge related to the local planner. I've provided a detailed description of this new problem in this subsequent post:

Challenges with Local Planner in ROS2 Navigation2: Ineffectual Obstacle Avoidance and Potential Self-Detection

Any assistance or insights regarding this would be greatly appreciated as I aim to conclude this project simulation successfully.

  • $\begingroup$ Please don't expand the scope of questions if this question is answered $\endgroup$ Sep 21, 2023 at 16:39
  • $\begingroup$ Sure good hint! Thank you for the guidance, Steve! I truly value your keen observations. If you could spare a moment to glance over this other issue, I'd be most appreciative. Your insights always have that eagle-eyed precision! $\endgroup$ Sep 21, 2023 at 17:06

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.