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/Camera.h"
#include "rtabmap/core/CameraRGB.h"
#include "rtabmap/core/Version.h"
#include <pcl/pcl_config.h>
@@ -173,12 +174,13 @@ public:
bool setExposure(int value);
bool setGain(int value);
bool setMirroring(bool enabled);
void setOpenNI2StampsAndIDsUsed(bool used) {_openNI2StampsAndIDsUsed = used;}
void setOpenNI2StampsAndIDsUsed(bool used);
protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_OPENNI2
Type _type;
openni::Device * _device;
openni::VideoStream * _color;
@@ -188,6 +190,7 @@ private:
std::string _deviceId;
bool _openNI2StampsAndIDsUsed;
StereoCameraModel _stereoModel;
#endif
};
@@ -219,11 +222,13 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_FREENECT
int deviceId_;
Type type_;
freenect_context * ctx_;
FreenectDevice * freenectDevice_;
StereoCameraModel stereoModel_;
#endif
};
/////////////////////////
@@ -266,6 +271,7 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_FREENECT2
int deviceId_;
Type type_;
StereoCameraModel stereoModel_;
@@ -278,6 +284,7 @@ private:
bool bilateralFiltering_;
bool edgeAwareFiltering_;
bool noiseFiltering_;
#endif
};
/////////////////////////
@@ -307,11 +314,13 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_REALSENSE
rs::context * ctx_;
rs::device * dev_;
int deviceId_;
int presetRGB_;
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/Camera.h"
#include "rtabmap/core/CameraRGB.h"
#include "rtabmap/core/Version.h"
#include <list>
namespace FlyCapture2
@@ -73,8 +74,10 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_DC1394
DC1394Device *device_;
StereoCameraModel stereoModel_;
#endif
};
/////////////////////////
@@ -98,8 +101,10 @@ protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_FLYCAPTURE2
FlyCapture2::Camera * camera_;
void * triclopsCtx_; // TriclopsContext
#endif
};
/////////////////////////
@@ -136,12 +141,13 @@ public:
virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
virtual bool isCalibrated() const;
virtual std::string getSerial() const;
virtual bool odomProvided() const { return computeOdometry_; }
virtual bool odomProvided() const;
protected:
virtual SensorData captureImage(CameraInfo * info = 0);
private:
#ifdef RTABMAP_ZED
sl::zed::Camera * zed_;
StereoCameraModel stereoModel_;
CameraVideo::Source src_;
@@ -154,6 +160,7 @@ private:
int confidenceThr_;
bool computeOdometry_;
bool lost_;
#endif
};
/////////////////////////

View File

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

View File

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