Fixed build warnings about variables not used in CameraRGBD and CameraStereo classes (depending on which sensor is available)

This commit is contained in:
matlabbe
2016-12-02 12:29:38 -05:00
parent f2dbfa9b33
commit a5f4468c54
4 changed files with 74 additions and 16 deletions

View File

@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/CameraModel.h" #include "rtabmap/core/CameraModel.h"
#include "rtabmap/core/Camera.h" #include "rtabmap/core/Camera.h"
#include "rtabmap/core/CameraRGB.h" #include "rtabmap/core/CameraRGB.h"
#include "rtabmap/core/Version.h"
#include <pcl/pcl_config.h> #include <pcl/pcl_config.h>
@@ -173,12 +174,13 @@ public:
bool setExposure(int value); bool setExposure(int value);
bool setGain(int value); bool setGain(int value);
bool setMirroring(bool enabled); bool setMirroring(bool enabled);
void setOpenNI2StampsAndIDsUsed(bool used) {_openNI2StampsAndIDsUsed = used;} void setOpenNI2StampsAndIDsUsed(bool used);
protected: protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_OPENNI2
Type _type; Type _type;
openni::Device * _device; openni::Device * _device;
openni::VideoStream * _color; openni::VideoStream * _color;
@@ -188,6 +190,7 @@ private:
std::string _deviceId; std::string _deviceId;
bool _openNI2StampsAndIDsUsed; bool _openNI2StampsAndIDsUsed;
StereoCameraModel _stereoModel; StereoCameraModel _stereoModel;
#endif
}; };
@@ -219,11 +222,13 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_FREENECT
int deviceId_; int deviceId_;
Type type_; Type type_;
freenect_context * ctx_; freenect_context * ctx_;
FreenectDevice * freenectDevice_; FreenectDevice * freenectDevice_;
StereoCameraModel stereoModel_; StereoCameraModel stereoModel_;
#endif
}; };
///////////////////////// /////////////////////////
@@ -266,6 +271,7 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_FREENECT2
int deviceId_; int deviceId_;
Type type_; Type type_;
StereoCameraModel stereoModel_; StereoCameraModel stereoModel_;
@@ -278,6 +284,7 @@ private:
bool bilateralFiltering_; bool bilateralFiltering_;
bool edgeAwareFiltering_; bool edgeAwareFiltering_;
bool noiseFiltering_; bool noiseFiltering_;
#endif
}; };
///////////////////////// /////////////////////////
@@ -307,11 +314,13 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_REALSENSE
rs::context * ctx_; rs::context * ctx_;
rs::device * dev_; rs::device * dev_;
int deviceId_; int deviceId_;
int presetRGB_; int presetRGB_;
int presetDepth_; int presetDepth_;
#endif
}; };

View File

@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/core/CameraModel.h" #include "rtabmap/core/CameraModel.h"
#include "rtabmap/core/Camera.h" #include "rtabmap/core/Camera.h"
#include "rtabmap/core/CameraRGB.h" #include "rtabmap/core/CameraRGB.h"
#include "rtabmap/core/Version.h"
#include <list> #include <list>
namespace FlyCapture2 namespace FlyCapture2
@@ -73,8 +74,10 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_DC1394
DC1394Device *device_; DC1394Device *device_;
StereoCameraModel stereoModel_; StereoCameraModel stereoModel_;
#endif
}; };
///////////////////////// /////////////////////////
@@ -98,8 +101,10 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_FLYCAPTURE2
FlyCapture2::Camera * camera_; FlyCapture2::Camera * camera_;
void * triclopsCtx_; // TriclopsContext void * triclopsCtx_; // TriclopsContext
#endif
}; };
///////////////////////// /////////////////////////
@@ -136,12 +141,13 @@ public:
virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = ""); virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
virtual bool isCalibrated() const; virtual bool isCalibrated() const;
virtual std::string getSerial() const; virtual std::string getSerial() const;
virtual bool odomProvided() const { return computeOdometry_; } virtual bool odomProvided() const;
protected: protected:
virtual SensorData captureImage(CameraInfo * info = 0); virtual SensorData captureImage(CameraInfo * info = 0);
private: private:
#ifdef RTABMAP_ZED
sl::zed::Camera * zed_; sl::zed::Camera * zed_;
StereoCameraModel stereoModel_; StereoCameraModel stereoModel_;
CameraVideo::Source src_; CameraVideo::Source src_;
@@ -154,6 +160,7 @@ private:
int confidenceThr_; int confidenceThr_;
bool computeOdometry_; bool computeOdometry_;
bool lost_; bool lost_;
#endif
}; };
///////////////////////// /////////////////////////

