ORB_SLAM2_CUDA icon indicating copy to clipboard operation
ORB_SLAM2_CUDA copied to clipboard

ROS topics empty

Open isokar opened this issue 4 years ago • 3 comments

Hi, I'm trying to use ORB_SLAM2 on Jetson Nano. I managed to install it and to launch the ROS example. here is what I got:

` isokar@ROSMain:~$ roslaunch /home/isokar/ORB_SLAM2_CUDA/Examples/ROS/ORB_SLAM2_CUDA/launch/ros_mono.launch ... logging to /home/isokar/.ros/log/0bbe5eda-9c6a-11ea-ae95-4ae0e495c825/roslaunch-ROSMain-22881.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ROSMain:39619/

SUMMARY

PARAMETERS

  • /rosdistro: melodic
  • /rosversion: 1.14.3

NODES / ORB_SLAM2_CUDA (ORB_SLAM2_CUDA/Mono)

ROS_MASTER_URI=http://localhost:11311

process[ORB_SLAM2_CUDA-1]: started with pid [22898]

ORB-SLAM2 Copyright (C) 2014-2016 Raul Mur-Artal, University of Zaragoza. This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular

Loading ORB Vocabulary. This could take a while... Vocabulary loaded!

Camera Parameters:

  • fx: 527.546
  • fy: 528.822
  • cx: 360.76
  • cy: 225.48
  • k1: 0.262383
  • k2: -0.953104
  • k3: 1.16331
  • p1: -0.005358
  • p2: 0.002628
  • fps: 10
  • color order: RGB (ignored if grayscale)

ORB Extractor Parameters:

  • Number of Features: 2000
  • Scale Levels: 8
  • Scale Factor: 1.2
  • Initial Fast Threshold: 20
  • Minimum Fast Threshold: 7 Image reading time = 7.0158e-05s Tracking time = 1.26621s, frequency = 0.78976Hz All cost time = 1.26628s, frequency = 0.789716Hz Avg. time = 1.26628s, frequency = 0.789716Hz

Image reading time = 8.646e-06s Tracking time = 0.143114s, frequency = 6.98744Hz All cost time = 0.143123s, frequency = 6.98702Hz Avg. time = 0.7047s, frequency = 1.41904Hz

Image reading time = 7.084e-06s Tracking time = 0.0886575s, frequency = 11.2794Hz All cost time = 0.0886646s, frequency = 11.2785Hz Avg. time = 0.499355s, frequency = 2.00258Hz

Image reading time = 8.229e-06s Tracking time = 0.106942s, frequency = 9.35086Hz All cost time = 0.10695s, frequency = 9.35014Hz Avg. time = 0.401254s, frequency = 2.49219Hz

Image reading time = 8.334e-06s Tracking time = 0.094746s, frequency = 10.5545Hz All cost time = 0.0947543s, frequency = 10.5536Hz Avg. time = 0.339954s, frequency = 2.94158Hz

^CImage reading time = 1.1771e-05s Tracking time = 0.0983063s, frequency = 10.1723Hz All cost time = 0.098318s, frequency = 10.1711Hz Avg. time = 0.299681s, frequency = 3.33688Hz

[ORB_SLAM2_CUDA-1] killing on exit

Saving keyframe trajectory to /home/ubuntu/ORB_SLAM2_CUDA/test_results/Mono_KeyFrameTrajectory.txt ...

trajectory saved! shutting down processing monitor... ... shutting down processing monitor complete done `

so it seems to works fine and detects images. but when opening RVIZ(or doing rostopic echo), the topics are created but empty. what am I doing wrong?

isokar avatar May 24 '20 21:05 isokar

Hi @isokar , so sorry for the late reply. Is the option to publish ROS topics enabled? If yes, can you verify the individual topic in this part of the code.

thien94 avatar May 27 '20 11:05 thien94

Hi, I Just found out part of the reason of my problem. by adding some logs to ros_mono I found out that "Tcw" variable is empty, which cause to stop. Now I have to find out why it's empty. if any idea...

I calibrated the camera just to be sure but with no changes.

isokar avatar Jun 09 '20 20:06 isokar

Hello,

I was having the same issue, with no messages after the line https://github.com/thien94/ORB_SLAM2_CUDA/blob/master/Examples/ROS/ORB_SLAM2_CUDA/src/ros_mono.cc#L138.

I finally was able to start sending messages when I adjusted the configuration file so the threshold was lower, with the following parameters:

  • ORBextractor.iniThFAST
  • ORBextractor.minThFAST

and especially after increasing ORBextractor.nFeatures.

To begin, you can try to be as permissive as possible, just to check it works (by setting a large number of features and a low threshold. This will lead to a low frame rate and precision, but at least you can check it is working properly)

For instance, with this configuration:

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 10000

# 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

I am being able to get a /posestamped topic at ~11Hz. These parameters are not ideal, of course, since 10K features seem to be too much, but you can try these a parameters as a baseline to check it is at least working, and from there try to find the best parameters for your specific case.

It looks like it was having some issues getting a match between frames. Try not to move the camera at the beginning for several seconds. Then you will start seeing messages in the /posestamped topic.

In my case, I am still losing many messages at certain frames but I guess it is a matter of refining the configuration (I still have not calibrated my camera, so this is to be expected). But what matters is that the problem is solved if you find a configuration in which you can ensure a match between frames given your current light conditions, image quality, etc.

I hope it helps.

nestormh avatar Jun 10 '20 22:06 nestormh