Voxel  0.5.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Voxel::DepthCamera Class Referenceabstract

This is primary class which provides API for a depth camera. More...

#include <DepthCamera.h>

+ Inheritance diagram for Voxel::DepthCamera:
+ Collaboration diagram for Voxel::DepthCamera:

Public Types

enum  FrameType {
  FRAME_RAW_FRAME_UNPROCESSED = 0, FRAME_RAW_FRAME_PROCESSED = 1, FRAME_DEPTH_FRAME = 2, FRAME_XYZI_POINT_CLOUD_FRAME = 3,
  FRAME_TYPE_COUNT = 4
}
 
typedef Function< void(DepthCamera
&camera, const Frame &frame,
FrameType callBackType)> 
CallbackType
 

Public Member Functions

 DepthCamera (const String &name, const String &chipset, DevicePtr device)
 
virtual bool isInitialized () const
 
const Stringname () const
 
const Stringid () const
 
const Stringchipset () const
 
virtual bool getSerialNumber (String &serialNumber) const
 
virtual bool setSerialNumber (const String &serialNumber)
 
const DevicePtrgetDevice () const
 
bool isRunning () const
 
bool isPaused () const
 
bool pause ()
 
bool resume ()
 
template<typename T >
bool getStreamParam (const String &name, T &value) const
 
bool refreshParams ()
 
template<typename T >
bool get (const String &name, T &value, bool refresh=false) const
 
template<typename T >
bool set (const String &name, const T &value)
 
const ParameterPtr getParam (const String &name) const
 
const Map< String, ParameterPtr > & getParameters () const
 
bool setFrameRate (const FrameRate &r)
 
bool getFrameRate (FrameRate &r) const
 
bool setFrameSize (const FrameSize &s)
 
bool getFrameSize (FrameSize &s) const
 
bool getMaximumFrameSize (FrameSize &s) const
 
bool getMaximumFrameRate (FrameRate &frameRate, const FrameSize &forFrameSize) const
 
bool getSupportedVideoModes (Vector< SupportedVideoMode > &supportedVideoModes) const
 
bool getMaximumVideoMode (VideoMode &videoMode) const
 
bool getBytesPerPixel (uint &bpp) const
 
bool setBytesPerPixel (const uint &bpp)
 
bool getROI (RegionOfInterest &roi)
 
bool setROI (const RegionOfInterest &roi)
 
bool allowedROI (String &message)
 
bool getFieldOfView (float &fovHalfAngle) const
 
virtual bool saveFrameStream (const String &fileName)
 
virtual bool isSavingFrameStream ()
 
virtual bool closeFrameStream ()
 
virtual bool registerCallback (FrameType type, CallbackType f)
 
virtual bool clearAllCallbacks ()
 
virtual bool clearCallback (FrameType type)
 
virtual int addFilter (FilterPtr p, FrameType frameType, int beforeFilterID=-1)
 
virtual FilterPtr getFilter (int filterID, FrameType frameType) const
 
virtual bool removeFilter (int filterID, FrameType frameType)
 
virtual bool removeAllFilters (FrameType frameType)
 
virtual void resetFilters ()
 
const FilterSet< RawFrame > & getUnprocessedRawFilterSet ()
 
const FilterSet< RawFrame > & getProcessedRawFilterSet ()
 
const FilterSet< DepthFrame > & getDepthFilterSet ()
 
bool start ()
 
bool stop ()
 
void wait ()
 
bool reset ()
 
Ptr< RegisterProgrammergetProgrammer ()
 
Ptr< StreamergetStreamer ()
 
bool reloadConfiguration ()
 
const Map< int, String > & getCameraProfileNames ()
 
int getCurrentCameraProfileID ()
 
int addCameraProfile (const String &profileName, const int parentID)
 
bool setCameraProfile (const int id, bool softApply=false)
 
bool removeCameraProfile (const int id)
 
bool saveCameraProfileToHardware (int &id)
 
bool close ()
 
virtual ~DepthCamera ()
 

Public Attributes

MainConfigurationFile configFile
 

Protected Member Functions

bool _addParameters (const Vector< ParameterPtr > &params)
 
virtual bool _callbackAndContinue (uint32_t &callBackTypesToBeCalled, FrameType type, const Frame &frame)
 
virtual bool _start ()=0
 
virtual bool _stop ()=0
 
virtual bool _captureRawUnprocessedFrame (RawFramePtr &rawFrame)=0
 
virtual bool _processRawFrame (const RawFramePtr &rawFrameInput, RawFramePtr &rawFrameOutput)=0
 
virtual bool _convertToDepthFrame (const RawFramePtr &rawFrame, DepthFramePtr &depthFrame)=0
 
virtual bool _convertToPointCloudFrame (const DepthFramePtr &depthFrame, PointCloudFramePtr &pointCloudFrame)
 
virtual void _captureLoop ()
 
void _captureThreadWrapper ()
 
bool _writeToFrameStream (RawFramePtr &rawUnprocessed)
 
template<typename T >
bool _get (const String &name, T &value, bool refresh=false) const
 
template<typename T >
bool _set (const String &name, const T &value)
 
virtual bool _setFrameRate (const FrameRate &r)=0
 
virtual bool _getFrameRate (FrameRate &r) const =0
 
virtual bool _setFrameSize (const FrameSize &s)=0
 
virtual bool _getFrameSize (FrameSize &s) const =0
 
virtual bool _getMaximumFrameSize (FrameSize &s) const =0
 
virtual bool _getMaximumFrameRate (FrameRate &frameRate, const FrameSize &forFrameSize) const =0
 
virtual bool _getSupportedVideoModes (Vector< SupportedVideoMode > &supportedVideoModes) const =0
 
virtual bool _getMaximumVideoMode (VideoMode &videoMode) const =0
 
virtual bool _getBytesPerPixel (uint &bpp) const =0
 
virtual bool _setBytesPerPixel (const uint &bpp)=0
 
virtual bool _getROI (RegionOfInterest &roi)=0
 
virtual bool _setROI (const RegionOfInterest &roi)=0
 
virtual bool _allowedROI (String &message)=0
 
virtual bool _getFieldOfView (float &fovHalfAngle) const =0
 
void _makeID ()
 
virtual bool _reset ()=0
 
virtual bool _onReset ()=0
 
virtual bool _applyConfigParams (const ConfigSet *params)
 
virtual bool _saveCurrentProfileID (const int id)=0
 
virtual bool _getCurrentProfileID (int &id)=0
 
bool _init ()
 
Map< String,
CalibrationInformation > & 
_getCalibrationInformationStructure ()
 

Protected Attributes

DevicePtr _device
 
String _name
 
String _id
 
String _chipset
 
Map< String, ParameterPtr_parameters
 
Ptr< RegisterProgrammer_programmer
 
Ptr< Streamer_streamer
 
FrameGeneratorPtr _frameGenerators [3]
 
Ptr< PointCloudFrameGenerator_pointCloudFrameGenerator
 
bool _parameterInit
 
FrameBufferManager< RawFrame_rawFrameBuffers
 
FrameBufferManager< DepthFrame_depthFrameBuffers
 
FrameBufferManager
< PointCloudFrame
_pointCloudBuffers
 
FilterSet< RawFrame_unprocessedFilters
 
FilterSet< RawFrame_processedFilters
 
FilterSet< DepthFrame_depthFilters
 
FrameStreamWriterPtr _frameStreamWriter
 
CallbackType _callback [FRAME_TYPE_COUNT]
 
uint32_t _callBackTypesRegistered = 0
 
ThreadPtr _captureThread
 
bool _running
 
bool _isPaused
 

Private Attributes

Mutex _accessMutex
 
Mutex _frameStreamWriterMutex
 

Detailed Description

This is primary class which provides API for a depth camera.

DepthCamera is an abstract class which needs to be derived and implemented for individual depth camera types.

Definition at line 41 of file DepthCamera.h.

Member Typedef Documentation

typedef Function<void (DepthCamera &camera, const Frame &frame, FrameType callBackType)> Voxel::DepthCamera::CallbackType

Definition at line 53 of file DepthCamera.h.

Member Enumeration Documentation

Enumerator
FRAME_RAW_FRAME_UNPROCESSED 
FRAME_RAW_FRAME_PROCESSED 
FRAME_DEPTH_FRAME 
FRAME_XYZI_POINT_CLOUD_FRAME 
FRAME_TYPE_COUNT 

Definition at line 44 of file DepthCamera.h.

Constructor & Destructor Documentation

Voxel::DepthCamera::DepthCamera ( const String name,
const String chipset,
DevicePtr  device 
)

Definition at line 20 of file DepthCamera.cpp.

References _frameGenerators, _makeID(), _pointCloudFrameGenerator, configFile, and Voxel::MainConfigurationFile::read().

20  : _device(device), _name(name), _chipset(chipset),
22 _parameterInit(true), _running(false), _isPaused(false),
24 _pointCloudFrameGenerator(new PointCloudFrameGenerator()),
25 configFile(name, "")
26 {
27  _frameGenerators[2] = std::dynamic_pointer_cast<FrameGenerator>(_pointCloudFrameGenerator);
28  _makeID();
29 
30  configFile.read(name + ".conf"); // Read and keep the configuration ready for use. The file must be in VOXEL_CONF_PATH
31 }
virtual bool read(const String &configFile)
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FrameBufferManager< PointCloudFrame > _pointCloudBuffers
Definition: DepthCamera.h:78
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
FrameGeneratorPtr _frameGenerators[3]
Definition: DepthCamera.h:70
FrameBufferManager< DepthFrame > _depthFrameBuffers
Definition: DepthCamera.h:77
MainConfigurationFile configFile
Definition: DepthCamera.h:156
#define MAX_FRAME_BUFFERS
Definition: FrameBuffer.h:15
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80
Ptr< PointCloudFrameGenerator > _pointCloudFrameGenerator
Definition: DepthCamera.h:72
DevicePtr _device
Definition: DepthCamera.h:60
FrameBufferManager< RawFrame > _rawFrameBuffers
Definition: DepthCamera.h:76

