In that case, my robot is building map of the environment and is incrementing. How do I know if my robot is able to localize in the environment or get the pose of the rover respective to global reference frame?
I have written a launch file for SLAM which is here below. With this launch file, I am able to build the map but how do I get the real time pose of the robot if it is localizing simultaneously? Also, is it the correct approach to do SLAM?
You can get use localization_pose to have a pose topic in map frame. However, if you need faster pose in map frame, consider subscribing to odometry topic, then use TF to transform the odometry pose in map frame.