mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
added error message when freenect2 is not linked on the right libusb (causing a deadlock when killing the camera)
This commit is contained in:
@@ -62,6 +62,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void mainLoop();
|
virtual void mainLoop();
|
||||||
|
virtual void mainLoopKill();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Camera * _camera;
|
Camera * _camera;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <libfreenect2/frame_listener_impl.h>
|
#include <libfreenect2/frame_listener_impl.h>
|
||||||
#include <libfreenect2/registration.h>
|
#include <libfreenect2/registration.h>
|
||||||
#include <libfreenect2/packet_pipeline.h>
|
#include <libfreenect2/packet_pipeline.h>
|
||||||
|
#include <libfreenect2/config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_DC1394
|
#ifdef WITH_DC1394
|
||||||
@@ -1249,16 +1250,14 @@ SensorData CameraFreenect2::captureImage()
|
|||||||
{
|
{
|
||||||
libfreenect2::FrameMap frames;
|
libfreenect2::FrameMap frames;
|
||||||
#ifndef LIBFREENECT2_THREADING_STDLIB
|
#ifndef LIBFREENECT2_THREADING_STDLIB
|
||||||
UDEBUG("Waiting for new frames... If it is stalled here, rtabmap should link on libusb of "
|
UDEBUG("Waiting for new frames... If it is stalled here, rtabmap should link on libusb of libfreenect2. "
|
||||||
"libfreenect2, this can be done by setting LD_LIBRARY_PATH to "
|
"Tip, before starting rtabmap: \"$ export LD_LIBRARY_PATH=~/libfreenect2/depends/libusb/lib:$LD_LIBRARY_PATH\"");
|
||||||
"\"libfreenect2/depends/libusb/lib\"");
|
|
||||||
listener_->waitForNewFrame(frames);
|
listener_->waitForNewFrame(frames);
|
||||||
#else
|
#else
|
||||||
if(!listener_->waitForNewFrame(frames, 1000))
|
if(!listener_->waitForNewFrame(frames, 1000))
|
||||||
{
|
{
|
||||||
UWARN("CameraFreenect2: Failed to get frames! rtabmap should link on libusb of "
|
UWARN("CameraFreenect2: Failed to get frames! rtabmap should link on libusb of libfreenect2. "
|
||||||
"libfreenect2, this can be done by setting LD_LIBRARY_PATH to "
|
"Tip, before starting rtabmap: \"$ export LD_LIBRARY_PATH=~/libfreenect2/depends/libusb/lib:$LD_LIBRARY_PATH\"");
|
||||||
"\"libfreenect2/depends/libusb/lib\"");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "rtabmap/core/CameraThread.h"
|
#include "rtabmap/core/CameraThread.h"
|
||||||
#include "rtabmap/core/Camera.h"
|
#include "rtabmap/core/Camera.h"
|
||||||
#include "rtabmap/core/CameraEvent.h"
|
#include "rtabmap/core/CameraEvent.h"
|
||||||
|
#include "rtabmap/core/CameraRGBD.h"
|
||||||
|
|
||||||
#include <rtabmap/utilite/UTimer.h>
|
#include <rtabmap/utilite/UTimer.h>
|
||||||
#include <rtabmap/utilite/ULogger.h>
|
#include <rtabmap/utilite/ULogger.h>
|
||||||
@@ -106,4 +107,29 @@ void CameraThread::mainLoop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CameraThread::mainLoopKill()
|
||||||
|
{
|
||||||
|
if(dynamic_cast<CameraFreenect2*>(_camera) != 0)
|
||||||
|
{
|
||||||
|
int i=20;
|
||||||
|
while(i-->0)
|
||||||
|
{
|
||||||
|
uSleep(100);
|
||||||
|
if(!this->isKilled())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this->isKilled())
|
||||||
|
{
|
||||||
|
//still in killed state, maybe a deadlock
|
||||||
|
UERROR("CameraFreenect2: Failed to kill normally the Freenect2 driver! The thread is locked "
|
||||||
|
"on waitForNewFrame() method of libfreenect2. This maybe caused by not linking on the right libusb. "
|
||||||
|
"Note that rtabmap should link on libusb of libfreenect2. "
|
||||||
|
"Tip before starting rtabmap: \"$ export LD_LIBRARY_PATH=~/libfreenect2/depends/libusb/lib:$LD_LIBRARY_PATH\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace rtabmap
|
} // namespace rtabmap
|
||||||
|
|||||||
Reference in New Issue
Block a user