+ Here is the call graph for this function:

Voxel::DepthCamera::~DepthCamera ( )
virtual

Definition at line 404 of file DepthCamera.cpp.

References close().

405 {
406  close();
407 }

+ Here is the call graph for this function:

Member Function Documentation

bool Voxel::DepthCamera::_addParameters ( const Vector< ParameterPtr > &  params)
protected

Definition at line 63 of file DepthCamera.cpp.

References _parameters, Voxel::LOG_ERROR, and Voxel::logger.

Referenced by Voxel::TI::ToFHaddockCamera::_init(), Voxel::TI::RTS5825Camera::_init(), Voxel::TI::Voxel14Camera::_init(), Voxel::TI::CalculusCDKCamera::_init(), Voxel::TI::HaddockCDKCamera::_init(), Voxel::TI::VoxelDCamera::_init(), Voxel::TI::TintinCDKCamera::_init(), Voxel::TI::ToFCalculusCamera::_init(), Voxel::TI::ToFTintinCamera::_init(), and Voxel::TI::ToFCamera::_init().

64 {
65  _parameters.reserve(_parameters.size() + params.size());
66 
67  for(const ParameterPtr &p: params)
68  {
69  if(_parameters.find(p->name()) == _parameters.end())
70  {
71  _parameters[p->name()] = p;
72  }
73  else
74  {
75  logger(LOG_ERROR) << "DepthCamera: Found an existing parameter in the list of parameters, with name " << p->name() << ". Not overwriting it." << std::endl;
76  //return _parameterInit = false;
77  }
78  }
79  return true;
80 }
Ptr< Parameter > ParameterPtr
Definition: Parameter.h:86
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_allowedROI ( String message)
protectedpure virtual

Implemented in Voxel::TI::ToFTintinCamera, Voxel::TI::ToFCalculusCamera, and Voxel::TI::ToFHaddockCamera.

Referenced by allowedROI().

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::_applyConfigParams ( const ConfigSet params)
protectedvirtual

Definition at line 656 of file DepthCamera.cpp.

References _programmer, Voxel::FrameRate::denominator, Voxel::gcd(), Voxel::ConfigSet::get(), Voxel::ConfigSet::getBoolean(), Voxel::ConfigSet::getFloat(), Voxel::ConfigSet::getInteger(), getParam(), Voxel::LOG_ERROR, Voxel::LOG_INFO, Voxel::logger, Voxel::FrameRate::numerator, Voxel::ConfigSet::paramNames, CameraSystemIQFrameTest::r, set(), and setFrameRate().

Referenced by setCameraProfile().

657 {
658  for(auto i = 0; i < params->paramNames.size(); i++)
659  {
660  if(params->paramNames[i].compare(0, 2, "0x") == 0)
661  {
662  logger(LOG_INFO) << "DepthCamera: Setting register '" << params->paramNames[i] << "'" << std::endl;
663 
664  char *endptr;
665  uint32_t reg = (uint32_t)strtol(params->paramNames[i].c_str(), &endptr, 16);
666  uint32_t value = (uint32_t)strtol(params->get(params->paramNames[i]).c_str(), &endptr, 0);
667 
668  if(!_programmer->writeRegister(reg, value))
669  {
670  logger(LOG_ERROR) << "Failed to write to register @0x" << std::hex << reg << " = 0x" << value << std::dec << std::endl;
671  }
672  continue;
673  }
674  else if(params->paramNames[i] == "frame_rate")
675  {
676  float rate = params->getFloat(params->paramNames[i]);
677  FrameRate r;
678  r.numerator = rate*10000;
679  r.denominator = 10000;
680 
681  uint g = gcd(r.numerator, r.denominator);
682 
683  r.numerator /= g;
684  r.denominator /= g;
685 
686  if(!setFrameRate(r))
687  {
688  logger(LOG_ERROR) << "DepthCamera: Failed to set frame rate to " << rate << "fps" << std::endl;
689  return false;
690  }
691  continue;
692  }
693 
694  logger(LOG_INFO) << "DepthCamera: Setting parameter '" << params->paramNames[i] << "'" << std::endl;
695 
696  const Parameter *p = getParam(params->paramNames[i]).get();
697 
698  if(!p)
699  {
700  logger(LOG_ERROR) << "DepthCamera: Ignoring unknown parameter " << params->paramNames[i] << std::endl;
701  return false;
702  }
703 
704  const BoolParameter *bp = dynamic_cast<const BoolParameter *>(p);
705  const EnumParameter *ep = dynamic_cast<const EnumParameter *>(p);
706  const IntegerParameter *ip = dynamic_cast<const IntegerParameter *>(p);
707  const UnsignedIntegerParameter *up = dynamic_cast<const UnsignedIntegerParameter *>(p);
708  const FloatParameter *fp = dynamic_cast<const FloatParameter *>(p);
709 
710  if(bp)
711  {
712  if(!set(params->paramNames[i], params->getBoolean(params->paramNames[i])))
713  return false;
714  }
715  else if(ip || ep)
716  {
717  if(!set(params->paramNames[i], params->getInteger(params->paramNames[i])))
718  return false;
719  }
720  else if(up)
721  {
722  if(!set(params->paramNames[i], (uint)params->getInteger(params->paramNames[i])))
723  return false;
724  }
725  else if(fp)
726  {
727  if(!set(params->paramNames[i], params->getFloat(params->paramNames[i])))
728  return false;
729  }
730  else
731  {
732  logger(LOG_ERROR) << "DepthCamera: Parameter type unknown for " << params->paramNames[i] << std::endl;
733  return false;
734  }
735  }
736  return true;
737 }
RangeParameterTemplate< uint > UnsignedIntegerParameter
Definition: Parameter.h:403
bool set(const String &name, const T &value)
Definition: DepthCamera.h:271
Ptr< RegisterProgrammer > _programmer
Definition: DepthCamera.h:66
class VOXEL_EXPORT Parameter
uint gcd(uint n, uint m)
Definition: Common.cpp:135
Logger logger(LOG_WARNING)
Definition: Logger.h:180
bool setFrameRate(const FrameRate &r)
Definition: DepthCamera.h:289
const ParameterPtr getParam(const String &name) const
Definition: DepthCamera.h:424

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::_callbackAndContinue ( uint32_t &  callBackTypesToBeCalled,
DepthCamera::FrameType  type,
const Frame frame 
)
protectedvirtual

Definition at line 114 of file DepthCamera.cpp.

References _callback, and _isPaused.

Referenced by _captureLoop().

115 {
116  if(!_isPaused && (callBackTypesToBeCalled | (1 << type)) && _callback[type])
117  {
118  _callback[type](*this, frame, type);
119  }
120 
121  callBackTypesToBeCalled &= ~(1 << type);
122 
123  return callBackTypesToBeCalled != 0;
124 }
CallbackType _callback[FRAME_TYPE_COUNT]
Definition: DepthCamera.h:88

+ Here is the caller graph for this function:

void Voxel::DepthCamera::_captureLoop ( )
protectedvirtual

Definition at line 127 of file DepthCamera.cpp.

References _callback, _callbackAndContinue(), _callBackTypesRegistered, _captureRawUnprocessedFrame(), _convertToDepthFrame(), _convertToPointCloudFrame(), _depthFilters, _depthFrameBuffers, _isPaused, _pointCloudBuffers, _processedFilters, _processRawFrame(), _rawFrameBuffers, _running, _stop(), _unprocessedFilters, _writeToFrameStream(), closeFrameStream(), FRAME_DEPTH_FRAME, FRAME_RAW_FRAME_PROCESSED, FRAME_RAW_FRAME_UNPROCESSED, FRAME_XYZI_POINT_CLOUD_FRAME, id(), isSavingFrameStream(), Voxel::LOG_ERROR, Voxel::LOG_INFO, and Voxel::logger.

Referenced by _captureThreadWrapper().

