I have completed the Ros2 Navigation course and when I wanted to apply the global and local costmap in the real robot project, it didn’t work beacuse it has a warning and says that no map was received.
I think that this could happen because the RobotModel is not working also. It looks like in the attached picture.
Please tell me how could I make both the Costmaps and the RobotModel to work in rviz.
For the global and local costmaps to work properly on the real robot, you need to make sure that all the use_sim_time variables located in launch files are set to False and in yaml config files are set to false. Notice the difference, capitalized False in launch files and all-lowercase false in the yaml files.
By yaml files, I am referring to the amcl, planner, controller, recoveries, bt_navigator yaml files.
Also make sure you are using the proper QoS for actual map. Since you can visualize the actual map on Rviz, I am sure you have the QoS for the map correct.
You also need to increase your map pixel resolution by decreasing the resolution parameter in the occupancy grid node in the cartographer launch file and remap the arena. Your map currently looks very blocky.
For RobotModel, check if there is the /robot_description topic and see if there is any data. Otherwise, set it to File mode and set the path to the description file on Rviz.
Also the most common reason when you get no map received is when you launch Rviz after launching all the nodes. So launch Rviz first, before launching all the Nav stack nodes, then you will have the map seen and proper TF connections to global frames such as odom or map.
I hope this helps. Let me know if you still have issues.