View File

@@ -382,21 +382,18 @@ CameraOpenNI2::CameraOpenNI2(
Type type, Type type,
float imageRate, float imageRate,
const rtabmap::Transform & localTransform) : const rtabmap::Transform & localTransform) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
_type(type),
#ifdef RTABMAP_OPENNI2 #ifdef RTABMAP_OPENNI2
,
_type(type),
_device(new openni::Device()), _device(new openni::Device()),
_color(new openni::VideoStream()), _color(new openni::VideoStream()),
_depth(new openni::VideoStream()), _depth(new openni::VideoStream()),
#else
_device(0),
_color(0),
_depth(0),
#endif
_depthFx(0.0f), _depthFx(0.0f),
_depthFy(0.0f), _depthFy(0.0f),
_deviceId(deviceId), _deviceId(deviceId),
_openNI2StampsAndIDsUsed(false) _openNI2StampsAndIDsUsed(false)
#endif
{ {
} }
@@ -488,6 +485,13 @@ bool CameraOpenNI2::setMirroring(bool enabled)
return false; return false;
} }
void CameraOpenNI2::setOpenNI2StampsAndIDsUsed(bool used)
{
#ifdef RTABMAP_OPENNI2
_openNI2StampsAndIDsUsed = used;
#endif
}
bool CameraOpenNI2::init(const std::string & calibrationFolder, const std::string & cameraName) bool CameraOpenNI2::init(const std::string & calibrationFolder, const std::string & cameraName)
{ {
#ifdef RTABMAP_OPENNI2 #ifdef RTABMAP_OPENNI2
@@ -1122,11 +1126,14 @@ bool CameraFreenect::available()
} }
CameraFreenect::CameraFreenect(int deviceId, Type type, float imageRate, const Transform & localTransform) : CameraFreenect::CameraFreenect(int deviceId, Type type, float imageRate, const Transform & localTransform) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_FREENECT
,
deviceId_(deviceId), deviceId_(deviceId),
type_(type), type_(type),
ctx_(0), ctx_(0),
freenectDevice_(0) freenectDevice_(0)
#endif
{ {
#ifdef RTABMAP_FREENECT #ifdef RTABMAP_FREENECT
if(freenect_init(&ctx_, NULL) < 0) UERROR("Cannot initialize freenect library"); if(freenect_init(&ctx_, NULL) < 0) UERROR("Cannot initialize freenect library");
@@ -1333,7 +1340,9 @@ CameraFreenect2::CameraFreenect2(
bool bilateralFiltering, bool bilateralFiltering,
bool edgeAwareFiltering, bool edgeAwareFiltering,
bool noiseFiltering) : bool noiseFiltering) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_FREENECT2
,
deviceId_(deviceId), deviceId_(deviceId),
type_(type), type_(type),
freenect2_(0), freenect2_(0),
@@ -1345,6 +1354,7 @@ CameraFreenect2::CameraFreenect2(
bilateralFiltering_(bilateralFiltering), bilateralFiltering_(bilateralFiltering),
edgeAwareFiltering_(edgeAwareFiltering), edgeAwareFiltering_(edgeAwareFiltering),
noiseFiltering_(noiseFiltering) noiseFiltering_(noiseFiltering)
#endif
{ {
#ifdef RTABMAP_FREENECT2 #ifdef RTABMAP_FREENECT2
UASSERT(minKinect2Depth_ < maxKinect2Depth_ && minKinect2Depth_>0 && maxKinect2Depth_>0 && maxKinect2Depth_<=65.535f); UASSERT(minKinect2Depth_ < maxKinect2Depth_ && minKinect2Depth_>0 && maxKinect2Depth_>0 && maxKinect2Depth_<=65.535f);
@@ -1965,12 +1975,15 @@ bool CameraRealSense::available()
} }
CameraRealSense::CameraRealSense(int device, int presetRGB, int presetDepth, float imageRate, const rtabmap::Transform & localTransform) : CameraRealSense::CameraRealSense(int device, int presetRGB, int presetDepth, float imageRate, const rtabmap::Transform & localTransform) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_REALSENSE
,
ctx_(0), ctx_(0),
dev_(0), dev_(0),
deviceId_(device), deviceId_(device),
presetRGB_(presetRGB), presetRGB_(presetRGB),
presetDepth_(presetDepth) presetDepth_(presetDepth)
#endif
{ {
UDEBUG(""); UDEBUG("");
} }

View File

@@ -347,8 +347,11 @@ bool CameraStereoDC1394::available()
} }
CameraStereoDC1394::CameraStereoDC1394(float imageRate, const Transform & localTransform) : CameraStereoDC1394::CameraStereoDC1394(float imageRate, const Transform & localTransform) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_DC1394
,
device_(0) device_(0)
#endif
{ {
#ifdef RTABMAP_DC1394 #ifdef RTABMAP_DC1394
device_ = new DC1394Device(); device_ = new DC1394Device();
@@ -401,7 +404,11 @@ bool CameraStereoDC1394::init(const std::string & calibrationFolder, const std::
bool CameraStereoDC1394::isCalibrated() const bool CameraStereoDC1394::isCalibrated() const
{ {
#ifdef RTABMAP_DC1394
return stereoModel_.isValidForProjection(); return stereoModel_.isValidForProjection();
#else
return false;
#endif
} }
std::string CameraStereoDC1394::getSerial() const std::string CameraStereoDC1394::getSerial() const
@@ -460,9 +467,12 @@ SensorData CameraStereoDC1394::captureImage(CameraInfo * info)
// CameraTriclops // CameraTriclops
// //
CameraStereoFlyCapture2::CameraStereoFlyCapture2(float imageRate, const Transform & localTransform) : CameraStereoFlyCapture2::CameraStereoFlyCapture2(float imageRate, const Transform & localTransform) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_FLYCAPTURE2
,
camera_(0), camera_(0),
triclopsCtx_(0) triclopsCtx_(0)
#endif
{ {
#ifdef RTABMAP_FLYCAPTURE2 #ifdef RTABMAP_FLYCAPTURE2
camera_ = new FlyCapture2::Camera(); camera_ = new FlyCapture2::Camera();
@@ -757,7 +767,9 @@ CameraStereoZed::CameraStereoZed(
float imageRate, float imageRate,
const Transform & localTransform, const Transform & localTransform,
bool selfCalibration) : bool selfCalibration) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_ZED
,
zed_(0), zed_(0),
src_(CameraVideo::kUsbDevice), src_(CameraVideo::kUsbDevice),
usbDevice_(deviceId), usbDevice_(deviceId),
@@ -769,6 +781,7 @@ CameraStereoZed::CameraStereoZed(
confidenceThr_(confidenceThr), confidenceThr_(confidenceThr),
computeOdometry_(computeOdometry), computeOdometry_(computeOdometry),
lost_(true) lost_(true)
#endif
{ {
UDEBUG(""); UDEBUG("");
#ifdef RTABMAP_ZED #ifdef RTABMAP_ZED
@@ -788,7 +801,9 @@ CameraStereoZed::CameraStereoZed(
float imageRate, float imageRate,
const Transform & localTransform, const Transform & localTransform,
bool selfCalibration) : bool selfCalibration) :
Camera(imageRate, localTransform), Camera(imageRate, localTransform)
#ifdef RTABMAP_ZED
,
zed_(0), zed_(0),
src_(CameraVideo::kVideoFile), src_(CameraVideo::kVideoFile),
usbDevice_(0), usbDevice_(0),
@@ -800,6 +815,7 @@ CameraStereoZed::CameraStereoZed(
confidenceThr_(confidenceThr), confidenceThr_(confidenceThr),
computeOdometry_(computeOdometry), computeOdometry_(computeOdometry),
lost_(true) lost_(true)
#endif
{ {
UDEBUG(""); UDEBUG("");
#ifdef RTABMAP_ZED #ifdef RTABMAP_ZED
@@ -896,7 +912,11 @@ bool CameraStereoZed::init(const std::string & calibrationFolder, const std::str
bool CameraStereoZed::isCalibrated() const bool CameraStereoZed::isCalibrated() const
{ {
#ifdef RTABMAP_ZED
return stereoModel_.isValidForProjection(); return stereoModel_.isValidForProjection();
#else
return false;
#endif
} }
std::string CameraStereoZed::getSerial() const std::string CameraStereoZed::getSerial() const
@@ -910,6 +930,15 @@ std::string CameraStereoZed::getSerial() const
return ""; return "";
} }
bool CameraStereoZed::odomProvided() const
{
#ifdef RTABMAP_ZED
return computeOdometry_;
#else
return false;
#endif
}
SensorData CameraStereoZed::captureImage(CameraInfo * info) SensorData CameraStereoZed::captureImage(CameraInfo * info)
{ {
SensorData data; SensorData data;