128 {
129  uint consecutiveCaptureFails = 0;
130 
131  while(_running)
132  {
133  uint32_t callBackTypesToBeCalled = _callBackTypesRegistered;
134 
135  if(consecutiveCaptureFails > 100)
136  {
137  logger(LOG_ERROR) << "DepthCamera: 100 consecutive failures in capture of frame. Stopping stream for " << id() << std::endl;
138  _running = false;
139  continue;
140  }
141 
142  if((_callBackTypesRegistered == 0 || _callBackTypesRegistered == FRAME_RAW_FRAME_UNPROCESSED) && !isSavingFrameStream()) // Only unprocessed frame types requested or none requested?
143  {
144  auto f = _rawFrameBuffers.get();
145 
147  {
148  consecutiveCaptureFails++;
149  continue;
150  }
151 
153  {
154  FilterSet<RawFrame>::FrameSequence _frameBuffers;
155  _frameBuffers.push_front(f);
156 
157  if(!_unprocessedFilters.applyFilter(_frameBuffers))
158  {
159  logger(LOG_ERROR) << "DepthCamera: Failed to apply filters on raw unprocessed frame" << std::endl;
160  consecutiveCaptureFails++;
161  continue;
162  }
163 
164  if(!_isPaused)
165  _callback[FRAME_RAW_FRAME_UNPROCESSED](*this, (Frame &)(**_frameBuffers.begin()), FRAME_RAW_FRAME_UNPROCESSED);
166 
167  _writeToFrameStream(**_frameBuffers.begin());
168  }
169  else
170  {
172  }
173 
174  consecutiveCaptureFails = 0;
175  }
176  else
177  {
178  auto f1 = _rawFrameBuffers.get();
180  {
181  consecutiveCaptureFails++;
182  continue;
183  }
184 
185  FilterSet<RawFrame>::FrameSequence _unprocessedFrameBuffers;
186  _unprocessedFrameBuffers.push_front(f1);
187 
188  if(!_unprocessedFilters.applyFilter(_unprocessedFrameBuffers))
189  {
190  logger(LOG_ERROR) << "DepthCamera: Failed to apply filters on raw unprocessed frame" << std::endl;
191  consecutiveCaptureFails++;
192  continue;
193  }
194 
195  if(!_callbackAndContinue(callBackTypesToBeCalled, FRAME_RAW_FRAME_UNPROCESSED, ***_unprocessedFrameBuffers.begin()) && !isSavingFrameStream())
196  {
197  consecutiveCaptureFails = 0;
198  continue;
199  }
200 
201  auto f = _rawFrameBuffers.get();
202 
203  if(!_processRawFrame(**_unprocessedFrameBuffers.begin(), *f))
204  {
205  consecutiveCaptureFails++;
206  continue;
207  }
208 
209  FilterSet<RawFrame>::FrameSequence _processedFrameBuffers;
210  _processedFrameBuffers.push_front(f);
211 
212  if(!_processedFilters.applyFilter(_processedFrameBuffers))
213  {
214  logger(LOG_ERROR) << "DepthCamera: Failed to apply filters on raw processed frame" << std::endl;
215  consecutiveCaptureFails++;
216  continue;
217  }
218 
219  if(!_callbackAndContinue(callBackTypesToBeCalled, FRAME_RAW_FRAME_PROCESSED, ***_processedFrameBuffers.begin()) && !isSavingFrameStream())
220  {
221  consecutiveCaptureFails = 0;
222  continue;
223  }
224 
225  auto d = _depthFrameBuffers.get();
226 
227  if(!_convertToDepthFrame(**_processedFrameBuffers.begin(), *d))
228  {
229  consecutiveCaptureFails++;
230  continue;
231  }
232 
233  FilterSet<DepthFrame>::FrameSequence _depthFrameBuffers;
234  _depthFrameBuffers.push_front(d);
235 
236  if(!_depthFilters.applyFilter(_depthFrameBuffers))
237  {
238  logger(LOG_ERROR) << "DepthCamera: Failed to apply filters on depth frame" << std::endl;
239  consecutiveCaptureFails++;
240  continue;
241  }
242 
243  if(!_callbackAndContinue(callBackTypesToBeCalled, FRAME_DEPTH_FRAME, ***_depthFrameBuffers.begin()) && !isSavingFrameStream())
244  {
245  consecutiveCaptureFails = 0;
246  continue;
247  }
248 
249  auto p = _pointCloudBuffers.get();
250 
251  if(!_convertToPointCloudFrame(**_depthFrameBuffers.begin(), *p))
252  {
253  consecutiveCaptureFails++;
254  continue;
255  }
256 
257  _callbackAndContinue(callBackTypesToBeCalled, FRAME_XYZI_POINT_CLOUD_FRAME, **p);
258  consecutiveCaptureFails = 0;
259 
260  _writeToFrameStream(**_unprocessedFrameBuffers.begin());
261  }
262  }
263 
264  if(!_running)
265  {
267  _stop();
268  }
269 
270  logger(LOG_INFO) << "DepthCamera: Streaming stopped." << std::endl;
271 }
const String & id() const
Definition: DepthCamera.h:168
virtual bool _stop()=0
uint32_t _callBackTypesRegistered
Definition: DepthCamera.h:90
virtual bool _processRawFrame(const RawFramePtr &rawFrameInput, RawFramePtr &rawFrameOutput)=0
virtual bool isSavingFrameStream()
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
virtual bool closeFrameStream()
FrameBufferManager< PointCloudFrame > _pointCloudBuffers
Definition: DepthCamera.h:78
virtual bool _callbackAndContinue(uint32_t &callBackTypesToBeCalled, FrameType type, const Frame &frame)
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
CallbackType _callback[FRAME_TYPE_COUNT]
Definition: DepthCamera.h:88
virtual bool _convertToDepthFrame(const RawFramePtr &rawFrame, DepthFramePtr &depthFrame)=0
FrameBufferManager< DepthFrame > _depthFrameBuffers
Definition: DepthCamera.h:77
virtual bool _captureRawUnprocessedFrame(RawFramePtr &rawFrame)=0
Logger logger(LOG_WARNING)
Definition: Logger.h:180
bool _writeToFrameStream(RawFramePtr &rawUnprocessed)
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80
FrameBufferManager< RawFrame > _rawFrameBuffers
Definition: DepthCamera.h:76
virtual bool _convertToPointCloudFrame(const DepthFramePtr &depthFrame, PointCloudFramePtr &pointCloudFrame)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_captureRawUnprocessedFrame ( RawFramePtr rawFrame)
protectedpure virtual

Implemented in Voxel::TI::ToFCameraBase.

Referenced by _captureLoop().

+ Here is the caller graph for this function:

void Voxel::DepthCamera::_captureThreadWrapper ( )
protected

Definition at line 296 of file DepthCamera.cpp.

References _captureLoop().

Referenced by start().

297 {
298  _captureLoop();
299 }
virtual void _captureLoop()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_convertToDepthFrame ( const RawFramePtr rawFrame,
DepthFramePtr depthFrame 
)
protectedpure virtual

Implemented in Voxel::TI::ToFCameraBase.

Referenced by _captureLoop().

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::_convertToPointCloudFrame ( const DepthFramePtr depthFrame,
PointCloudFramePtr pointCloudFrame 
)
protectedvirtual

Definition at line 273 of file DepthCamera.cpp.

References _pointCloudFrameGenerator, Voxel::LOG_ERROR, Voxel::logger, LensCalibrationTest::p1, and LensCalibrationTest::p2.

Referenced by _captureLoop().

274 {
275  if(!depthFrame)
276  {
277  logger(LOG_ERROR) << "DepthCamera: Blank depth frame." << std::endl;
278  return false;
279  }
280 
281  FramePtr p1 = std::dynamic_pointer_cast<Frame>(depthFrame);
282  FramePtr p2 = std::dynamic_pointer_cast<Frame>(pointCloudFrame);
283 
284  bool ret = _pointCloudFrameGenerator->generate(p1, p2);
285 
286  if(ret)
287  {
288  pointCloudFrame = std::dynamic_pointer_cast<PointCloudFrame>(p2);
289  return true;
290  }
291  else
292  return false;
293 }
Logger logger(LOG_WARNING)
Definition: Logger.h:180
Ptr< PointCloudFrameGenerator > _pointCloudFrameGenerator
Definition: DepthCamera.h:72
Ptr< Frame > FramePtr
Definition: Frame.h:53

+ Here is the caller graph for this function:

template<typename T >
bool Voxel::DepthCamera::_get ( const String name,
T &  value,
bool  refresh = false 
) const
protected

Definition at line 364 of file DepthCamera.h.

References _id, _parameters, Voxel::ParameterTemplate< T >::get(), Voxel::LOG_ERROR, Voxel::logger, and name().

Referenced by Voxel::TI::ToFCamera::_getBytesPerPixel(), Voxel::TI::ToFCamera::_getCurrentProfileID(), Voxel::TI::ToFCamera::_getFrameRate(), Voxel::TI::ToFCamera::_getFrameSize(), Voxel::TI::HaddockCDKCamera::_getMaximumFrameRate(), Voxel::TI::TintinCDKCamera::_getMaximumFrameRate(), Voxel::TI::RTS5825Camera::_getMaximumVideoMode(), Voxel::TI::Voxel14Camera::_getMaximumVideoMode(), Voxel::TI::VoxelDCamera::_getMaximumVideoMode(), Voxel::TI::TintinCDKCamera::_getMaximumVideoMode(), Voxel::TI::ToFHaddockCamera::_getROI(), Voxel::TI::ToFCalculusCamera::_getROI(), Voxel::TI::ToFTintinCamera::_getROI(), Voxel::TI::ToFCamera::_getToFFrameType(), Voxel::TI::ToFHaddockCamera::_isHistogramEnabled(), Voxel::TI::ToFCamera::_setFrameRate(), Voxel::TI::Voxel14Camera::_setStreamerFrameSize(), Voxel::TI::HaddockCDKCamera::_setStreamerFrameSize(), Voxel::TI::VoxelDCamera::_setStreamerFrameSize(), Voxel::TI::TintinCDKCamera::_setStreamerFrameSize(), Voxel::TI::ToFCalculusCamera::_updateEasyConf(), Voxel::TI::HaddockVCOFrequency::get(), Voxel::TI::IntegrationTimeParameter::get(), Voxel::TI::TintinVCOFrequency::get(), Voxel::TI::HaddockCDKIlluminationPowerPercentageParameter::get(), Voxel::TI::HaddockModulationFrequencyParameter::get(), Voxel::TI::CalculusVCOFrequency::get(), Voxel::TI::TintinModulationFrequencyParameter::get(), Voxel::TI::CalculusModulationFrequencyParameter::get(), get(), Voxel::TI::TintinUnambiguousRangeParameter::get(), Voxel::TI::HaddockSensorTemperatureParameter::get(), Voxel::TI::TintinModulationFrequencyParameter::lowerLimit(), Voxel::TI::IntegrationTimeParameter::set(), Voxel::TI::TintinModulationFrequencyParameter::set(), and Voxel::TI::TintinModulationFrequencyParameter::upperLimit().

365 {
366  auto p = _parameters.find(name);
367 
368  if(p != _parameters.end())
369  {
370  ParameterTemplate<T> *param = dynamic_cast<ParameterTemplate<T> *>(p->second.get());
371 
372  if(param == 0)
373  {
374  logger(LOG_ERROR) << "DepthCamera: Invalid value type '" << typeid(value).name() << "' used to get parameter " << _id << "." << name << std::endl;
375  return false;
376  }
377 
378  if(!param->get(value, refresh))
379  {
380  logger(LOG_ERROR) << "DepthCamera:Could not get value for parameter " << _id << "." << name << std::endl;
381  return false;
382  }
383 
384  return true;
385  }
386  else
387  {
388  logger(LOG_ERROR) << "DepthCamera: Unknown parameter " << _id << "." << name << std::endl;
389  return false;
390  }
391 }
const String & name() const
Definition: DepthCamera.h:166
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getBytesPerPixel ( uint &  bpp) const
protectedpure virtual

