Map does not appear in RVIZ2

hi the construct team,

I am facing a problem in the Nav 2 in 5 days course the problem is when launching the project_localization package the localization launch file it dose not appear the map in the rviz2 before it was appearing it and everything works well but since 2 days i did not change anything just when i try the map do not appear in the rviz2.

this is a picture of the output when running the launch file :

This is the localization launch file :

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    
    nav2_yaml = os.path.join(get_package_share_directory('project_localization'), 'config', 'amcl_config.yaml')
    map_file = os.path.join(get_package_share_directory('project_mapping'), 'config', 'turtlebot_area.yaml')

    return LaunchDescription([
        Node(
            package='nav2_map_server',
            executable='map_server',
            name='map_server',
            output='screen',
            parameters=[{'use_sim_time': True}, 
                        {'yaml_filename':map_file}]
        ),
            
        Node(
            package='nav2_amcl',
            executable='amcl',
            name='amcl',
            output='screen',
            parameters=[nav2_yaml]
        ),

        Node(
            package='nav2_lifecycle_manager',
            executable='lifecycle_manager',
            name='lifecycle_manager_localization',
            output='screen',
            parameters=[{'use_sim_time': True},
                        {'autostart': True},
                        {'node_names': ['map_server', 'amcl']}]
        )
    ])

this is the output of the Rviz2 :

I hope anyone can help for more details i am free to answer.

Best Regards,

Ghassan

Hi @ghassan11,

It looks like the first error in your terminal output screenshot is related to amcl.

When things are behaving strangely, I like to isolate what I’m running to better understand what could be going wrong.

For example, the issue you are facing here is that you cannot visualize the map in rviz2.

That could be for two reasons: that rviz2 did not subscribe to /map correctly, but map_server is working normally, or that map_server is not working properly so there is no map topic to subscribe to.

The first suggestion is to run rviz2 first, prepare the configuration for the map visualization, and then run the same launch file you are showing in your screenshot.

The second suggestion I have for you is isolating the program responsible for publishing the map, map_server. What you can do is quickly create a new launch file that instead of launching map_server and amcl, it only launches map_server.

Once that’s done, we can investigate further what could be going on.

ok i will try it now for the first option i already did it but it dont visualize the map lets see with the second and i will answer u

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.