ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Nav2 navigation while mapping setup

asked 2021-06-29 12:10:27 -0500

Hi, I've been trying to setup Nav2 stack for my custom robot, but I have some trouble with how it works.

About the setup:

I am using ROS2 Foxy with Navigation installed from debs, I have my own custom workspace with gazebo simulation containing robot and somewhat randomized world. The robot has diff drive plugin and some sensors (for example lidar) from gazebo_ros_pkgs enabled. I can publish on the /cmd_vel topic and use keyboard_teleop to move the robot just fine.

The problem occurs when I want to run Navigation stack in a similar way to (so starting with a blank map, and then moving robot around). In my launch file I use cartographer_ros package to provide slam, and I include Nav2 bringup:

        PythonLaunchDescriptionSource(os.path.join(launch_dir, '')),
        launch_arguments={'namespace': '',
                          'use_sim_time': use_sim_time,
                          'autostart': 'true',
                          'params_file': params_file,
                          'use_lifecycle_mgr': 'false',
                          'map_subscribe_transient_local': 'true'}.items()),

where params file is taken from

I know that the parameters were made for the Turtlebot robot, but I wanted to try a baseline. The Nav2 stack launches just fine (I think), and I have ability to set up robot pose and send a goal. But there are some things that don't work:

Firstly, AMCL particle swarm doesn't seem to be published in rviz.

Secondly, when I send Nav2 goal, robot moves around a little bit like it is confused about what to do (see gif attached). The question is, how can I fix/improve this? I can provide more information (maybe rosbags?), but I'm not sure what would be relevant in this case.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-29 18:50:38 -0500

updated 2021-06-29 18:51:43 -0500

Firstly, I'd try with the baseline TB3 in our little demo world with your launch files / scripts. This way we can tell what issues are in the navigation configuration and which may be caused by your specific environment model or robot models.

Secondly, there may be a serious issue if you see any AMCL particle clouds. AMCL is the localization engine but you've explicitly said you want to be doing SLAM, so you should not expect to see anything from AMCL because it shouldn't even be running.

Thirdly, I'd try slam_toolbox rather than cartographer (for debugging, you're welcome to move back to it later) to see if the changing of SLAM vendors makes it work. Basically, my advice boils down to start with something we know works (like the tutorial) and change 1 thing at a time until it breaks. Once it breaks, you have a good idea where the issue lies and then you can ask a follow up question on a more targeted issue.

  • Use the tutorial example
  • Use your code instead, but still using the TB3 / sandbox world
  • Use your own robot instead now
  • Use your environment instead now
  • Use your different SLAM vendor instead now

(assort order around as you like)

edit flag offensive delete link more


Thanks for the advice, it turns out I had some problems with my URDF

Serafadam gravatar image Serafadam  ( 2021-06-30 10:11:10 -0500 )edit

Question Tools



Asked: 2021-06-29 12:10:27 -0500

Seen: 688 times

Last updated: Jun 29 '21