Implemented in Voxel::TI::ToFCamera, and Voxel::TI::ToFCalculusCamera.

Referenced by getBytesPerPixel().

+ Here is the caller graph for this function:

Map<String, CalibrationInformation>& Voxel::DepthCamera::_getCalibrationInformationStructure ( )
inlineprotected

Definition at line 153 of file DepthCamera.h.

Referenced by Voxel::TI::ToFHaddockCamera::_init(), Voxel::TI::RTS5825Camera::_init(), Voxel::TI::Voxel14Camera::_init(), Voxel::TI::HaddockCDKCamera::_init(), Voxel::TI::VoxelDCamera::_init(), Voxel::TI::TintinCDKCamera::_init(), Voxel::TI::ToFTintinCamera::_init(), Voxel::TI::ToFCamera::_init(), and _init().

Map< String, CalibrationInformation > _calibrationInformation
MainConfigurationFile configFile
Definition: DepthCamera.h:156

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getCurrentProfileID ( int id)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by _init().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getFieldOfView ( float fovHalfAngle) const
protectedpure virtual

Implemented in Voxel::TI::TintinCDKCamera, Voxel::TI::VoxelDCamera, Voxel::TI::HaddockCDKCamera, Voxel::TI::CalculusCDKCamera, Voxel::TI::Voxel14Camera, and Voxel::TI::RTS5825Camera.

Referenced by getFieldOfView().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getFrameRate ( FrameRate r) const
protectedpure virtual

Implemented in Voxel::TI::ToFCamera, and Voxel::TI::ToFCalculusCamera.

Referenced by getFrameRate().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getFrameSize ( FrameSize s) const
protectedpure virtual

Implemented in Voxel::TI::ToFCamera, and Voxel::TI::ToFCalculusCamera.

Referenced by getFrameSize().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getMaximumFrameRate ( FrameRate frameRate,
const FrameSize forFrameSize 
) const
protectedpure virtual

Implemented in Voxel::TI::ToFCamera, Voxel::TI::TintinCDKCamera, Voxel::TI::HaddockCDKCamera, and Voxel::TI::CalculusCDKCamera.

Referenced by getMaximumFrameRate().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getMaximumFrameSize ( FrameSize s) const
protectedpure virtual

Implemented in Voxel::TI::ToFTintinCamera, Voxel::TI::ToFCalculusCamera, and Voxel::TI::ToFHaddockCamera.

Referenced by Voxel::TI::ToFCamera::_setFrameSize(), and getMaximumFrameSize().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getMaximumVideoMode ( VideoMode videoMode) const
protectedpure virtual

Implemented in Voxel::TI::TintinCDKCamera, Voxel::TI::VoxelDCamera, Voxel::TI::HaddockCDKCamera, Voxel::TI::CalculusCDKCamera, Voxel::TI::Voxel14Camera, and Voxel::TI::RTS5825Camera.

Referenced by getMaximumVideoMode().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getROI ( RegionOfInterest roi)
protectedpure virtual

Implemented in Voxel::TI::ToFTintinCamera, Voxel::TI::ToFCalculusCamera, and Voxel::TI::ToFHaddockCamera.

Referenced by Voxel::TI::ToFCamera::_setFrameSize(), and getROI().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_getSupportedVideoModes ( Vector< SupportedVideoMode > &  supportedVideoModes) const
protectedpure virtual

Implemented in Voxel::TI::TintinCDKCamera, Voxel::TI::VoxelDCamera, Voxel::TI::HaddockCDKCamera, Voxel::TI::CalculusCDKCamera, Voxel::TI::Voxel14Camera, and Voxel::TI::RTS5825Camera.

Referenced by Voxel::TI::ToFCamera::_getMaximumFrameRate(), Voxel::TI::ToFCamera::_setFrameSize(), and getSupportedVideoModes().

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::_init ( )
protected

Definition at line 33 of file DepthCamera.cpp.

References _getCalibrationInformationStructure(), _getCurrentProfileID(), CALIB_SECT_LENS, CALIB_SECT_LENS_ID, Voxel::CalibrationInformation::calibrationParameters, configFile, Voxel::CalibrationInformation::definingParameters, Voxel::MainConfigurationFile::getDefaultCameraProfileID(), getSerialNumber(), Voxel::CalibrationInformation::id, Voxel::CalibrationInformation::name, Voxel::MainConfigurationFile::readFromHardware(), setCameraProfile(), and Voxel::MainConfigurationFile::setHardwareID().

Referenced by Voxel::TI::ToFCameraBase::_init().

34 {
35  {
36  CalibrationInformation &calibInfo = _getCalibrationInformationStructure()[CALIB_SECT_LENS];
37  calibInfo.name = CALIB_SECT_LENS;
38  calibInfo.id = CALIB_SECT_LENS_ID;
39  calibInfo.definingParameters = {};
40  calibInfo.calibrationParameters = {"fx", "fy", "cx", "cy", "k1", "k2", "k3", "p1", "p2"};
41  }
42 
43  String serialNumber;
44 
45  if(getSerialNumber(serialNumber))
46  {
47  configFile.setHardwareID(serialNumber);
49  }
50 
51  int currentID = -1;
52  if(_getCurrentProfileID(currentID) && currentID >= 0)
53  {
54  if(!setCameraProfile(currentID, true))
56  else
57  return true;
58  }
59  else
61 }
bool setCameraProfile(const int id, bool softApply=false)
#define CALIB_SECT_LENS_ID
Definition: DepthCamera.h:28
virtual bool _getCurrentProfileID(int &id)=0
virtual bool getSerialNumber(String &serialNumber) const
#define CALIB_SECT_LENS
Definition: DepthCamera.h:27
Map< String, CalibrationInformation > & _getCalibrationInformationStructure()
Definition: DepthCamera.h:153
MainConfigurationFile configFile
Definition: DepthCamera.h:156
void setHardwareID(const String &hwID)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Voxel::DepthCamera::_makeID ( )
inlineprotected

Definition at line 141 of file DepthCamera.h.

Referenced by Voxel::TI::Voxel14Camera::_init(), Voxel::TI::VoxelDCamera::_init(), and DepthCamera().

141 { _id = _name + "(" + _device->id() + ")"; }
DevicePtr _device
Definition: DepthCamera.h:60

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_onReset ( )
protectedpure virtual

Implemented in Voxel::TI::ToFCameraBase.

Referenced by setCameraProfile().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_processRawFrame ( const RawFramePtr rawFrameInput,
RawFramePtr rawFrameOutput 
)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by _captureLoop().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_reset ( )
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by reset().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_saveCurrentProfileID ( const int  id)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by setCameraProfile().

+ Here is the caller graph for this function:

template<typename T >
bool Voxel::DepthCamera::_set ( const String name,
const T &  value 
)
protected

Definition at line 394 of file DepthCamera.h.

References _device, _id, _parameters, Voxel::LOG_DEBUG, Voxel::LOG_ERROR, Voxel::logger, name(), and Voxel::ParameterTemplate< T >::set().

Referenced by Voxel::TI::ToFCamera::_saveCurrentProfileID(), Voxel::TI::ToFCamera::_setBinning(), Voxel::TI::ToFCamera::_setBytesPerPixel(), Voxel::TI::ToFCamera::_setFrameRate(), Voxel::TI::ToFHaddockCamera::_setROI(), Voxel::TI::ToFCalculusCamera::_setROI(), Voxel::TI::ToFTintinCamera::_setROI(), Voxel::TI::ToFCalculusCamera::_updateEasyConf(), Voxel::TI::HaddockVCOFrequency::set(), Voxel::TI::IntegrationTimeParameter::set(), Voxel::TI::TintinVCOFrequency::set(), Voxel::TI::HaddockCDKIlluminationPowerPercentageParameter::set(), Voxel::TI::HaddockModulationFrequencyParameter::set(), Voxel::TI::CalculusVCOFrequency::set(), Voxel::TI::TintinModulationFrequencyParameter::set(), Voxel::TI::HaddockUnambiguousRangeParameter::set(), set(), Voxel::TI::CalculusModulationFrequencyParameter::set(), Voxel::TI::TintinUnambiguousRangeParameter::set(), and Voxel::TI::HaddockSensorTemperatureParameter::set().

395 {
396  auto p = _parameters.find(name);
397 
398  if(p != _parameters.end())
399  {
400  logger(LOG_DEBUG) << "DepthCamera: Setting parameter '" << name << "' = " << value << std::endl;
401  ParameterTemplate<T> *param = dynamic_cast<ParameterTemplate<T> *>(p->second.get());
402 
403  if(param == 0)
404  {
405  logger(LOG_ERROR) << "DepthCamera: Invalid value type '" << typeid(value).name() << "' used to set parameter " << this->name() << "(" << _device->id() << ")." << name << std::endl;
406  return false;
407  }
408 
409  if(!param->set(value))
410  {
411  logger(LOG_ERROR) << "DepthCamera: Could not set value " << value << " for parameter " << this->name() << "(" << _device->id() << ")." << name << std::endl;
412  return false;
413  }
414 
415  return true;
416  }
417  else
418  {
419  logger(LOG_ERROR) << "DepthCamera: Unknown parameter " << _id << "." << name << std::endl;
420  return false;
421  }
422 }
const String & name() const
Definition: DepthCamera.h:166
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
Logger logger(LOG_WARNING)
Definition: Logger.h:180
DevicePtr _device
Definition: DepthCamera.h:60

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_setBytesPerPixel ( const uint &  bpp)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by setBytesPerPixel().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_setFrameRate ( const FrameRate r)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera, and Voxel::TI::ToFCalculusCamera.

Referenced by setFrameRate().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_setFrameSize ( const FrameSize s)
protectedpure virtual

