Map Server
Publish a map
From this video: https://www.youtube.com/watch?v=ZaiA3hWaRzE&ab_channel=ArticulatedRobotics
And you need to run this command in another terminal.
ros2 run nav2_util lifecycle_bringup map_server
EASIER WAY
ros2 service call /map_server/load_map nav2_msgs/srv/LoadMap "{map_url: /home/ubuntu/sw_lab_robotics/maps/0.3x_gmapping.yaml}"
Using a yaml file
To publish map, you need to do the following. Have a given file:
map_server:
ros__parameters:
frame_id: map
topic: map
use_sim_time: false
yaml_filename: '/home/ubuntu/sw_lab_robotics/maps/enlighted_office.yaml'
then run the map_server node with passing the .yaml file as the input,
ros2 run nav2_map_server map_server --ros-args --params-file /home/ubuntu/sw_lab_robotics/ros2_ws/src/position_recorder/config/map_server_params.yaml
And you need to run this command in another terminal to startup the lifecycle thingyu
ros2 run nav2_util lifecycle_bringup map_server