CameraMobile.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #include "CameraMobile.h"
30 #include "util.h"
34 #include "rtabmap/core/util2d.h"
35 #include <glm/gtx/transform.hpp>
36 
37 namespace rtabmap {
38 
39 #define nullptr 0
40 
42 // CameraMobile
45 const float CameraMobile::bilateralFilteringSigmaR = 0.075f;
46 
48  0.0f, 0.0f, 1.0f, 0.0f,
49  -1.0f, 0.0f, 0.0f, 0.0f,
50  0.0f, -1.0f, 0.0f, 0.0f);
52  0.0f, -1.0f, 0.0f, 0.0f,
53  0.0f, 0.0f, -1.0f, 0.0f,
54  1.0f, 0.0f, 0.0f, 0.0f);
55 
56 CameraMobile::CameraMobile(bool smoothing, float upstreamRelocalizationAccThr) :
57  Camera(10),
58  deviceTColorCamera_(Transform::getIdentity()),
59  textureId_(0),
60  uvs_initialized_(false),
61  stampEpochOffset_(0.0),
62  smoothing_(smoothing),
63  colorCameraToDisplayRotation_(ROTATION_0),
64  originUpdate_(true),
65  upstreamRelocalizationAccThr_(upstreamRelocalizationAccThr),
66  previousAnchorStamp_(0.0),
67  dataGoodTracking_(true)
68 {
69 }
70 
72  // Disconnect camera service
73  close();
74 }
75 
76 bool CameraMobile::init(const std::string &, const std::string &)
77 {
79  // clear semaphore
80  if(dataReady_.value() > 0) {
82  }
83  return true;
84 }
85 
87 {
88  UScopeMutex lock(dataMutex_);
89 
90  firstFrame_ = true;
91  lastKnownGPS_ = GPS();
92  lastEnvSensors_.clear();
94  originUpdate_ = true;
95  dataPose_ = Transform();
96  data_ = SensorData();
97  dataGoodTracking_ = true;
100  previousAnchorStamp_ = 0.0;
101 
102  if(textureId_ != 0)
103  {
104  glDeleteTextures(1, &textureId_);
105  textureId_ = 0;
106  }
107  // in case someone is waiting on captureImage()
109 }
110 
112 {
114  originUpdate_ = true;
115 }
116 
117 bool CameraMobile::getPose(double epochStamp, Transform & pose, cv::Mat & covariance, double maxWaitTime)
118 {
119  pose.setNull();
120 
121  int maxWaitTimeMs = maxWaitTime * 1000;
122 
123  // Interpolate pose
124  if(!poseBuffer_.empty())
125  {
126  poseMutex_.lock();
127  int waitTry = 0;
128  while(maxWaitTimeMs>0 && poseBuffer_.rbegin()->first < epochStamp && waitTry < maxWaitTimeMs)
129  {
130  poseMutex_.unlock();
131  ++waitTry;
132  uSleep(1);
133  poseMutex_.lock();
134  }
135  if(poseBuffer_.rbegin()->first < epochStamp)
136  {
137  if(maxWaitTimeMs > 0)
138  {
139  UWARN("Could not find poses to interpolate at time %f after waiting %d ms (latest is %f)...", epochStamp, maxWaitTimeMs, poseBuffer_.rbegin()->first);
140  }
141  else
142  {
143  UWARN("Could not find poses to interpolate at time %f (latest is %f)...", epochStamp, poseBuffer_.rbegin()->first);
144  }
145  }
146  else
147  {
148  std::map<double, Transform>::const_iterator iterB = poseBuffer_.lower_bound(epochStamp);
149  std::map<double, Transform>::const_iterator iterA = iterB;
150  if(iterA != poseBuffer_.begin())
151  {
152  iterA = --iterA;
153  }
154  if(iterB == poseBuffer_.end())
155  {
156  iterB = --iterB;
157  }
158  if(iterA == iterB && epochStamp == iterA->first)
159  {
160  pose = iterA->second;
161  }
162  else if(epochStamp >= iterA->first && epochStamp <= iterB->first)
163  {
164  pose = iterA->second.interpolate((epochStamp-iterA->first) / (iterB->first-iterA->first), iterB->second);
165  }
166  else // stamp < iterA->first
167  {
168  UWARN("Could not find pose data to interpolate at time %f (earliest is %f). Are sensors synchronized?", epochStamp, iterA->first);
169  }
170  }
171  poseMutex_.unlock();
172  }
173  return !pose.isNull();
174 }
175 
176 void CameraMobile::poseReceived(const Transform & pose, double deviceStamp)
177 {
178  // Pose reveived is the pose of the device in rtabmap coordinate
179  if(!pose.isNull())
180  {
181  Transform p = pose;
182 
183  if(stampEpochOffset_ == 0.0)
184  {
185  stampEpochOffset_ = UTimer::now() - deviceStamp;
186  }
187 
188  if(originUpdate_)
189  {
190  firstFrame_ = true;
191  lastKnownGPS_ = GPS();
192  lastEnvSensors_.clear();
193  dataGoodTracking_ = true;
196  previousAnchorStamp_ = 0.0;
198  originUpdate_ = false;
199  }
200 
201  double epochStamp = stampEpochOffset_ + deviceStamp;
202  if(!originOffset_.isNull())
203  {
204  // Filter re-localizations from poses received
205  rtabmap::Transform rawPose = originOffset_ * pose.translation(); // remove rotation to keep position in fixed frame
206  // Remove upstream localization corrections by integrating pose from previous frame anchor
207  bool showLog = false;
209  {
210  float dt = epochStamp - previousAnchorStamp_;
211  std::vector<float> currentLinearVelocity(3);
212  float dx = rawPose.x()-previousAnchorPose_.x();
213  float dy = rawPose.y()-previousAnchorPose_.y();
214  float dz = rawPose.z()-previousAnchorPose_.z();
215  currentLinearVelocity[0] = dx / dt;
216  currentLinearVelocity[1] = dy / dt;
217  currentLinearVelocity[2] = dz / dt;
218  if(!previousAnchorLinearVelocity_.empty() && uNorm(dx, dy, dz)>0.02)
219  {
220  float ax = (currentLinearVelocity[0] - previousAnchorLinearVelocity_[0]) / dt;
221  float ay = (currentLinearVelocity[1] - previousAnchorLinearVelocity_[1]) / dt;
222  float az = (currentLinearVelocity[2] - previousAnchorLinearVelocity_[2]) / dt;
223  float acceleration = sqrt(ax*ax + ay*ay + az*az);
224  if(acceleration>=upstreamRelocalizationAccThr_)
225  {
226  // Only correct the translation to not lose rotation aligned
227  // with gravity.
228 
229  // Use constant motion model to update current pose.
233  0, 0, 0, 1);
235  currentLinearVelocity = previousAnchorLinearVelocity_;
236  originOffset_.x() += newRawPose.x() - rawPose.x();
237  originOffset_.y() += newRawPose.y() - rawPose.y();
238  originOffset_.z() += newRawPose.z() - rawPose.z();
239  UERROR("Upstream re-localization has been suppressed because of "
240  "high acceleration detected (%f m/s^2) causing a jump!",
241  acceleration);
242  dataGoodTracking_ = false;
243  post(new CameraInfoEvent(0, "UpstreamRelocationFiltered", uFormat("%.1f m/s^2", acceleration).c_str()));
244  showLog = true;
245  }
246  }
247  previousAnchorLinearVelocity_ = currentLinearVelocity;
248  }
249 
250  p = originOffset_*pose;
252  previousAnchorStamp_ = epochStamp;
253 
255  relocalizationDebugBuffer_.insert(std::make_pair(epochStamp, std::make_pair(pose, p)));
256  if(relocalizationDebugBuffer_.size() > 60)
257  {
259  }
260  if(showLog) {
261  std::stringstream stream;
263  {
264  stream << iter->first - relocalizationDebugBuffer_.begin()->first
265  << " " << iter->second.first.x()
266  << " " << iter->second.first.y()
267  << " " << iter->second.first.z()
268  << " " << iter->second.second.x()
269  << " " << iter->second.second.y()
270  << " " << iter->second.second.z() << std::endl;
271  }
272  UERROR("timestamp original_xyz corrected_xyz:\n%s", stream.str().c_str());
273  }
274  }
275  }
276 
277  {
278  UScopeMutex lock(poseMutex_);
279  poseBuffer_.insert(poseBuffer_.end(), std::make_pair(epochStamp, p));
280  if(poseBuffer_.size() > 1000)
281  {
282  poseBuffer_.erase(poseBuffer_.begin());
283  }
284  }
285 
286  // send pose of the camera (with optical rotation)
287  this->post(new PoseEvent(p * deviceTColorCamera_));
288  }
289 }
290 
292 {
293  return model_.isValidForProjection();
294 }
295 
296 void CameraMobile::setGPS(const GPS & gps)
297 {
298  lastKnownGPS_ = gps;
299 }
300 
301 void CameraMobile::addEnvSensor(int type, float value)
302 {
304 }
305 
306 void CameraMobile::update(const SensorData & data, const Transform & pose, const glm::mat4 & viewMatrix, const glm::mat4 & projectionMatrix, const float * texCoord)
307 {
308  UScopeMutex lock(dataMutex_);
309 
310  LOGD("CameraMobile::update pose=%s stamp=%f", pose.prettyPrint().c_str(), data.stamp());
311 
312  bool notify = !data_.isValid();
313 
314  data_ = data;
315  dataPose_ = pose;
316 
317  viewMatrix_ = viewMatrix;
318  projectionMatrix_ = projectionMatrix;
319 
320  if(textureId_ == 0)
321  {
322  glGenTextures(1, &textureId_);
323  }
324 
325  if(texCoord)
326  {
327  memcpy(transformed_uvs_, texCoord, 8*sizeof(float));
328  uvs_initialized_ = true;
329  }
330 
331  LOGD("CameraMobile::update textureId_=%d", (int)textureId_);
332 
333  if(textureId_ != 0 && texCoord != 0)
334  {
335  cv::Mat rgbImage;
336  cv::cvtColor(data.imageRaw(), rgbImage, cv::COLOR_BGR2RGBA);
337 
338  glBindTexture(GL_TEXTURE_2D, textureId_);
339  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
340  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
341  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
342  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
343 
344  glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
345  //glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
346  //glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
347  //glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
348  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rgbImage.cols, rgbImage.rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbImage.data);
349 
350  GLint error = glGetError();
351  if(error != GL_NO_ERROR)
352  {
353  LOGE("OpenGL: Could not allocate texture (0x%x)\n", error);
354  textureId_ = 0;
355  return;
356  }
357  }
358 
359  if(data_.isValid())
360  {
361  postUpdate();
362 
363  if(notify)
364  {
366  }
367  }
368 }
369 
371 {
372  UScopeMutex lock(dataMutex_);
373  bool notify = !data_.isValid();
374 
376  if(data_.isValid())
377  {
378  postUpdate();
379 
380  if(notify)
381  {
383  }
384  }
385 }
386 
388 {
389  LOGE("To use CameraMobile::updateOnRender(), CameraMobile::updateDataOnRender() "
390  "should be overridden by inherited classes. Returning empty data!\n");
391  return SensorData();
392 }
393 
395 {
396  if(data_.isValid())
397  {
398  // adjust origin
399  if(!originOffset_.isNull())
400  {
404  }
405 
406  if(lastKnownGPS_.stamp() > 0.0 && data_.stamp()-lastKnownGPS_.stamp()<1.0)
407  {
409  }
410  else if(lastKnownGPS_.stamp()>0.0)
411  {
412  LOGD("GPS too old (current time=%f, gps time = %f)", data_.stamp(), lastKnownGPS_.stamp());
413  }
414 
415  if(lastEnvSensors_.size())
416  {
418  lastEnvSensors_.clear();
419  }
420 
421  if(smoothing_ && !data_.depthRaw().empty())
422  {
423  //UTimer t;
425  //LOGD("Bilateral filtering, time=%fs", t.ticks());
426  }
427 
428  // Rotate image depending on the camera orientation
430  {
431  UDEBUG("ROTATION_90");
432  cv::Mat rgb, depth;
433  cv::Mat rgbt(data_.imageRaw().cols, data_.imageRaw().rows, data_.imageRaw().type());
434  cv::flip(data_.imageRaw(),rgb,1);
435  cv::transpose(rgb,rgbt);
436  rgb = rgbt;
437  cv::Mat deptht(data_.depthRaw().cols, data_.depthRaw().rows, data_.depthRaw().type());
438  cv::flip(data_.depthRaw(),depth,1);
439  cv::transpose(depth,deptht);
440  depth = deptht;
442  cv::Size sizet(model.imageHeight(), model.imageWidth());
443  model = CameraModel(
444  model.fy(),
445  model.fx(),
446  model.cy(),
447  model.cx()>0?model.imageWidth()-model.cx():0,
448  model.localTransform()*rtabmap::Transform(0,-1,0,0, 1,0,0,0, 0,0,1,0));
449  model.setImageSize(sizet);
450  data_.setRGBDImage(rgb, depth, model);
451 
452  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
453  for(size_t i=0; i<keypoints.size(); ++i)
454  {
455  keypoints[i].pt.x = data_.keypoints()[i].pt.y;
456  keypoints[i].pt.y = rgb.rows - data_.keypoints()[i].pt.x;
457  }
458  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
459  }
461  {
462  UDEBUG("ROTATION_180");
463  cv::Mat rgb, depth;
464  cv::flip(data_.imageRaw(),rgb,1);
465  cv::flip(rgb,rgb,0);
466  cv::flip(data_.depthOrRightRaw(),depth,1);
467  cv::flip(depth,depth,0);
469  cv::Size sizet(model.imageWidth(), model.imageHeight());
470  model = CameraModel(
471  model.fx(),
472  model.fy(),
473  model.cx()>0?model.imageWidth()-model.cx():0,
474  model.cy()>0?model.imageHeight()-model.cy():0,
475  model.localTransform()*rtabmap::Transform(0,0,0,0,0,1,0));
476  model.setImageSize(sizet);
477  data_.setRGBDImage(rgb, depth, model);
478 
479  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
480  for(size_t i=0; i<keypoints.size(); ++i)
481  {
482  keypoints[i].pt.x = rgb.cols - data_.keypoints()[i].pt.x;
483  keypoints[i].pt.y = rgb.rows - data_.keypoints()[i].pt.y;
484  }
485  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
486  }
488  {
489  UDEBUG("ROTATION_270");
490  cv::Mat rgb(data_.imageRaw().cols, data_.imageRaw().rows, data_.imageRaw().type());
491  cv::transpose(data_.imageRaw(),rgb);
492  cv::flip(rgb,rgb,1);
493  cv::Mat depth(data_.depthOrRightRaw().cols, data_.depthOrRightRaw().rows, data_.depthOrRightRaw().type());
494  cv::transpose(data_.depthOrRightRaw(),depth);
495  cv::flip(depth,depth,1);
497  cv::Size sizet(model.imageHeight(), model.imageWidth());
498  model = CameraModel(
499  model.fy(),
500  model.fx(),
501  model.cy()>0?model.imageHeight()-model.cy():0,
502  model.cx(),
503  model.localTransform()*rtabmap::Transform(0,1,0,0, -1,0,0,0, 0,0,1,0));
504  model.setImageSize(sizet);
505  data_.setRGBDImage(rgb, depth, model);
506 
507  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
508  for(size_t i=0; i<keypoints.size(); ++i)
509  {
510  keypoints[i].pt.x = rgb.cols - data_.keypoints()[i].pt.y;
511  keypoints[i].pt.y = data_.keypoints()[i].pt.x;
512  }
513  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
514  }
515  }
516 }
517 
519 {
521  bool firstFrame = true;
522  bool dataGoodTracking = true;
523  rtabmap::Transform dataPose;
524  if(dataReady_.acquire(1, 15000))
525  {
526  UScopeMutex lock(dataMutex_);
527  data = data_;
528  dataPose = dataPose_;
529  firstFrame = firstFrame_;
530  dataGoodTracking = dataGoodTracking_;
531  firstFrame_ = false;
532  dataGoodTracking_ = true;
533  data_ = SensorData();
534  dataPose_.setNull();
535  }
536  if(data.isValid())
537  {
538  data.setGroundTruth(Transform());
539  data.setStamp(stampEpochOffset_ + data.stamp());
540 
541  if(info)
542  {
543  // linear cov = 0.0001
544  info->odomCovariance = cv::Mat::eye(6,6,CV_64FC1) * (firstFrame?9999.0:0.00001);
545  if(!firstFrame)
546  {
547  // angular cov = 0.000001
548  // roll/pitch should be fairly accurate with VIO input
549  info->odomCovariance.at<double>(3,3) *= 0.01; // roll
550  info->odomCovariance.at<double>(4,4) *= 0.01; // pitch
551  if(!dataGoodTracking)
552  {
553  UERROR("not good tracking!");
554  // add slightly more error on translation
555  // 0.001
556  info->odomCovariance.at<double>(0,0) *= 10; // x
557  info->odomCovariance.at<double>(1,1) *= 10; // y
558  info->odomCovariance.at<double>(2,2) *= 10; // z
559  info->odomCovariance.at<double>(5,5) *= 10; // yaw
560  }
561  }
562  info->odomPose = dataPose;
563  }
564  }
565  else
566  {
567  UWARN("CameraMobile::captureImage() invalid data!");
568  }
569  return data;
570 }
571 
573  const cv::Mat & pointCloudData,
574  const Transform & pose,
575  const CameraModel & model,
576  const cv::Mat & rgb,
577  std::vector<cv::KeyPoint> * kpts,
578  std::vector<cv::Point3f> * kpts3D,
579  int kptsSize)
580 {
581  if(!pointCloudData.empty())
582  {
583  cv::Mat scanData(1, pointCloudData.cols, CV_32FC4);
584  float * ptr = scanData.ptr<float>();
585  const float * inPtr = pointCloudData.ptr<float>();
586  int ic = pointCloudData.channels();
587  UASSERT(pointCloudData.depth() == CV_32F && ic >= 3);
588 
589  int oi = 0;
590  for(unsigned int i=0;i<pointCloudData.cols; ++i)
591  {
592  cv::Point3f pt(inPtr[i*ic], inPtr[i*ic + 1], inPtr[i*ic + 2]);
594  ptr[oi*4] = pt.x;
595  ptr[oi*4 + 1] = pt.y;
596  ptr[oi*4 + 2] = pt.z;
597 
598  //get color from rgb image
599  cv::Point3f org= pt;
601  if(pt.z > 0)
602  {
603  int u,v;
604  model.reproject(pt.x, pt.y, pt.z, u, v);
605  unsigned char r=255,g=255,b=255;
606  if(model.inFrame(u, v))
607  {
608  b=rgb.at<cv::Vec3b>(v,u).val[0];
609  g=rgb.at<cv::Vec3b>(v,u).val[1];
610  r=rgb.at<cv::Vec3b>(v,u).val[2];
611  if(kpts)
612  kpts->push_back(cv::KeyPoint(u,v,kptsSize));
613  if(kpts3D)
614  kpts3D->push_back(org);
615 
616  *(int*)&ptr[oi*4 + 3] = int(b) | (int(g) << 8) | (int(r) << 16);
617  ++oi;
618  }
619  }
620  //confidence
621  //*(int*)&ptr[i*4 + 3] = (int(pointCloudData[i*4 + 3] * 255.0f) << 8) | (int(255) << 16);
622 
623  }
624  return LaserScan::backwardCompatibility(scanData.colRange(0, oi), 0, 10, rtabmap::Transform::getIdentity());
625  }
626  return LaserScan();
627 }
628 
629 } /* namespace rtabmap */
rtabmap::SensorData
Definition: SensorData.h:51
rtabmap::CameraMobile::resetOrigin
void resetOrigin(const rtabmap::Transform &offset=rtabmap::Transform())
Definition: CameraMobile.cpp:111
int
int
UMutex::lock
int lock() const
Definition: UMutex.h:87
rtabmap::CameraMobile::postUpdate
void postUpdate()
Definition: CameraMobile.cpp:394
USemaphore::acquire
bool acquire(int n=1, int ms=0)
Definition: USemaphore.h:101
rtabmap::CameraMobile::close
virtual void close()
Definition: CameraMobile.cpp:86
uNorm
T uNorm(const std::vector< T > &v)
Definition: UMath.h:573
rtabmap::CameraMobile::poseMutex_
UMutex poseMutex_
Definition: CameraMobile.h:166
rtabmap::CameraMobile::captureImage
virtual SensorData captureImage(SensorCaptureInfo *info=0)
Definition: CameraMobile.cpp:518
rtabmap::CameraMobile::isCalibrated
virtual bool isCalibrated() const
Definition: CameraMobile.cpp:291
rtabmap::LaserScan::backwardCompatibility
static LaserScan backwardCompatibility(const cv::Mat &oldScanFormat, int maxPoints=0, int maxRange=0, const Transform &localTransform=Transform::getIdentity())
Definition: LaserScan.cpp:133
UTimer::now
static double now()
Definition: UTimer.cpp:80
rtabmap::CameraMobile::colorCameraToDisplayRotation_
ScreenRotation colorCameraToDisplayRotation_
Definition: CameraMobile.h:148
CameraMobile.h
rtabmap::CameraMobile::dataGoodTracking_
bool dataGoodTracking_
Definition: CameraMobile.h:164
rtabmap::CameraMobile::projectionMatrix_
glm::mat4 projectionMatrix_
Definition: CameraMobile.h:140
b
Array< int, 3, 1 > b
rtabmap::CameraMobile::setGPS
void setGPS(const GPS &gps)
Definition: CameraMobile.cpp:296
stream
stream
UMutex::unlock
int unlock() const
Definition: UMutex.h:113
rtabmap::CameraMobile::occlusionModel_
CameraModel occlusionModel_
Definition: CameraMobile.h:170
rtabmap::Transform::getIdentity
static Transform getIdentity()
Definition: Transform.cpp:411
rtabmap::CameraModel
Definition: CameraModel.h:38
dt
const double dt
rtabmap::CameraMobile::dataPose_
Transform dataPose_
Definition: CameraMobile.h:163
rtabmap::SensorData::isValid
bool isValid() const
Definition: SensorData.h:156
rtabmap::GPS
Definition: GPS.h:35
rtabmap::CameraMobile::previousAnchorPose_
rtabmap::Transform previousAnchorPose_
Definition: CameraMobile.h:155
type
rtabmap::CameraMobile::dataMutex_
UMutex dataMutex_
Definition: CameraMobile.h:161
rtabmap::CameraMobile::transformed_uvs_
float transformed_uvs_[8]
Definition: CameraMobile.h:141
rtabmap::CameraMobile::uvs_initialized_
bool uvs_initialized_
Definition: CameraMobile.h:142
rtabmap::PoseEvent
Definition: CameraMobile.h:60
rtabmap::CameraMobile::addEnvSensor
void addEnvSensor(int type, float value)
Definition: CameraMobile.cpp:301
rtabmap::SensorData::stamp
double stamp() const
Definition: SensorData.h:176
rtabmap::CameraMobile::viewMatrix_
glm::mat4 viewMatrix_
Definition: CameraMobile.h:139
true
#define true
Definition: ConvertUTF.c:57
rtabmap::Transform::setNull
void setNull()
Definition: Transform.cpp:152
rtabmap::LaserScan
Definition: LaserScan.h:37
rtabmap::ROTATION_270
@ ROTATION_270
270 degree rotation.
Definition: util.h:208
rtabmap::CameraMobile::deviceTColorCamera_
Transform deviceTColorCamera_
Definition: CameraMobile.h:136
glm::detail::tmat4x4
Definition: type_mat.hpp:47
rtabmap::Transform::isNull
bool isNull() const
Definition: Transform.cpp:107
rtabmap::SensorData::cameraModels
const std::vector< CameraModel > & cameraModels() const
Definition: SensorData.h:240
rtabmap::CameraMobile::relocalizationDebugBuffer_
std::map< double, std::pair< rtabmap::Transform, rtabmap::Transform > > relocalizationDebugBuffer_
Definition: CameraMobile.h:158
LOGE
#define LOGE(...)
Definition: tango-gl/include/tango-gl/util.h:61
rtabmap::SensorCaptureInfo
Definition: SensorCaptureInfo.h:36
rtabmap::CameraMobile::CameraMobile
CameraMobile(bool smoothing=false, float upstreamRelocalizationAccThr=0.0f)
Definition: CameraMobile.cpp:56
rtabmap::CameraModel::setLocalTransform
void setLocalTransform(const Transform &transform)
Definition: CameraModel.h:115
rtabmap::CameraMobile::smoothing_
bool smoothing_
Definition: CameraMobile.h:147
rtabmap::SensorData::setRGBDImage
void setRGBDImage(const cv::Mat &rgb, const cv::Mat &depth, const CameraModel &model, bool clearPreviousData=true)
Definition: SensorData.cpp:227
rtabmap::util3d::transformPoint
cv::Point3f RTABMAP_CORE_EXPORT transformPoint(const cv::Point3f &pt, const Transform &transform)
Definition: util3d_transforms.cpp:211
rtabmap::Transform::y
float & y()
Definition: Transform.h:93
rtabmap::CameraMobile::lastKnownGPS_
GPS lastKnownGPS_
Definition: CameraMobile.h:149
rtabmap::Transform::z
float & z()
Definition: Transform.h:94
rtabmap::CameraMobile::upstreamRelocalizationAccThr_
float upstreamRelocalizationAccThr_
Definition: CameraMobile.h:154
rtabmap::rtabmap_world_T_opengl_world
static const rtabmap::Transform rtabmap_world_T_opengl_world(0.0f, 0.0f,-1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)
rtabmap::Transform::prettyPrint
std::string prettyPrint() const
Definition: Transform.cpp:326
data
int data[]
UScopeMutex
Definition: UMutex.h:157
util3d_transforms.h
g
float g
rtabmap::util2d::fastBilateralFiltering
cv::Mat RTABMAP_CORE_EXPORT fastBilateralFiltering(const cv::Mat &depth, float sigmaS=15.0f, float sigmaR=0.05f, bool earlyDivision=false)
Definition: util2d.cpp:1814
rtabmap::CameraMobile::textureId_
GLuint textureId_
Definition: CameraMobile.h:138
glm::sqrt
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
rtabmap::opengl_world_T_rtabmap_world
static const rtabmap::Transform opengl_world_T_rtabmap_world(0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f)
rtabmap::CameraMobile::lastEnvSensors_
EnvSensors lastEnvSensors_
Definition: CameraMobile.h:150
rtabmap::Transform::x
float & x()
Definition: Transform.h:92
first
constexpr int first(int i)
rtabmap::CameraMobile::update
void update(const SensorData &data, const Transform &pose, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix, const float *texCoord)
Definition: CameraMobile.cpp:306
rtabmap::Transform::interpolate
Transform interpolate(float t, const Transform &other) const
Definition: Transform.cpp:303
rtabmap::CameraModel::isValidForProjection
bool isValidForProjection() const
Definition: CameraModel.h:87
rtabmap::EnvSensor::Type
Type
Definition: EnvSensor.h:36
info
else if n * info
rtabmap::ROTATION_90
@ ROTATION_90
90 degree rotation.
Definition: util.h:202
rtabmap::CameraMobile::getPose
virtual bool getPose(double epochStamp, Transform &pose, cv::Mat &covariance, double maxWaitTime=0.06)
Definition: CameraMobile.cpp:117
UASSERT
#define UASSERT(condition)
error
void error(const char *str)
p
Point3_ p(2)
rtabmap::ROTATION_180
@ ROTATION_180
180 degree rotation.
Definition: util.h:205
rtabmap::GPS::stamp
const double & stamp() const
Definition: GPS.h:59
rtabmap::CameraMobile::init
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Definition: CameraMobile.cpp:76
rtabmap::CameraMobile::opticalRotation
static const rtabmap::Transform opticalRotation
Definition: CameraMobile.h:76
OdometryEvent.h
USemaphore::value
int value()
Definition: USemaphore.h:187
rtabmap::Camera
Definition: Camera.h:43
rtabmap::CameraMobile::updateOnRender
void updateOnRender()
Definition: CameraMobile.cpp:370
rtabmap::Transform::inverse
Transform inverse() const
Definition: Transform.cpp:178
rtabmap::SensorData::setFeatures
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
Definition: SensorData.cpp:802
offset
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
UWARN
#define UWARN(...)
f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
rtabmap::CameraMobile::scanFromPointCloudData
static LaserScan scanFromPointCloudData(const cv::Mat &pointCloudData, const Transform &pose, const CameraModel &model, const cv::Mat &rgb, std::vector< cv::KeyPoint > *kpts=0, std::vector< cv::Point3f > *kpts3D=0, int kptsSize=3)
Definition: CameraMobile.cpp:572
rtabmap::CameraMobile::poseReceived
void poseReceived(const Transform &pose, double deviceStamp)
Definition: CameraMobile.cpp:176
rtabmap::CameraMobile::dataReady_
USemaphore dataReady_
Definition: CameraMobile.h:160
uFormat
std::string UTILITE_EXPORT uFormat(const char *fmt,...)
Definition: UConversion.cpp:365
rtabmap::SensorData::imageRaw
const cv::Mat & imageRaw() const
Definition: SensorData.h:183
ULogger.h
ULogger class and convenient macros.
transform.hpp
rtabmap::Transform
Definition: Transform.h:41
USemaphore::release
void release(int n=1)
Definition: USemaphore.h:168
util2d.h
rtabmap::CameraMobile::updateDataOnRender
virtual SensorData updateDataOnRender(Transform &pose)
Definition: CameraMobile.cpp:387
rtabmap::SensorData::depthRaw
cv::Mat depthRaw() const
Definition: SensorData.h:210
iter
iterator iter(handle obj)
LOGD
#define LOGD(...)
Definition: tango-gl/include/tango-gl/util.h:52
rtabmap::CameraMobile::manualOriginOffset_
rtabmap::Transform manualOriginOffset_
Definition: CameraMobile.h:153
rtabmap::CameraMobile::bilateralFilteringSigmaS
static const float bilateralFilteringSigmaS
Definition: CameraMobile.h:73
c_str
const char * c_str(Args &&...args)
rtabmap::CameraInfoEvent
Definition: CameraMobile.h:44
v
Array< int, Dynamic, 1 > v
UDEBUG
#define UDEBUG(...)
rtabmap::CameraMobile::data_
SensorData data_
Definition: CameraMobile.h:162
rtabmap::CameraMobile::bilateralFilteringSigmaR
static const float bilateralFilteringSigmaR
Definition: CameraMobile.h:74
uSleep
void uSleep(unsigned int ms)
Definition: Posix/UThreadC.h:23
rtabmap::CameraMobile::opticalRotationInv
static const rtabmap::Transform opticalRotationInv
Definition: CameraMobile.h:77
rtabmap::CameraMobile::originUpdate_
bool originUpdate_
Definition: CameraMobile.h:152
rtabmap::SensorData::keypoints
const std::vector< cv::KeyPoint > & keypoints() const
Definition: SensorData.h:274
false
#define false
Definition: ConvertUTF.c:56
rtabmap::ROTATION_0
@ ROTATION_0
0 degree rotation (natural orientation)
Definition: util.h:199
rtabmap::SensorData::depthOrRightRaw
const cv::Mat & depthOrRightRaw() const
Definition: SensorData.h:184
rtabmap::CameraMobile::model_
CameraModel model_
Definition: CameraMobile.h:135
rtabmap::glmFromTransform
glm::mat4 glmFromTransform(const rtabmap::Transform &transform)
Definition: util.h:124
rtabmap::SensorData::setGPS
void setGPS(const GPS &gps)
Definition: SensorData.h:290
rtabmap::Transform::translation
Transform translation() const
Definition: Transform.cpp:203
rtabmap::CameraMobile::~CameraMobile
virtual ~CameraMobile()
Definition: CameraMobile.cpp:71
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::CameraModel::localTransform
const Transform & localTransform() const
Definition: CameraModel.h:116
UERROR
#define UERROR(...)
rtabmap::SensorData::keypoints3D
const std::vector< cv::Point3f > & keypoints3D() const
Definition: SensorData.h:275
rtabmap::EnvSensor
Definition: EnvSensor.h:33
util.h
trace.model
model
Definition: trace.py:4
glm::inverse
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
value
value
i
int i
rtabmap::CameraMobile::firstFrame_
bool firstFrame_
Definition: CameraMobile.h:145
rtabmap::SensorData::setEnvSensors
void setEnvSensors(const EnvSensors &sensors)
Definition: SensorData.h:296
rtabmap::SensorData::setDepthOrRightRaw
RTABMAP_DEPRECATED void setDepthOrRightRaw(const cv::Mat &image)
Definition: SensorData.cpp:407
rtabmap::CameraMobile::previousAnchorLinearVelocity_
std::vector< float > previousAnchorLinearVelocity_
Definition: CameraMobile.h:156
rtabmap::CameraMobile::originOffset_
Transform originOffset_
Definition: CameraMobile.h:151
rtabmap::CameraMobile::previousAnchorStamp_
double previousAnchorStamp_
Definition: CameraMobile.h:157
rtabmap::CameraMobile::poseBuffer_
std::map< double, Transform > poseBuffer_
Definition: CameraMobile.h:167
rtabmap::CameraMobile::stampEpochOffset_
double stampEpochOffset_
Definition: CameraMobile.h:146
UEventsSender::post
void post(UEvent *event, bool async=true) const
Definition: UEventsSender.cpp:28


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Apr 28 2025 02:45:51