mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-06 17:57:45 +08:00
Merged pcl_integration branch to trunk
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1014 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -31,7 +31,8 @@ namespace rtabmap
|
||||
// ownership transferred
|
||||
CameraThread::CameraThread(Camera * camera, bool autoRestart) :
|
||||
_camera(camera),
|
||||
_autoRestart(autoRestart)
|
||||
_autoRestart(autoRestart),
|
||||
_seq(0)
|
||||
{
|
||||
UASSERT(_camera != 0);
|
||||
}
|
||||
@@ -43,6 +44,27 @@ CameraThread::~CameraThread()
|
||||
delete _camera;
|
||||
}
|
||||
|
||||
bool CameraThread::init()
|
||||
{
|
||||
if(!this->isRunning())
|
||||
{
|
||||
if(_camera)
|
||||
{
|
||||
_seq = 0;
|
||||
return _camera->init();
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Cannot initialize the camera because the camera object is null...");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Cannot initialize the camera because it is already running...");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CameraThread::mainLoop()
|
||||
{
|
||||
State state = kStateCapturing;
|
||||
@@ -82,11 +104,6 @@ void CameraThread::pushNewState(State newState, const ParametersMap & parameters
|
||||
_stateMutex.unlock();
|
||||
}
|
||||
|
||||
void CameraThread::setImageRate(float imageRate)
|
||||
{
|
||||
_camera->setImageRate(imageRate);
|
||||
}
|
||||
|
||||
void CameraThread::handleEvent(UEvent* anEvent)
|
||||
{
|
||||
if(anEvent->getClassName().compare("ParamEvent") == 0)
|
||||
@@ -116,11 +133,11 @@ void CameraThread::process()
|
||||
{
|
||||
if(_camera->isFeaturesExtracted())
|
||||
{
|
||||
this->post(new CameraEvent(descriptors, keypoints, img, _camera->id()));
|
||||
this->post(new CameraEvent(descriptors, keypoints, img, ++_seq));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->post(new CameraEvent(img, _camera->id()));
|
||||
this->post(new CameraEvent(img, ++_seq));
|
||||
}
|
||||
}
|
||||
else if(!this->isKilled())
|
||||
@@ -133,7 +150,7 @@ void CameraThread::process()
|
||||
{
|
||||
ULOGGER_DEBUG("Camera::process() : no more images...");
|
||||
this->kill();
|
||||
this->post(new CameraEvent(_camera->id()));
|
||||
this->post(new CameraEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user