thien94 / orb_slam3_ros_wrapper

A ROS wrapper for ORB-SLAM3. Focus on portability and flexibility.
182 stars 83 forks source link

How to use the ros wrapper to to run my own rosbags file? #42

Closed sirackerman closed 3 weeks ago

sirackerman commented 4 weeks ago

Hello @thien94 , I'm trying to use the ros wrapper with orbslam3 to run my own rosbags recording that I got using the D435i. My goal is to make orbslam3 publish navigation nodes and run through my rosbag and generate a point cloud map/ 3d map of the environment in rviz. I was able to configure my yaml file and here is its content:

<launch>
       <!-- ORB_SLAM3 Node -->
        <node name="orb_slam3_rgbd" pkg="orb_slam3_ros_wrapper"  type="orb_slam3_ros_wrapper_rgbd" output="screen">

      <!-- Remap topics to match my rosbag -->
        <remap from="/camera/color/image_raw" to="/camera/color/image_raw"/>
        <remap from="/camera/aligned_depth_to_color/image_raw" to="/camera/aligned_depth_to_color/image_raw"/>
        <remap from="/camera/imu" to="/camera/imu"/>

        <!-- Parameters -->
        <param name="voc_file"  type="string" value="$(find orb_slam3_ros_wrapper)/config/ORBvoc.txt"/>
        <param name="settings_file" type="string" value="$(find orb_slam3_ros_wrapper)/config/RealSense_D435i.yaml"/>
        <param name="publish_tf" value="true"/>
<!-- Parameters for ROS -->
        <param name="world_frame_id"    type="string"   value="world" />
        <param name="cam_frame_id"      type="string"   value="camera" />
        <param name="enable_pangolin"   type="bool"     value="true" />
    </node>

    <!-- Visualization RViz -->
     <node pkg="rviz" type="rviz" name="rviz" args="-d $(find orb_slam3_ros_wrapper)/config/orb_slam3_rosbag_view.rviz" output="screen" />

   <!-- Rosbag play -->
    <node pkg="rosbag" type="play" name="rosbag" output="screen" 
          args="--clock /home/ariano/SCUT_rosbags/1-line1-front.bag"/>

</launch>

These are the infos of my rosbags:

types:       sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
             sensor_msgs/Imu   [6a62c6daae103f4ff57a132d6f95cec2]
topics:      /camera/aligned_depth_to_color/image_raw    6931 msgs    : sensor_msgs/Image
             /camera/color/image_raw                     6931 msgs    : sensor_msgs/Image
             /camera/imu                                46248 msgs    : sensor_msgs/Imu

file and other config files and when I run:

roslaunch orb_slam3_ros_wrapper rgbd_inertial.launch

The rosbag plays but rviz doesn't display any map or point cloud related content and the normal orbslam3 interface doesn't also appear. Here's what I got as a reference: Screenshot from 2024-10-16 20-03-27

I can run the orbslam3 examples normally as a standalone library and also with ROS. I wonder what I should do to make it work. I'm beginner in the SLAM fields. Any help would be greatly appreciated. Thank you in advance.

sirackerman commented 3 weeks ago

Figured out to make make it work. My launch and yaml file had some typo. Regading building the point cloud map using pcl, I'll look into it.