mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
CameraStereoZed: handling initialization failures
This commit is contained in:
@@ -47,6 +47,7 @@ public:
|
|||||||
float getMinMapSize() const {return minMapSize_;}
|
float getMinMapSize() const {return minMapSize_;}
|
||||||
bool isGridFromDepth() const {return occupancyFromCloud_;}
|
bool isGridFromDepth() const {return occupancyFromCloud_;}
|
||||||
bool isFullUpdate() const {return fullUpdate_;}
|
bool isFullUpdate() const {return fullUpdate_;}
|
||||||
|
bool isMapFrameProjection() const {return projMapFrame_;}
|
||||||
const std::map<int, Transform> & addedNodes() const {return addedNodes_;}
|
const std::map<int, Transform> & addedNodes() const {return addedNodes_;}
|
||||||
int cacheSize() const {return (int)cache_.size();}
|
int cacheSize() const {return (int)cache_.size();}
|
||||||
|
|
||||||
|
|||||||
@@ -860,18 +860,27 @@ bool CameraStereoZed::init(const std::string & calibrationFolder, const std::str
|
|||||||
param.depth_minimum_distance=-1;
|
param.depth_minimum_distance=-1;
|
||||||
param.camera_disable_self_calib=!selfCalibration_;
|
param.camera_disable_self_calib=!selfCalibration_;
|
||||||
|
|
||||||
|
sl::ERROR_CODE r = sl::ERROR_CODE::SUCCESS;
|
||||||
if(src_ == CameraVideo::kVideoFile)
|
if(src_ == CameraVideo::kVideoFile)
|
||||||
{
|
{
|
||||||
UINFO("svo file = %s", svoFilePath_.c_str());
|
UINFO("svo file = %s", svoFilePath_.c_str());
|
||||||
zed_ = new sl::Camera(); // Use in SVO playback mode
|
zed_ = new sl::Camera(); // Use in SVO playback mode
|
||||||
param.svo_input_filename=svoFilePath_.c_str();
|
param.svo_input_filename=svoFilePath_.c_str();
|
||||||
zed_->open(param);
|
r = zed_->open(param);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINFO("Resolution=%d imagerate=%f device=%d", resolution_, getImageRate(), usbDevice_);
|
UINFO("Resolution=%d imagerate=%f device=%d", resolution_, getImageRate(), usbDevice_);
|
||||||
zed_ = new sl::Camera(); // Use in Live Mode
|
zed_ = new sl::Camera(); // Use in Live Mode
|
||||||
zed_->open(param);
|
r = zed_->open(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(r!=sl::ERROR_CODE::SUCCESS)
|
||||||
|
{
|
||||||
|
UERROR("Camera initialization failed: \"%s\"", errorCode2str(r).c_str());
|
||||||
|
delete zed_;
|
||||||
|
zed_ = 0;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user