Closed ghost closed 7 years ago
@takuhara ,
I'm not familiar with ROS, but I appreciate you're trying to implement it.
All I can say is main() has a while(true) as main loop, where image are taken from source and passed to System::TrackMonocular.
When your ROS code works, I'll add to os1 code, if you're ok with it.
(I am using Google translation.)
The above code is a slight modification of raulmur's original ROS code. https://github.com/raulmur/ORB_SLAM2/blob/master/Examples/ROS/ORB_SLAM2/src/ros_mono.cc SLAM works properly.
In order to stop execution, when ctcl + c is pressed on the terminal, ros :: spin () catches the signal and SLAM.Shutdown () or SLAM.SaveKeyFrameTrajectoryTUM ("KeyFrameTrajectory.txt") is executed. However, the terminal freezes at the end or an error "QObject :: ~ QObject: Timers can not be stopped from another thread" occurs.
From now on, I would like to explore the cause.
@takuhara
I don't use that code in this project, but I can tell you same happened to me when using orb-slam2.
QObject is a class from Qt, which opencv uses to display frames. Perhaps Qt has its own timers, and I don't remember orb-slam2 System::Shutdown asking Qt for shutdown, so I believe that's the cause, but it shouldn't affect orb-slam2 ending properly.
Orb-slam2 uses opencv window to display frames in DrawFrame. OpenCV window uses Qt if it is available. Perhaps properly closing that window during shutdown prevents that error.
@AlejandroSilvestri
As you say, if I delete cv :: namedWindow ("ORB - SLAM 2: Current Frame") and later code in Viewer :: Run (), no error occurred. Later, I will insert destroyAllWindows etc. and try to verify.
@AlejandroSilvestri Hi, I had the same happend when using orb-slam2. I want to know the details about how to peoperly closing that window except "ctrl+c", and how to prevent that error.
@ichigoi7e
You mean Qt error at closing?
Do as @takahura said, delete opencv window. I'm not doing it, perhaps opencv documentation can help you to close the window.
I can add Qt is not mandatory in orb-slam2 nor os1. When installing opencv, if qt is installed opencv uses it. You can disable qt in cmake during opencv installation.
I have began to implement monocular ROS code..
my code:
then when press ctrl+c,
Destruct?? How should I implement monocular ROS code??