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?
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<!-- Choose visualization -->
<arg name="rtabmapviz" default="false" />
<arg name="rviz" default="true" />
<!-- Localization-only mode -->
<arg name="localization" default="true"/>
<arg name="pi/2" value="1.5707963267948966" />
<arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
<node pkg="tf" type="static_transform_publisher" name="camera_base_link"
args="$(arg optical_rotate) chassis camera 100" />
<!-- CONFIG FOR ROBOT1 -->
<group ns="robot1/stereo" >
<node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc"/>
<!-- Odometry -->
<node pkg="rtabmap_odom" type="stereo_odometry" name="stereo_odometry" output="screen">
<remap from="left/image_rect" to="left/image_rect"/>
<remap from="right/image_rect" to="right/image_rect"/>
<remap from="left/camera_info" to="left/camera_info"/>
<remap from="right/camera_info" to="right/camera_info"/>
<param name="frame_id" type="string" value="chassis"/>
<param name="odom_frame_id" type="string" value="odom"/>
<param name="approx_sync" type="bool" value="false"/>
<param name="queue_size" type="int" value="5"/>
<param name="Odom/MinInliers" type="string" value="12"/>
<param name="Odom/RoiRatios" type="string" value="0.03 0.03 0.04 0.04"/>
</node>
</group>
<group ns="rtabmap">
<node name="rtabmap" pkg="rtabmap_slam" type="rtabmap" output="screen" args=""> <!-- delete_db_on_start-->
<param name="frame_id" type="string" value="chassis"/>
<param name="subscribe_stereo" type="bool" value="true"/>
<param name="subscribe_depth" type="bool" value="false"/>
<param name="approx_sync" type="bool" value="false"/>
<remap from="left/image_rect" to="/robot1/stereo/left/image_rect_color"/>
<remap from="right/image_rect" to="/robot1/stereo/right/image_rect"/>
<remap from="left/camera_info" to="/robot1/stereo/left/camera_info"/>
<remap from="right/camera_info" to="/robot1/stereo/right/camera_info"/>
<remap from="odom" to="/robot1/stereo/odom"/>
<param name="queue_size" type="int" value="30"/>
<param name="Vis/MinInliers" type="string" value="12"/>
<!-- Enable localization in mapping mode -->
<param name="Mem/IncrementalMemory" type="bool" value="true"/>
<param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/>
</node>
</group>
<!-- Visualisation RVIZ -->
<node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_demos)/launch/config/demo_stereo_outdoor.rviz"/>
</launch>