added error message when freenect2 is not linked on the right libusb (causing a deadlock when killing the camera)

This commit is contained in:
matlabbe
2015-07-09 10:55:54 -04:00
parent 3b226a0d92
commit bf295c4274
3 changed files with 32 additions and 6 deletions
+26
View File
@@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/CameraThread.h"
#include "rtabmap/core/Camera.h"
#include "rtabmap/core/CameraEvent.h"
#include "rtabmap/core/CameraRGBD.h"
#include <rtabmap/utilite/UTimer.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