thien94 / orb_slam3_ros

A ROS implementation of ORB_SLAM3
GNU General Public License v3.0
261 stars 81 forks source link

Map point vector is empty! #6

Closed XinZhanhua closed 1 year ago

XinZhanhua commented 1 year ago

Hello author! I'm not very good at english. hope you can understand. i use your code to run orbslam3 in gazebo. i have a mono camera to publish camera data, which can be seen directly by rviz. however, when i run the roslaunch orb_slam3_ros gimbal_mono.launch, the image in rviz is BLACK with 'Waiting for images', and the terminal shows 'Map point vector is empty!' i have download the database and run them correctly as readme shows. but the camera data from gazebo has something wrong.

here is my .launch file and .yaml file `

<!-- Main node -->
<node name="orb_slam3" pkg="orb_slam3_ros" type="ros_mono" output="screen">
    <!-- change the topics according to the dataset -->
    <!-- <remap from="/camera/image_raw" to="/cam0/image_raw"/> -->

    <!-- Parameters for original ORB-SLAM3 -->
    <param name="voc_file"      type="string" value="$(find orb_slam3_ros)/orb_slam3/Vocabulary/ORBvoc.txt.bin"/>
    <param name="settings_file" type="string" value="$(find orb_slam3_ros)/config/Monocular/dog_gimbal.yaml"/>

    <!-- 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 -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find orb_slam3_ros)/config/orb_slam3_no_imu.rviz" output="screen" />

<!-- Trajectory path -->
<node pkg="hector_trajectory_server" type="hector_trajectory_server" name="trajectory_server_orb_slam3" output="screen" ns="orb_slam3_ros" >
    <param name="/target_frame_name" value="/world" />
    <param name="/source_frame_name" value="/camera" />
    <param name="/trajectory_update_rate" value="20.0" />
    <param name="/trajectory_publish_rate" value="20.0" />
</node>

`

`%YAML:1.0

--------------------------------------------------------------------------------------------

Camera Parameters. Adjust them!

--------------------------------------------------------------------------------------------

File.version: "1.0"

Camera.type: "PinHole"

Camera calibration and distortion parameters (OpenCV)

Camera1.fx: 1144.6249960878738 Camera1.fy: 1144.6249960878738 Camera1.cx: 800.5 Camera1.cy: 600.5

Camera1.k1: 0.0 Camera1.k2: 0.0 Camera1.p1: 0.0 Camera1.p2: 0.0 Camera1.k3: 0.0

Camera frames per second

Camera.fps: 30

Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)

Camera.RGB: 1

Camera resolution

Camera.width: 752 Camera.height: 480

--------------------------------------------------------------------------------------------

ORB Parameters

--------------------------------------------------------------------------------------------

ORB Extractor: Number of features per image

ORBextractor.nFeatures: 1000

ORB Extractor: Scale factor between levels in the scale pyramid

ORBextractor.scaleFactor: 1.2

ORB Extractor: Number of levels in the scale pyramid

ORBextractor.nLevels: 8

ORB Extractor: Fast threshold

Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.

Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST

You can lower these values if your images have low contrast

ORBextractor.iniThFAST: 20 ORBextractor.minThFAST: 7

--------------------------------------------------------------------------------------------

Viewer Parameters

--------------------------------------------------------------------------------------------

Viewer.KeyFrameSize: 0.05 Viewer.KeyFrameLineWidth: 1.0 Viewer.GraphLineWidth: 0.9 Viewer.PointSize: 2.0 Viewer.CameraSize: 0.08 Viewer.CameraLineWidth: 3.0 Viewer.ViewpointX: 0.0 Viewer.ViewpointY: -0.7 Viewer.ViewpointZ: -1.8 Viewer.ViewpointF: 500.0

`

XinZhanhua commented 1 year ago

by the way, the problem sometimes disappear itself without any change. the output in terminal seems like this: Map point vector is empty! Map point vector is empty! ... Map point vector is empty! Map point vector is empty! First KF:0; Map init KF:0 New Map created with 110 points (then it suddenly goes correct and the image in rviz start to get the camera data in gazebo)

thien94 commented 1 year ago

Hi @XinZhanhua , in your launch file you have commented out this line <!-- <remap from="/camera/image_raw" to="/cam0/image_raw"/> -->. In that case ORB-SLAM3 will subscribe to the topic /camera/image_raw.

Is /camera/image_raw the correct image topic from your camera? If it is not, you need to uncomment that line and modify it to match the actual topic.

XinZhanhua commented 1 year ago

Hi @thien94 , thank you very much for reply. I comment this line, because my mono camera topic name is just /camera/image_raw as I start to use your code, the tracking image in rviz shows 'No image' . then I checked the error and commented this line, then the error shows in this issue occurred.

thien94 commented 1 year ago

@XinZhanhua After you started the ros node, have you tried moving the camera around a bit? Mono ORB-SLAM requires some initial movements to start working, so if you launch the node but then do not move the camera at all, it will look like nothing is running.

XinZhanhua commented 1 year ago

the error screenshot is like this,

1

but sometimes it goes well without any change in file, like this

2

like a magic HAHA

XinZhanhua commented 1 year ago

@XinZhanhua After you started the ros node, have you tried moving the camera around a bit? Mono ORB-SLAM requires some initial movements to start working, so if you launch the node but then do not move the camera at all, it will look like nothing is running.

OH, really? I‘m sorry for bothering you. what a silly question HAHA

XinZhanhua commented 1 year ago

Thank you anyway, for my first issue in GitHub!

thien94 commented 1 year ago

No worries. It is not a silly question at all.