Hi community!
I have done bunch of search in the forum about the visualizing the map in the RVIZ , and I tried the solutions that suggested but none of them helped me out, that’s why I ended up here I will provide tha last suggestion here with o/p:
Note that I also change durability policy to transient .
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():
map_file = os.path.join(get_package_share_directory(
"map_server"), "config", "/home/user/map2.yaml")
rviz_file = os.path.join(get_package_share_directory(
"map_server"), "rviz", "map_server.rviz")
return LaunchDescription([
Node(package="rviz2",
executable="rviz2",
name="rviz2",
output="screen",
arguments=['-d', rviz_file],
parameters=[{'use_sim_time': True}],
emulate_tty=True),
Node(package="nav2_map_server",
executable="map_server",
name="map_server",
output="screen",
parameters=[{"use_sim_time": True},
{"yaml_filename": map_file}],
emulate_tty=True),
Node(package="nav2_lifecycle_manager",
executable="lifecycle_manager",
name="lifecycle_manager_mapper",
output="screen",
parameters=[{"use_sim_time": True},
{"autostart": True},
{"node_names": ["map_server"]}],
emulate_tty=True),
])
# End of Code
that’s the terminal o/p:
user:~/nav2_ws$ ros2 launch slam_toolbox map_server_launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-03-14-08-28-57-797451-2_xterm-28268
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rviz2-1]: process started with pid [28270]
[INFO] [map_server-2]: process started with pid [28272]
[INFO] [lifecycle_manager-3]: process started with pid [28274]
[lifecycle_manager-3] [INFO] [1710404937.993219060] [lifecycle_manager_mapper]: Creating
[lifecycle_manager-3] [INFO] [1710404938.002060723] [lifecycle_manager_mapper]: Creating and initializing lifecycle service clients
[lifecycle_manager-3] [INFO] [1710404938.008421064] [lifecycle_manager_mapper]: Starting managed nodes bringup...
[lifecycle_manager-3] [INFO] [1710404938.008473815] [lifecycle_manager_mapper]: Configuring map_server
[map_server-2] [INFO] [1710404938.027555368] [map_server]:
[map_server-2] map_server lifecycle node launched.
[map_server-2] Waiting on external lifecycle transitions to activate
[map_server-2] See https://design.ros2.org/articles/node_lifecycle.html for more information.
[map_server-2] [INFO] [1710404938.027693577] [map_server]: Creating
[map_server-2] [INFO] [1710404938.027897761] [map_server]: Configuring
[map_server-2] [INFO] [map_io]: Loading yaml file: /home/user/koctasmagaza.yaml
[map_server-2] [DEBUG] [map_io]: resolution: 0.05
[map_server-2] [DEBUG] [map_io]: origin[0]: -62.336
[map_server-2] [DEBUG] [map_io]: origin[1]: -107.616
[map_server-2] [DEBUG] [map_io]: origin[2]: 0
[map_server-2] [DEBUG] [map_io]: free_thresh: 0.196
[map_server-2] [DEBUG] [map_io]: occupied_thresh: 0.65
[map_server-2] [DEBUG] [map_io]: mode: trinary
[map_server-2] [DEBUG] [map_io]: negate: 0
[map_server-2] [INFO] [map_io]: Loading image_file: /home/user/koctasmagaza080324retail.pgm
[rviz2-1] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
[rviz2-1] [INFO] [1710404938.389072383] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-1] [INFO] [1710404938.389456095] [rviz2]: OpenGl version: 3.1 (GLSL 1.4)
[rviz2-1] [INFO] [1710404938.465945860] [rviz2]: Stereo is NOT SUPPORTED
[map_server-2] [DEBUG] [map_io]: Read map /home/user/koctasmagaza080324retail.pgm: 1508 X 2775 map @ 0.05 m/cell
[lifecycle_manager-3] [INFO] [1710404939.104408638] [lifecycle_manager_mapper]: Activating map_server
[map_server-2] [INFO] [1710404939.104637940] [map_server]: Activating
[lifecycle_manager-3] [INFO] [1710404939.112267752] [lifecycle_manager_mapper]: Managed nodes are active
and RVIZ:
How can I solve this problem? I am working on the adding new gray color to the pgm to create extra category in the map different from unknown, obstacle or free areas, that’s hy I need to visualize that I have been done to the code.
also I wanna note that there is too much gazebo client problems like not responding , crashing, not able to run after a while or like RVIZ visiaulization as a student these are too much time consuming that’s why 8 hours limit is not enough to deal with the issues and observe what I have achive to grasp
the codes, packages etc.