Implemented in Voxel::TI::ToFCamera.

Referenced by setFrameSize().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_setROI ( const RegionOfInterest roi)
protectedpure virtual

Implemented in Voxel::TI::ToFTintinCamera, Voxel::TI::ToFCalculusCamera, and Voxel::TI::ToFHaddockCamera.

Referenced by Voxel::TI::ToFCamera::_setFrameSize(), and setROI().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_start ( )
protectedpure virtual

Implemented in Voxel::TI::ToFCameraBase.

Referenced by start().

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::_stop ( )
protectedpure virtual

Implemented in Voxel::TI::ToFCameraBase.

Referenced by _captureLoop().

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::_writeToFrameStream ( RawFramePtr rawUnprocessed)
protected

Definition at line 511 of file DepthCamera.cpp.

References _frameStreamWriter, _frameStreamWriterMutex, Voxel::LOG_ERROR, and Voxel::logger.

Referenced by _captureLoop().

512 {
513  Lock<Mutex> _(_frameStreamWriterMutex);
514  if(_frameStreamWriter && (!_frameStreamWriter->isPaused() &&
515  !_frameStreamWriter->write(std::dynamic_pointer_cast<Frame>(rawUnprocessed))))
516  {
517  logger(LOG_ERROR) << "DepthCamera: Failed to save frames to frame stream" << std::endl;
518  return false;
519  }
520  return true;
521 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the caller graph for this function:

int Voxel::DepthCamera::addCameraProfile ( const String profileName,
const int  parentID 
)

Definition at line 644 of file DepthCamera.cpp.

References Voxel::MainConfigurationFile::addCameraProfile(), and configFile.

645 {
646  return configFile.addCameraProfile(profileName, parentID);
647 }
int addCameraProfile(const String &profileName, const int parentID=-1)
MainConfigurationFile configFile
Definition: DepthCamera.h:156

+ Here is the call graph for this function:

int Voxel::DepthCamera::addFilter ( FilterPtr  p,
DepthCamera::FrameType  frameType,
int  beforeFilterID = -1 
)
virtual

Definition at line 427 of file DepthCamera.cpp.

References _depthFilters, _processedFilters, _unprocessedFilters, FRAME_DEPTH_FRAME, FRAME_RAW_FRAME_PROCESSED, FRAME_RAW_FRAME_UNPROCESSED, id(), Voxel::LOG_ERROR, and Voxel::logger.

428 {
429  if(frameType == FRAME_RAW_FRAME_UNPROCESSED)
430  return _unprocessedFilters.addFilter(p, beforeFilterID);
431  else if(frameType == FRAME_RAW_FRAME_PROCESSED)
432  return _processedFilters.addFilter(p, beforeFilterID);
433  else if(frameType == FRAME_DEPTH_FRAME)
434  return _depthFilters.addFilter(p, beforeFilterID);
435  else
436  {
437  logger(LOG_ERROR) << "DepthCamera: Filter not supported for frame type = '" << frameType << "' for camera = " << id() << std::endl;
438  return -1;
439  }
440 }
const String & id() const
Definition: DepthCamera.h:168
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
Logger logger(LOG_WARNING)
Definition: Logger.h:180
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80

+ Here is the call graph for this function:

bool Voxel::DepthCamera::allowedROI ( String message)
inline

Definition at line 345 of file DepthCamera.h.

References _accessMutex, and _allowedROI().

346 {
347  Lock<Mutex> _(_accessMutex);
348  return _allowedROI(message);
349 }
virtual bool _allowedROI(String &message)=0

+ Here is the call graph for this function:

const String& Voxel::DepthCamera::chipset ( ) const
inline

Definition at line 170 of file DepthCamera.h.

170 { return _chipset; }
bool Voxel::DepthCamera::clearAllCallbacks ( )
virtual

Definition at line 82 of file DepthCamera.cpp.

References _callback, and FRAME_TYPE_COUNT.

83 {
84  for(auto i = 0; i < FRAME_TYPE_COUNT; i++)
85  _callback[i] = nullptr;
86  return true;
87 }
CallbackType _callback[FRAME_TYPE_COUNT]
Definition: DepthCamera.h:88
bool Voxel::DepthCamera::clearCallback ( FrameType  type)
virtual

Definition at line 89 of file DepthCamera.cpp.

References _callback, and FRAME_TYPE_COUNT.

90 {
91  if(type < FRAME_TYPE_COUNT)
92  {
93  _callback[type] = nullptr;
94  return true;
95  }
96  return false;
97 }
CallbackType _callback[FRAME_TYPE_COUNT]
Definition: DepthCamera.h:88
bool Voxel::DepthCamera::close ( )

Definition at line 356 of file DepthCamera.cpp.

References _depthFrameBuffers, _parameters, _pointCloudBuffers, _programmer, _rawFrameBuffers, _streamer, isRunning(), and stop().

Referenced by ~DepthCamera().

357 {
358  if(isRunning())
359  stop();
360 
361  _programmer.reset();
362  _streamer.reset();
363 
364  _rawFrameBuffers.clear();
365  _depthFrameBuffers.clear();
366  _pointCloudBuffers.clear();
367 
368  _parameters.clear();
369 
370  return true;
371 }
bool isRunning() const
Definition: DepthCamera.h:177
Ptr< Streamer > _streamer
Definition: DepthCamera.h:67
Ptr< RegisterProgrammer > _programmer
Definition: DepthCamera.h:66
FrameBufferManager< PointCloudFrame > _pointCloudBuffers
Definition: DepthCamera.h:78
FrameBufferManager< DepthFrame > _depthFrameBuffers
Definition: DepthCamera.h:77
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
FrameBufferManager< RawFrame > _rawFrameBuffers
Definition: DepthCamera.h:76

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::closeFrameStream ( )
virtual

Definition at line 562 of file DepthCamera.cpp.

References _frameGenerators, _frameStreamWriter, _frameStreamWriterMutex, Voxel::LOG_DEBUG, and Voxel::logger.

Referenced by _captureLoop().

563 {
564  Lock<Mutex> _(_frameStreamWriterMutex);
566  {
567  _frameGenerators[0]->removeFrameStreamWriter();
568  _frameGenerators[1]->removeFrameStreamWriter();
569  _frameGenerators[2]->removeFrameStreamWriter();
570 
571  _frameStreamWriter->close();
572  _frameStreamWriter.reset();
573  return true;
574  }
575  else
576  {
577  logger(LOG_DEBUG) << "DepthCamera: Frame stream writer not present." << std::endl;
578  return false;
579  }
580 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84
FrameGeneratorPtr _frameGenerators[3]
Definition: DepthCamera.h:70
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the caller graph for this function:

template<typename T >
bool Voxel::DepthCamera::get ( const String name,
T &  value,
bool  refresh = false 
) const

Definition at line 264 of file DepthCamera.h.

References _accessMutex, and _get().

265 {
266  Lock<Mutex> _(_accessMutex);
267  return _get(name, value, refresh);
268 }
bool _get(const String &name, T &value, bool refresh=false) const
Definition: DepthCamera.h:364

+ Here is the call graph for this function:

bool Voxel::DepthCamera::getBytesPerPixel ( uint &  bpp) const
inline

Definition at line 332 of file DepthCamera.h.

References _accessMutex, and _getBytesPerPixel().

333 {
334  Lock<Mutex> _(_accessMutex);
335  return _getBytesPerPixel(bpp);
336 }
virtual bool _getBytesPerPixel(uint &bpp) const =0

+ Here is the call graph for this function:

const Map<int, String>& Voxel::DepthCamera::getCameraProfileNames ( )
inline

Definition at line 251 of file DepthCamera.h.

251 { return configFile.getCameraProfileNames(); }
const Map< int, String > & getCameraProfileNames()
MainConfigurationFile configFile
Definition: DepthCamera.h:156
int Voxel::DepthCamera::getCurrentCameraProfileID ( )
inline

Definition at line 252 of file DepthCamera.h.

252 { return configFile.getCurrentProfileID(); }
MainConfigurationFile configFile
Definition: DepthCamera.h:156
const FilterSet<DepthFrame>& Voxel::DepthCamera::getDepthFilterSet ( )
inline

Definition at line 238 of file DepthCamera.h.

238 { return _depthFilters; }
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
const DevicePtr& Voxel::DepthCamera::getDevice ( ) const
inline

Definition at line 175 of file DepthCamera.h.

175 { return _device; }
DevicePtr _device
Definition: DepthCamera.h:60
bool Voxel::DepthCamera::getFieldOfView ( float fovHalfAngle) const
inline

Definition at line 277 of file DepthCamera.h.

References _accessMutex, and _getFieldOfView().

278 {
279  Lock<Mutex> _(_accessMutex);
280  return _getFieldOfView(fovHalfAngle);
281 }
virtual bool _getFieldOfView(float &fovHalfAngle) const =0

+ Here is the call graph for this function:

FilterPtr Voxel::DepthCamera::getFilter ( int  filterID,
DepthCamera::FrameType  frameType 
) const
virtual

Definition at line 457 of file DepthCamera.cpp.

References _depthFilters, _processedFilters, _unprocessedFilters, FRAME_DEPTH_FRAME, FRAME_RAW_FRAME_PROCESSED, FRAME_RAW_FRAME_UNPROCESSED, id(), Voxel::LOG_ERROR, and Voxel::logger.

458 {
459  if(frameType == FRAME_RAW_FRAME_UNPROCESSED)
460  return _unprocessedFilters.getFilter(filterID);
461  else if(frameType == FRAME_RAW_FRAME_PROCESSED)
462  return _processedFilters.getFilter(filterID);
463  else if(frameType == FRAME_DEPTH_FRAME)
464  return _depthFilters.getFilter(filterID);
465  else
466  {
467  logger(LOG_ERROR) << "DepthCamera: Filter not supported for frame type = '" << frameType << "' for camera = " << id() << std::endl;
468  return nullptr;
469  }
470 }
const String & id() const
Definition: DepthCamera.h:168
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
Logger logger(LOG_WARNING)
Definition: Logger.h:180
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80

+ Here is the call graph for this function:

bool Voxel::DepthCamera::getFrameRate ( FrameRate r) const
inline

Definition at line 283 of file DepthCamera.h.

References _accessMutex, and _getFrameRate().

Referenced by Voxel::TI::ToFCameraBase::_onReset(), and Voxel::TI::ToFCameraBase::_start().

284 {
285  Lock<Mutex> _(_accessMutex);
286  return _getFrameRate(r);
287 }
virtual bool _getFrameRate(FrameRate &r) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::getFrameSize ( FrameSize s) const
inline

Definition at line 295 of file DepthCamera.h.

References _accessMutex, and _getFrameSize().

Referenced by Voxel::TI::CalculusCDKCamera::_init(), Voxel::TI::HaddockCDKCamera::_init(), Voxel::TI::ToFCalculusCamera::_initStartParams(), Voxel::TI::ToFCamera::_initStartParams(), Voxel::TI::ToFCameraBase::_onReset(), and Voxel::TI::ToFCameraBase::_start().

296 {
297  Lock<Mutex> _(_accessMutex);
298  return _getFrameSize(s);
299 }
virtual bool _getFrameSize(FrameSize &s) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::getMaximumFrameRate ( FrameRate frameRate,
const FrameSize forFrameSize 
) const
inline

Definition at line 313 of file DepthCamera.h.

References _accessMutex, and _getMaximumFrameRate().

314 {
315  Lock<Mutex> _(_accessMutex);
316  return _getMaximumFrameRate(frameRate, forFrameSize);
317 }
virtual bool _getMaximumFrameRate(FrameRate &frameRate, const FrameSize &forFrameSize) const =0

+ Here is the call graph for this function:

bool Voxel::DepthCamera::getMaximumFrameSize ( FrameSize s) const
inline

Definition at line 307 of file DepthCamera.h.

References _accessMutex, and _getMaximumFrameSize().

Referenced by Voxel::TI::ToFCamera::_initStartParams().

308 {
309  Lock<Mutex> _(_accessMutex);
310  return _getMaximumFrameSize(s);
311 }
virtual bool _getMaximumFrameSize(FrameSize &s) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::getMaximumVideoMode ( VideoMode videoMode) const
inline

Definition at line 326 of file DepthCamera.h.

References _accessMutex, and _getMaximumVideoMode().

Referenced by Voxel::TI::ToFCameraBase::_onReset().

327 {
328  Lock<Mutex> _(_accessMutex);
329  return _getMaximumVideoMode(videoMode);
330 }
virtual bool _getMaximumVideoMode(VideoMode &videoMode) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const ParameterPtr Voxel::DepthCamera::getParam ( const String name) const
inline

Definition at line 424 of file DepthCamera.h.

References _id, _parameters, Voxel::LOG_ERROR, and Voxel::logger.

Referenced by _applyConfigParams(), Voxel::TI::TintinCDKCamera::_init(), Voxel::TI::TintinCDKIlluminationPowerPercentParameter::get(), Voxel::TI::HaddockModulationFrequencyParameter::set(), Voxel::TI::TintinModulationFrequencyParameter::set(), Voxel::TI::TintinCDKIlluminationPowerPercentParameter::set(), Voxel::TI::HaddockUnambiguousRangeParameter::set(), Voxel::TI::CalculusModulationFrequencyParameter::set(), and Voxel::TI::TintinUnambiguousRangeParameter::set().

425 {
426  auto p = _parameters.find(name);
427 
428  if(p != _parameters.end())
429  return p->second;
430  else
431  {
432  logger(LOG_ERROR) << "DepthCamera: Unknown parameter " << _id << "." << name << std::endl;
433  return 0;
434  }
435 }
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the caller graph for this function:

const Map<String, ParameterPtr>& Voxel::DepthCamera::getParameters ( ) const
inline

Definition at line 197 of file DepthCamera.h.

197 { return _parameters; }
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
const FilterSet<RawFrame>& Voxel::DepthCamera::getProcessedRawFilterSet ( )
inline

Definition at line 237 of file DepthCamera.h.

237 { return _processedFilters; }
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80
Ptr<RegisterProgrammer> Voxel::DepthCamera::getProgrammer ( )
inline

Definition at line 247 of file DepthCamera.h.

247 { return _programmer; } // RegisterProgrammer is usually thread-safe to use outside directly
Ptr< RegisterProgrammer > _programmer
Definition: DepthCamera.h:66
bool Voxel::DepthCamera::getROI ( RegionOfInterest roi)
inline

Definition at line 351 of file DepthCamera.h.

References _accessMutex, and _getROI().

Referenced by Voxel::TI::ToFCalculusCamera::_initStartParams(), and Voxel::TI::ToFCamera::_initStartParams().

352 {
353  Lock<Mutex> _(_accessMutex);
354  return _getROI(roi);
355 }
virtual bool _getROI(RegionOfInterest &roi)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::getSerialNumber ( String serialNumber) const
virtual

Definition at line 739 of file DepthCamera.cpp.

References _device.

Referenced by _init().

740 {
741  serialNumber = _device->serialNumber();
742  return true;
743 }
DevicePtr _device
Definition: DepthCamera.h:60

+ Here is the caller graph for this function:

Ptr<Streamer> Voxel::DepthCamera::getStreamer ( )
inline

Definition at line 248 of file DepthCamera.h.

248 { return _streamer; } // Streamer may not be thread-safe
Ptr< Streamer > _streamer
Definition: DepthCamera.h:67
template<typename T >
bool Voxel::DepthCamera::getStreamParam ( const String name,
T &  value 
) const

Definition at line 438 of file DepthCamera.h.

439 {
440  if(!_frameGenerators[0]->get(name, value) && !_frameGenerators[1]->get(name, value) && !_frameGenerators[2]->get(name, value))
441  return false;
442 
443  return true;
444 }
FrameGeneratorPtr _frameGenerators[3]
Definition: DepthCamera.h:70
bool Voxel::DepthCamera::getSupportedVideoModes ( Vector< SupportedVideoMode > &  supportedVideoModes) const
inline

Definition at line 320 of file DepthCamera.h.

References _accessMutex, and _getSupportedVideoModes().

321 {
322  Lock<Mutex> _(_accessMutex);
323  return _getSupportedVideoModes(supportedVideoModes);
324 }
virtual bool _getSupportedVideoModes(Vector< SupportedVideoMode > &supportedVideoModes) const =0

+ Here is the call graph for this function:

const FilterSet<RawFrame>& Voxel::DepthCamera::getUnprocessedRawFilterSet ( )
inline

Definition at line 236 of file DepthCamera.h.

236 { return _unprocessedFilters; }
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
const String& Voxel::DepthCamera::id ( ) const
inline

Definition at line 168 of file DepthCamera.h.

Referenced by _captureLoop(), Voxel::TI::ToFCamera::_saveCurrentProfileID(), addFilter(), getFilter(), registerCallback(), removeAllFilters(), removeFilter(), and reset().

168 { return _id; }

+ Here is the caller graph for this function:

virtual bool Voxel::DepthCamera::isInitialized ( ) const
inlinevirtual

Definition at line 160 of file DepthCamera.h.

Referenced by Voxel::TI::ToFCameraBase::_captureRawUnprocessedFrame(), Voxel::TI::ToFCameraBase::_start(), and Voxel::TI::ToFCameraBase::_stop().

161  {
162  return _programmer && _programmer->isInitialized() &&
163  _streamer && _streamer->isInitialized() && _parameterInit;
164  }
Ptr< Streamer > _streamer
Definition: DepthCamera.h:67
Ptr< RegisterProgrammer > _programmer
Definition: DepthCamera.h:66

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::isPaused ( ) const
inline

Definition at line 179 of file DepthCamera.h.

179 { return _isPaused; }
bool Voxel::DepthCamera::isRunning ( ) const
inline

Definition at line 177 of file DepthCamera.h.

Referenced by Voxel::TI::ToFCamera::_setFrameSize(), Voxel::TI::ToFHaddockCamera::_setROI(), Voxel::TI::ToFCalculusCamera::_setROI(), Voxel::TI::ToFTintinCamera::_setROI(), close(), reset(), start(), and stop().

177 { return _running; }

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::isSavingFrameStream ( )
virtual

Definition at line 555 of file DepthCamera.cpp.

References _frameStreamWriter, and _frameStreamWriterMutex.

Referenced by _captureLoop().

556 {
557  Lock<Mutex> _(_frameStreamWriterMutex);
558  return _frameStreamWriter?true:false;
559 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84

+ Here is the caller graph for this function:

const String& Voxel::DepthCamera::name ( ) const
inline

Definition at line 166 of file DepthCamera.h.

Referenced by _get(), Voxel::TI::ToFCamera::_getCurrentProfileID(), Voxel::TI::ToFHaddockCamera::_init(), Voxel::TI::ToFCalculusCamera::_init(), Voxel::TI::ToFTintinCamera::_init(), Voxel::TI::ToFCamera::_saveCurrentProfileID(), and _set().

166 { return _name; }

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::pause ( )

Definition at line 373 of file DepthCamera.cpp.

References _frameStreamWriter, _frameStreamWriterMutex, and _isPaused.

374 {
375  if(!_isPaused)
376  {
377  _isPaused = true;
378 
379  Lock<Mutex> _(_frameStreamWriterMutex);
381  _frameStreamWriter->pause();
382  return true;
383  }
384 
385  return false;
386 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84
bool Voxel::DepthCamera::refreshParams ( )

Definition at line 488 of file DepthCamera.cpp.

References _accessMutex, _parameters, Voxel::LOG_ERROR, and Voxel::logger.

Referenced by setCameraProfile().

489 {
490  Lock<Mutex> _(_accessMutex);
491  bool ret = true;
492  for(auto &i: _parameters)
493  {
494  if(!i.second->refresh())
495  {
496  logger(LOG_ERROR) << "DepthCamera: Failed to update value for parameter '" << i.first << "'" << std::endl;
497  ret = false;
498  }
499  }
500  return ret;
501 }
Map< String, ParameterPtr > _parameters
Definition: DepthCamera.h:64
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::registerCallback ( FrameType  type,
CallbackType  f 
)
virtual

Definition at line 99 of file DepthCamera.cpp.

References _callback, _callBackTypesRegistered, FRAME_TYPE_COUNT, id(), Voxel::LOG_ERROR, Voxel::LOG_WARNING, and Voxel::logger.

Referenced by Voxel::PCLGrabber::PCLGrabber().

100 {
101  if(type < FRAME_TYPE_COUNT)
102  {
103  if(_callback[type])
104  logger(LOG_WARNING) << "DepthCamera: " << id() << " already has a callback for this type = " << type << ". Overwriting it now." << std::endl;
105 
106  _callBackTypesRegistered |= (1 << type);
107  _callback[type] = f;
108  return true;
109  }
110  logger(LOG_ERROR) << "DepthCamera: Invalid callback type = " << type << " attempted for depth camera " << id() << std::endl;
111  return false;
112 }
const String & id() const
Definition: DepthCamera.h:168
uint32_t _callBackTypesRegistered
Definition: DepthCamera.h:90
CallbackType _callback[FRAME_TYPE_COUNT]
Definition: DepthCamera.h:88
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::reloadConfiguration ( )
inline

Definition at line 250 of file DepthCamera.h.

250 { return configFile.read(_name + ".conf"); }
virtual bool read(const String &configFile)
MainConfigurationFile configFile
Definition: DepthCamera.h:156
bool Voxel::DepthCamera::removeAllFilters ( FrameType  frameType)
virtual

Definition at line 442 of file DepthCamera.cpp.

References _depthFilters, _processedFilters, _unprocessedFilters, FRAME_DEPTH_FRAME, FRAME_RAW_FRAME_PROCESSED, FRAME_RAW_FRAME_UNPROCESSED, id(), Voxel::LOG_ERROR, and Voxel::logger.

443 {
444  if(frameType == FRAME_RAW_FRAME_UNPROCESSED)
445  return _unprocessedFilters.removeAllFilters();
446  else if(frameType == FRAME_RAW_FRAME_PROCESSED)
447  return _processedFilters.removeAllFilters();
448  else if(frameType == FRAME_DEPTH_FRAME)
449  return _depthFilters.removeAllFilters();
450  else
451  {
452  logger(LOG_ERROR) << "DepthCamera: Filter not supported for frame type = '" << frameType << "' for camera = " << id() << std::endl;
453  return false;
454  }
455 }
const String & id() const
Definition: DepthCamera.h:168
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
Logger logger(LOG_WARNING)
Definition: Logger.h:180
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80

+ Here is the call graph for this function:

bool Voxel::DepthCamera::removeCameraProfile ( const int  id)

Definition at line 650 of file DepthCamera.cpp.

References configFile, and Voxel::MainConfigurationFile::removeCameraProfile().

651 {
652  return configFile.removeCameraProfile(id);
653 }
bool removeCameraProfile(const int id)
MainConfigurationFile configFile
Definition: DepthCamera.h:156

+ Here is the call graph for this function:

bool Voxel::DepthCamera::removeFilter ( int  filterID,
FrameType  frameType 
)
virtual

Definition at line 473 of file DepthCamera.cpp.

References _depthFilters, _processedFilters, _unprocessedFilters, FRAME_DEPTH_FRAME, FRAME_RAW_FRAME_PROCESSED, FRAME_RAW_FRAME_UNPROCESSED, id(), Voxel::LOG_ERROR, and Voxel::logger.

474 {
475  if(frameType == FRAME_RAW_FRAME_UNPROCESSED)
476  return _unprocessedFilters.removeFilter(filterID);
477  else if(frameType == FRAME_RAW_FRAME_PROCESSED)
478  return _processedFilters.removeFilter(filterID);
479  else if(frameType == FRAME_DEPTH_FRAME)
480  return _depthFilters.removeFilter(filterID);
481  else
482  {
483  logger(LOG_ERROR) << "DepthCamera: Filter not supported for frame type = '" << frameType << "' for camera = " << id() << std::endl;
484  return false;
485  }
486 }
const String & id() const
Definition: DepthCamera.h:168
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
Logger logger(LOG_WARNING)
Definition: Logger.h:180
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80

+ Here is the call graph for this function:

bool Voxel::DepthCamera::reset ( )

Definition at line 409 of file DepthCamera.cpp.

References _reset(), id(), isRunning(), Voxel::LOG_ERROR, Voxel::logger, and resetFilters().

410 {
411  if(isRunning())
412  {
413  logger(LOG_ERROR) << "DepthCamera: Please stop the depth camera before calling reset" << std::endl;
414  return false;
415  }
416 
417  if(!_reset())
418  {
419  logger(LOG_ERROR) << "DepthCamera: Failed to reset device " << id() << std::endl;
420  return false;
421  }
422 
423  resetFilters();
424  return true;
425 }
const String & id() const
Definition: DepthCamera.h:168
bool isRunning() const
Definition: DepthCamera.h:177
virtual bool _reset()=0
virtual void resetFilters()
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the call graph for this function:

void Voxel::DepthCamera::resetFilters ( )
virtual

Definition at line 504 of file DepthCamera.cpp.

References _depthFilters, _processedFilters, and _unprocessedFilters.

Referenced by reset(), and start().

505 {
506  _unprocessedFilters.reset();
507  _processedFilters.reset();
508  _depthFilters.reset();
509 }
FilterSet< RawFrame > _unprocessedFilters
Definition: DepthCamera.h:80
FilterSet< DepthFrame > _depthFilters
Definition: DepthCamera.h:82
FilterSet< RawFrame > _processedFilters
Definition: DepthCamera.h:80

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::resume ( )

Definition at line 388 of file DepthCamera.cpp.

References _frameStreamWriter, _frameStreamWriterMutex, and _isPaused.

389 {
390  if(_isPaused)
391  {
392  _isPaused = false;
393 
394  Lock<Mutex> _(_frameStreamWriterMutex);
396  _frameStreamWriter->resume();
397  return true;
398  }
399 
400  return false;
401 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84
bool Voxel::DepthCamera::saveCameraProfileToHardware ( int id)
inline

Definition at line 257 of file DepthCamera.h.

MainConfigurationFile configFile
Definition: DepthCamera.h:156
bool saveCameraProfileToHardware(int &id)
bool Voxel::DepthCamera::saveFrameStream ( const String fileName)
virtual

Definition at line 523 of file DepthCamera.cpp.

References _frameGenerators, _frameStreamWriter, _frameStreamWriterMutex, Voxel::LOG_ERROR, and Voxel::logger.

524 {
525  Lock<Mutex> _(_frameStreamWriterMutex);
527  {
528  logger(LOG_ERROR) << "DepthCamera: Frame stream is already being saved." << std::endl;
529  return false;
530  }
531 
533  {
534  logger(LOG_ERROR) << "DepthCamera: Necessary generators are not yet created? Can't save stream." << std::endl;
535  return false;
536  }
537 
539  new FrameStreamWriter(fileName, _frameGenerators[0]->id(), _frameGenerators[1]->id(), _frameGenerators[2]->id())
540  );
541 
542  _frameGenerators[0]->setFrameStreamWriter(w);
543  _frameGenerators[1]->setFrameStreamWriter(w);
544  _frameGenerators[2]->setFrameStreamWriter(w);
545 
546  _frameGenerators[0]->writeConfiguration();
547  _frameGenerators[1]->writeConfiguration();
548  _frameGenerators[2]->writeConfiguration();
549 
550  _frameStreamWriter = w;
551 
552  return _frameStreamWriter->isStreamGood();
553 }
Mutex _frameStreamWriterMutex
Definition: DepthCamera.h:57
FrameStreamWriterPtr _frameStreamWriter
Definition: DepthCamera.h:84
Ptr< FrameStreamWriter > FrameStreamWriterPtr
Definition: FrameStream.h:88
FrameGeneratorPtr _frameGenerators[3]
Definition: DepthCamera.h:70
Logger logger(LOG_WARNING)
Definition: Logger.h:180
template<typename T >
bool Voxel::DepthCamera::set ( const String name,
const T &  value 
)

Definition at line 271 of file DepthCamera.h.

References _accessMutex, and _set().

Referenced by Voxel::TI::ToFHaddockCamera::_applyCalibrationParams(), Voxel::TI::ToFTintinCamera::_applyCalibrationParams(), _applyConfigParams(), Voxel::TI::VoxelDCamera::_init(), Voxel::TI::TintinCDKCamera::_init(), Voxel::TI::ToFTintinCamera::_init(), Voxel::TI::ToFHaddockCamera::_initStartParams(), Voxel::TI::HaddockCDKCamera::_initStartParams(), Voxel::TI::VoxelDCamera::_initStartParams(), Voxel::TI::ToFCalculusCamera::_initStartParams(), Voxel::TI::ToFTintinCamera::_initStartParams(), and Voxel::TI::ToFCamera::_reset().

272 {
273  Lock<Mutex> _(_accessMutex);
274  return _set(name, value);
275 }
bool _set(const String &name, const T &value)
Definition: DepthCamera.h:394

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::setBytesPerPixel ( const uint &  bpp)
inline

Definition at line 338 of file DepthCamera.h.

References _accessMutex, and _setBytesPerPixel().

339 {
340  Lock<Mutex> _(_accessMutex);
341  return _setBytesPerPixel(bpp);
342 }
virtual bool _setBytesPerPixel(const uint &bpp)=0

+ Here is the call graph for this function:

bool Voxel::DepthCamera::setCameraProfile ( const int  id,
bool  softApply = false 
)

Definition at line 582 of file DepthCamera.cpp.

References _applyConfigParams(), _onReset(), _saveCurrentProfileID(), configFile, Voxel::MainConfigurationFile::getCameraProfile(), Voxel::MainConfigurationFile::getCameraProfileName(), Voxel::ConfigurationFile::getConfigSet(), Voxel::LOG_ERROR, Voxel::LOG_WARNING, Voxel::logger, refreshParams(), and Voxel::MainConfigurationFile::setCurrentCameraProfile().

Referenced by _init().

583 {
585  {
586  logger(LOG_ERROR) << "DepthCamera: Could not set the camera profile to '" << id << "'" << std::endl;
587  return false;
588  }
589 
590  if(!_saveCurrentProfileID(id))
591  logger(LOG_WARNING) << "DepthCamera: Could not save the camera profile ID '" << id << "'" << std::endl;
592 
593  /*
594  // Uncomment this perform soft-reset every time a profile is selected.
595  if(!reset())
596  {
597  logger(LOG_ERROR) << "DepthCamera: Failed to reset camera, to set new camera profile" << std::endl;
598  return false;
599  }
600  */
601 
602  if(!refreshParams())
603  return false;
604 
605  if(!softApply)
606  {
607  ConfigurationFile *config;
608 
609  String cameraProfileName;
610 
611  if(!configFile.getCameraProfileName(id, cameraProfileName))
612  {
613  logger(LOG_ERROR) << "DepthCamera: Failed to get new camera profile name" << std::endl;
614  return false;
615  }
616 
617  if(!(config = configFile.getCameraProfile(id)))
618  {
619  logger(LOG_ERROR) << "DepthCamera: Failed to get new camera profile information" << std::endl;
620  return false;
621  }
622 
623  const ConfigSet *params;
624 
625  if(config->getConfigSet("params", params) && !_applyConfigParams(params))
626  {
627  logger(LOG_ERROR) << "DepthCamera: Could not set parameters to initialize profile '" << cameraProfileName << "'" << std::endl;
628  return false;
629  }
630 
631  if(config->getConfigSet("defining_params", params) && !_applyConfigParams(params))
632  {
633  logger(LOG_ERROR) << "DepthCamera: Could not set parameters to initialize profile '" << cameraProfileName << "'" << std::endl;
634  return false;
635  }
636  }
637 
638  if(!_onReset())
639  return false;
640 
641  return true;
642 }
ConfigurationFile * getCameraProfile(const int id)
virtual bool _applyConfigParams(const ConfigSet *params)
virtual bool _saveCurrentProfileID(const int id)=0
MainConfigurationFile configFile
Definition: DepthCamera.h:156
Logger logger(LOG_WARNING)
Definition: Logger.h:180
virtual bool _onReset()=0
bool setCurrentCameraProfile(const int id)
bool getCameraProfileName(const int id, String &cameraProfileName)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::setFrameRate ( const FrameRate r)
inline

Definition at line 289 of file DepthCamera.h.

References _accessMutex, and _setFrameRate().

Referenced by _applyConfigParams(), and Voxel::TI::ToFCameraBase::_onReset().

290 {
291  Lock<Mutex> _(_accessMutex);
292  return _setFrameRate(r);
293 }
virtual bool _setFrameRate(const FrameRate &r)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::setFrameSize ( const FrameSize s)
inline

Definition at line 301 of file DepthCamera.h.

References _accessMutex, and _setFrameSize().

Referenced by Voxel::TI::ToFCameraBase::_onReset().

302 {
303  Lock<Mutex> _(_accessMutex);
304  return _setFrameSize(s);
305 }
virtual bool _setFrameSize(const FrameSize &s)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::setROI ( const RegionOfInterest roi)
inline

Definition at line 357 of file DepthCamera.h.

References _accessMutex, and _setROI().

358 {
359  Lock<Mutex> _(_accessMutex);
360  return _setROI(roi);
361 }
virtual bool _setROI(const RegionOfInterest &roi)=0

+ Here is the call graph for this function:

bool Voxel::DepthCamera::setSerialNumber ( const String serialNumber)
virtual

Reimplemented in Voxel::TI::ToFCamera.

Definition at line 745 of file DepthCamera.cpp.

Referenced by Voxel::TI::ToFCamera::setSerialNumber().

746 {
747  return false;
748 }

+ Here is the caller graph for this function:

bool Voxel::DepthCamera::start ( )

Definition at line 301 of file DepthCamera.cpp.

References _callBackTypesRegistered, _captureThread, _captureThreadWrapper(), _id, _isPaused, _running, _start(), isRunning(), Voxel::LOG_ERROR, Voxel::logger, resetFilters(), and wait().

302 {
303  if (isRunning())
304  {
305  logger(LOG_ERROR) << "DepthCamera: Camera is already running. Please stop it before calling start() again." << std::endl;
306  return false;
307  }
308 
309  wait();
310 
311  if (_captureThread && _captureThread->joinable())
312  {
313  logger(LOG_ERROR) << "DepthCamera: Camera is still running. Please wait for the current capture loop to complete before calling start() again." << std::endl;
314  return false;
315  }
316 
318  {
319  logger(LOG_ERROR) << "DepthCamera: Please register a callback to " << _id << " before starting capture" << std::endl;
320  return false;
321  }
322 
323  resetFilters();
324 
325  if(!_start())
326  return false;
327 
328  _running = true;
329  _isPaused = false;
330  //_captureThreadWrapper();
332 
333  return true;
334 }
uint32_t _callBackTypesRegistered
Definition: DepthCamera.h:90
bool isRunning() const
Definition: DepthCamera.h:177
void _captureThreadWrapper()
virtual void resetFilters()
virtual bool _start()=0
std::thread Thread
Definition: Common.h:95
Logger logger(LOG_WARNING)
Definition: Logger.h:180
Ptr< Thread > ThreadPtr
Definition: Common.h:96
ThreadPtr _captureThread
Definition: DepthCamera.h:92

+ Here is the call graph for this function:

bool Voxel::DepthCamera::stop ( )

Definition at line 336 of file DepthCamera.cpp.

References _isPaused, _running, isRunning(), Voxel::LOG_WARNING, Voxel::logger, and wait().

Referenced by close(), and main().

337 {
338  if (!isRunning())
339  {
340  logger(LOG_WARNING) << "DepthCamera: Camera is not running." << std::endl;
341  return true;
342  }
343 
344  _running = false;
345  _isPaused = false;
346  wait();
347  return true;
348 }
bool isRunning() const
Definition: DepthCamera.h:177
Logger logger(LOG_WARNING)
Definition: Logger.h:180

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Voxel::DepthCamera::wait ( )

Definition at line 350 of file DepthCamera.cpp.

References _captureThread.

Referenced by start(), and stop().

351 {
352  if(_captureThread && _captureThread->get_id() != std::this_thread::get_id() && _captureThread->joinable())
353  _captureThread->join();
354 }
ThreadPtr _captureThread
Definition: DepthCamera.h:92

+ Here is the caller graph for this function:

Member Data Documentation

Mutex Voxel::DepthCamera::_accessMutex
mutableprivate
CallbackType Voxel::DepthCamera::_callback[FRAME_TYPE_COUNT]
protected
uint32_t Voxel::DepthCamera::_callBackTypesRegistered = 0
protected

Definition at line 90 of file DepthCamera.h.

Referenced by _captureLoop(), registerCallback(), and start().

ThreadPtr Voxel::DepthCamera::_captureThread
protected

Definition at line 92 of file DepthCamera.h.

Referenced by start(), and wait().

String Voxel::DepthCamera::_chipset
protected

Definition at line 62 of file DepthCamera.h.

FilterSet<DepthFrame> Voxel::DepthCamera::_depthFilters
protected
FrameBufferManager<DepthFrame> Voxel::DepthCamera::_depthFrameBuffers
protected

Definition at line 77 of file DepthCamera.h.

Referenced by _captureLoop(), and close().

DevicePtr Voxel::DepthCamera::_device
protected
FrameGeneratorPtr Voxel::DepthCamera::_frameGenerators[3]
protected
FrameStreamWriterPtr Voxel::DepthCamera::_frameStreamWriter
protected
Mutex Voxel::DepthCamera::_frameStreamWriterMutex
mutableprivate
String Voxel::DepthCamera::_id
protected

Definition at line 62 of file DepthCamera.h.

Referenced by _get(), _set(), getParam(), and start().

bool Voxel::DepthCamera::_isPaused
protected

Definition at line 109 of file DepthCamera.h.

Referenced by _callbackAndContinue(), _captureLoop(), pause(), resume(), start(), and stop().

String Voxel::DepthCamera::_name
protected

Definition at line 62 of file DepthCamera.h.

bool Voxel::DepthCamera::_parameterInit
protected
Map<String, ParameterPtr> Voxel::DepthCamera::_parameters
protected
FrameBufferManager<PointCloudFrame> Voxel::DepthCamera::_pointCloudBuffers
protected

Definition at line 78 of file DepthCamera.h.

Referenced by _captureLoop(), and close().

Ptr<PointCloudFrameGenerator> Voxel::DepthCamera::_pointCloudFrameGenerator
protected
FilterSet<RawFrame> Voxel::DepthCamera::_processedFilters
protected
Ptr<RegisterProgrammer> Voxel::DepthCamera::_programmer
protected
FrameBufferManager<RawFrame> Voxel::DepthCamera::_rawFrameBuffers
protected

Definition at line 76 of file DepthCamera.h.

Referenced by _captureLoop(), and close().

bool Voxel::DepthCamera::_running
protected

Definition at line 109 of file DepthCamera.h.

Referenced by _captureLoop(), start(), and stop().

Ptr<Streamer> Voxel::DepthCamera::_streamer
protected
FilterSet<RawFrame> Voxel::DepthCamera::_unprocessedFilters
protected
MainConfigurationFile Voxel::DepthCamera::configFile

The documentation for this class was generated from the following files: