Hi Tingda,
It depends on what is available for you in the simulation. You can see an example in this post:
https://answers.ros.org/question/333424/how-to-compare-the-slam-trajectory-with-simulation-ground-truth/On another project, we created a node to subscribe to /gazebo/link_states topic and then broadcast a TF between /world and /base_link_gt (the later corresponding to base frame /base_link of the robot in the link_states). To save the ground truth in rtabmap node for evaluation like in the link above, we set parameters "ground_truth_frame_id" and "ground_truth_base_frame_id" to "world" and "base_link_gt" respectively.
<node pkg="rtabmap_ros" type="rtabmap" name="rtabmap">
<param name="frame_id" value="base_link"/>
<param name="ground_truth_frame_id" value="world"/>
<param name="ground_truth_base_frame_id" value="base_link_gt"/>
...
</node>
For convenience to see ground truth and estimated frames at the same time in RVIZ, make sure to link world to map frame:
<node pkg="tf" type="static_transform_publisher" name="worldtomap_broadcaster" args="0 0 0 0 0 0 1 world map 100" />
cheers,
Mathieu