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 {
113  originUpdate_ = true;
114 }
115 
116 bool CameraMobile::getPose(double epochStamp, Transform & pose, cv::Mat & covariance, double maxWaitTime)
117 {
118  pose.setNull();
119 
120  int maxWaitTimeMs = maxWaitTime * 1000;
121 
122  // Interpolate pose
123  if(!poseBuffer_.empty())
124  {
125  poseMutex_.lock();
126  int waitTry = 0;
127  while(maxWaitTimeMs>0 && poseBuffer_.rbegin()->first < epochStamp && waitTry < maxWaitTimeMs)
128  {
129  poseMutex_.unlock();
130  ++waitTry;
131  uSleep(1);
132  poseMutex_.lock();
133  }
134  if(poseBuffer_.rbegin()->first < epochStamp)
135  {
136  if(maxWaitTimeMs > 0)
137  {
138  UWARN("Could not find poses to interpolate at time %f after waiting %d ms (latest is %f)...", epochStamp, maxWaitTimeMs, poseBuffer_.rbegin()->first);
139  }
140  else
141  {
142  UWARN("Could not find poses to interpolate at time %f (latest is %f)...", epochStamp, poseBuffer_.rbegin()->first);
143  }
144  }
145  else
146  {
147  std::map<double, Transform>::const_iterator iterB = poseBuffer_.lower_bound(epochStamp);
148  std::map<double, Transform>::const_iterator iterA = iterB;
149  if(iterA != poseBuffer_.begin())
150  {
151  iterA = --iterA;
152  }
153  if(iterB == poseBuffer_.end())
154  {
155  iterB = --iterB;
156  }
157  if(iterA == iterB && epochStamp == iterA->first)
158  {
159  pose = iterA->second;
160  }
161  else if(epochStamp >= iterA->first && epochStamp <= iterB->first)
162  {
163  pose = iterA->second.interpolate((epochStamp-iterA->first) / (iterB->first-iterA->first), iterB->second);
164  }
165  else // stamp < iterA->first
166  {
167  UWARN("Could not find pose data to interpolate at time %f (earliest is %f). Are sensors synchronized?", epochStamp, iterA->first);
168  }
169  }
170  poseMutex_.unlock();
171  }
172  return !pose.isNull();
173 }
174 
175 void CameraMobile::poseReceived(const Transform & pose, double deviceStamp)
176 {
177  // Pose reveived is the pose of the device in rtabmap coordinate
178  if(!pose.isNull())
179  {
180  Transform p = pose;
181 
182  if(stampEpochOffset_ == 0.0)
183  {
184  stampEpochOffset_ = UTimer::now() - deviceStamp;
185  }
186 
187  if(originUpdate_)
188  {
189  firstFrame_ = true;
190  lastKnownGPS_ = GPS();
191  lastEnvSensors_.clear();
192  dataGoodTracking_ = true;
195  previousAnchorStamp_ = 0.0;
196  originOffset_ = pose.translation().inverse();
197  originUpdate_ = false;
198  }
199 
200  double epochStamp = stampEpochOffset_ + deviceStamp;
201  if(!originOffset_.isNull())
202  {
203  // Filter re-localizations from poses received
204  rtabmap::Transform rawPose = originOffset_ * pose.translation(); // remove rotation to keep position in fixed frame
205  // Remove upstream localization corrections by integrating pose from previous frame anchor
206  bool showLog = false;
208  {
209  float dt = epochStamp - previousAnchorStamp_;
210  std::vector<float> currentLinearVelocity(3);
211  float dx = rawPose.x()-previousAnchorPose_.x();
212  float dy = rawPose.y()-previousAnchorPose_.y();
213  float dz = rawPose.z()-previousAnchorPose_.z();
214  currentLinearVelocity[0] = dx / dt;
215  currentLinearVelocity[1] = dy / dt;
216  currentLinearVelocity[2] = dz / dt;
217  if(!previousAnchorLinearVelocity_.empty() && uNorm(dx, dy, dz)>0.02)
218  {
219  float ax = (currentLinearVelocity[0] - previousAnchorLinearVelocity_[0]) / dt;
220  float ay = (currentLinearVelocity[1] - previousAnchorLinearVelocity_[1]) / dt;
221  float az = (currentLinearVelocity[2] - previousAnchorLinearVelocity_[2]) / dt;
222  float acceleration = sqrt(ax*ax + ay*ay + az*az);
223  if(acceleration>=upstreamRelocalizationAccThr_)
224  {
225  // Only correct the translation to not lose rotation aligned
226  // with gravity.
227 
228  // Use constant motion model to update current pose.
232  0, 0, 0, 1);
234  currentLinearVelocity = previousAnchorLinearVelocity_;
235  originOffset_.x() += newRawPose.x() - rawPose.x();
236  originOffset_.y() += newRawPose.y() - rawPose.y();
237  originOffset_.z() += newRawPose.z() - rawPose.z();
238  UERROR("Upstream re-localization has been suppressed because of "
239  "high acceleration detected (%f m/s^2) causing a jump!",
240  acceleration);
241  dataGoodTracking_ = false;
242  post(new CameraInfoEvent(0, "UpstreamRelocationFiltered", uFormat("%.1f m/s^2", acceleration).c_str()));
243  showLog = true;
244  }
245  }
246  previousAnchorLinearVelocity_ = currentLinearVelocity;
247  }
248 
249  p = originOffset_*pose;
251  previousAnchorStamp_ = epochStamp;
252 
254  relocalizationDebugBuffer_.insert(std::make_pair(epochStamp, std::make_pair(pose, p)));
255  if(relocalizationDebugBuffer_.size() > 60)
256  {
258  }
259  if(showLog) {
260  std::stringstream stream;
262  {
263  stream << iter->first - relocalizationDebugBuffer_.begin()->first
264  << " " << iter->second.first.x()
265  << " " << iter->second.first.y()
266  << " " << iter->second.first.z()
267  << " " << iter->second.second.x()
268  << " " << iter->second.second.y()
269  << " " << iter->second.second.z() << std::endl;
270  }
271  UERROR("timestamp original_xyz corrected_xyz:\n%s", stream.str().c_str());
272  }
273  }
274  }
275 
276  {
277  UScopeMutex lock(poseMutex_);
278  poseBuffer_.insert(poseBuffer_.end(), std::make_pair(epochStamp, p));
279  if(poseBuffer_.size() > 1000)
280  {
281  poseBuffer_.erase(poseBuffer_.begin());
282  }
283  }
284 
285  // send pose of the camera (with optical rotation)
286  this->post(new PoseEvent(p * deviceTColorCamera_));
287  }
288 }
289 
291 {
292  return model_.isValidForProjection();
293 }
294 
295 void CameraMobile::setGPS(const GPS & gps)
296 {
297  lastKnownGPS_ = gps;
298 }
299 
300 void CameraMobile::addEnvSensor(int type, float value)
301 {
303 }
304 
305 void CameraMobile::update(const SensorData & data, const Transform & pose, const glm::mat4 & viewMatrix, const glm::mat4 & projectionMatrix, const float * texCoord)
306 {
307  UScopeMutex lock(dataMutex_);
308 
309  LOGD("CameraMobile::update pose=%s stamp=%f", pose.prettyPrint().c_str(), data.stamp());
310 
311  bool notify = !data_.isValid();
312 
313  data_ = data;
314  dataPose_ = pose;
315 
316  viewMatrix_ = viewMatrix;
317  projectionMatrix_ = projectionMatrix;
318 
319  if(textureId_ == 0)
320  {
321  glGenTextures(1, &textureId_);
322  }
323 
324  if(texCoord)
325  {
326  memcpy(transformed_uvs_, texCoord, 8*sizeof(float));
327  uvs_initialized_ = true;
328  }
329 
330  LOGD("CameraMobile::update textureId_=%d", (int)textureId_);
331 
332  if(textureId_ != 0 && texCoord != 0)
333  {
334  cv::Mat rgbImage;
335  cv::cvtColor(data.imageRaw(), rgbImage, cv::COLOR_BGR2RGBA);
336 
337  glBindTexture(GL_TEXTURE_2D, textureId_);
338  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
339  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
340  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
341  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
342 
343  glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
344  //glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
345  //glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
346  //glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
347  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rgbImage.cols, rgbImage.rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbImage.data);
348 
349  GLint error = glGetError();
350  if(error != GL_NO_ERROR)
351  {
352  LOGE("OpenGL: Could not allocate texture (0x%x)\n", error);
353  textureId_ = 0;
354  return;
355  }
356  }
357 
358  if(data_.isValid())
359  {
360  postUpdate();
361 
362  if(notify)
363  {
365  }
366  }
367 }
368 
370 {
371  UScopeMutex lock(dataMutex_);
372  bool notify = !data_.isValid();
373 
375  if(data_.isValid())
376  {
377  postUpdate();
378 
379  if(notify)
380  {
382  }
383  }
384 }
385 
387 {
388  LOGE("To use CameraMobile::updateOnRender(), CameraMobile::updateDataOnRender() "
389  "should be overridden by inherited classes. Returning empty data!\n");
390  return SensorData();
391 }
392 
394 {
395  if(data_.isValid())
396  {
397  // adjust origin
398  if(!originOffset_.isNull())
399  {
403  }
404 
405  if(lastKnownGPS_.stamp() > 0.0 && data_.stamp()-lastKnownGPS_.stamp()<1.0)
406  {
408  }
409  else if(lastKnownGPS_.stamp()>0.0)
410  {
411  LOGD("GPS too old (current time=%f, gps time = %f)", data_.stamp(), lastKnownGPS_.stamp());
412  }
413 
414  if(lastEnvSensors_.size())
415  {
417  lastEnvSensors_.clear();
418  }
419 
420  if(smoothing_ && !data_.depthRaw().empty())
421  {
422  //UTimer t;
424  //LOGD("Bilateral filtering, time=%fs", t.ticks());
425  }
426 
427  // Rotate image depending on the camera orientation
429  {
430  UDEBUG("ROTATION_90");
431  cv::Mat rgb, depth;
432  cv::Mat rgbt(data_.imageRaw().cols, data_.imageRaw().rows, data_.imageRaw().type());
433  cv::flip(data_.imageRaw(),rgb,1);
434  cv::transpose(rgb,rgbt);
435  rgb = rgbt;
436  cv::Mat deptht(data_.depthRaw().cols, data_.depthRaw().rows, data_.depthRaw().type());
437  cv::flip(data_.depthRaw(),depth,1);
438  cv::transpose(depth,deptht);
439  depth = deptht;
441  cv::Size sizet(model.imageHeight(), model.imageWidth());
442  model = CameraModel(
443  model.fy(),
444  model.fx(),
445  model.cy(),
446  model.cx()>0?model.imageWidth()-model.cx():0,
447  model.localTransform()*rtabmap::Transform(0,-1,0,0, 1,0,0,0, 0,0,1,0));
448  model.setImageSize(sizet);
449  data_.setRGBDImage(rgb, depth, model);
450 
451  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
452  for(size_t i=0; i<keypoints.size(); ++i)
453  {
454  keypoints[i].pt.x = data_.keypoints()[i].pt.y;
455  keypoints[i].pt.y = rgb.rows - data_.keypoints()[i].pt.x;
456  }
457  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
458  }
460  {
461  UDEBUG("ROTATION_180");
462  cv::Mat rgb, depth;
463  cv::flip(data_.imageRaw(),rgb,1);
464  cv::flip(rgb,rgb,0);
465  cv::flip(data_.depthOrRightRaw(),depth,1);
466  cv::flip(depth,depth,0);
468  cv::Size sizet(model.imageWidth(), model.imageHeight());
469  model = CameraModel(
470  model.fx(),
471  model.fy(),
472  model.cx()>0?model.imageWidth()-model.cx():0,
473  model.cy()>0?model.imageHeight()-model.cy():0,
474  model.localTransform()*rtabmap::Transform(0,0,0,0,0,1,0));
475  model.setImageSize(sizet);
476  data_.setRGBDImage(rgb, depth, model);
477 
478  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
479  for(size_t i=0; i<keypoints.size(); ++i)
480  {
481  keypoints[i].pt.x = rgb.cols - data_.keypoints()[i].pt.x;
482  keypoints[i].pt.y = rgb.rows - data_.keypoints()[i].pt.y;
483  }
484  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
485  }
487  {
488  UDEBUG("ROTATION_270");
489  cv::Mat rgb(data_.imageRaw().cols, data_.imageRaw().rows, data_.imageRaw().type());
490  cv::transpose(data_.imageRaw(),rgb);
491  cv::flip(rgb,rgb,1);
492  cv::Mat depth(data_.depthOrRightRaw().cols, data_.depthOrRightRaw().rows, data_.depthOrRightRaw().type());
493  cv::transpose(data_.depthOrRightRaw(),depth);
494  cv::flip(depth,depth,1);
496  cv::Size sizet(model.imageHeight(), model.imageWidth());
497  model = CameraModel(
498  model.fy(),
499  model.fx(),
500  model.cy()>0?model.imageHeight()-model.cy():0,
501  model.cx(),
502  model.localTransform()*rtabmap::Transform(0,1,0,0, -1,0,0,0, 0,0,1,0));
503  model.setImageSize(sizet);
504  data_.setRGBDImage(rgb, depth, model);
505 
506  std::vector<cv::KeyPoint> keypoints = data_.keypoints();
507  for(size_t i=0; i<keypoints.size(); ++i)
508  {
509  keypoints[i].pt.x = rgb.cols - data_.keypoints()[i].pt.y;
510  keypoints[i].pt.y = data_.keypoints()[i].pt.x;
511  }
512  data_.setFeatures(keypoints, data_.keypoints3D(), cv::Mat());
513  }
514  }
515 }
516 
518 {
520  bool firstFrame = true;
521  bool dataGoodTracking = true;
522  rtabmap::Transform dataPose;
523  if(dataReady_.acquire(1, 15000))
524  {
525  UScopeMutex lock(dataMutex_);
526  data = data_;
527  dataPose = dataPose_;
528  firstFrame = firstFrame_;
529  dataGoodTracking = dataGoodTracking_;
530  firstFrame_ = false;
531  dataGoodTracking_ = true;
532  data_ = SensorData();
533  dataPose_.setNull();
534  }
535  if(data.isValid())
536  {
537  data.setGroundTruth(Transform());
538  data.setStamp(stampEpochOffset_ + data.stamp());
539 
540  if(info)
541  {
542  // linear cov = 0.0001
543  info->odomCovariance = cv::Mat::eye(6,6,CV_64FC1) * (firstFrame?9999.0:0.00001);
544  if(!firstFrame)
545  {
546  // angular cov = 0.000001
547  // roll/pitch should be fairly accurate with VIO input
548  info->odomCovariance.at<double>(3,3) *= 0.01; // roll
549  info->odomCovariance.at<double>(4,4) *= 0.01; // pitch
550  if(!dataGoodTracking)
551  {
552  UERROR("not good tracking!");
553  // add slightly more error on translation
554  // 0.001
555  info->odomCovariance.at<double>(0,0) *= 10; // x
556  info->odomCovariance.at<double>(1,1) *= 10; // y
557  info->odomCovariance.at<double>(2,2) *= 10; // z
558  info->odomCovariance.at<double>(5,5) *= 10; // yaw
559  }
560  }
561  info->odomPose = dataPose;
562  }
563  }
564  else
565  {
566  UWARN("CameraMobile::captureImage() invalid data!");
567  }
568  return data;
569 }
570 
572  const cv::Mat & pointCloudData,
573  const Transform & pose,
574  const CameraModel & model,
575  const cv::Mat & rgb,
576  std::vector<cv::KeyPoint> * kpts,
577  std::vector<cv::Point3f> * kpts3D,
578  int kptsSize)
579 {
580  if(!pointCloudData.empty())
581  {
582  cv::Mat scanData(1, pointCloudData.cols, CV_32FC4);
583  float * ptr = scanData.ptr<float>();
584  const float * inPtr = pointCloudData.ptr<float>();
585  int ic = pointCloudData.channels();
586  UASSERT(pointCloudData.depth() == CV_32F && ic >= 3);
587 
588  int oi = 0;
589  for(unsigned int i=0;i<pointCloudData.cols; ++i)
590  {
591  cv::Point3f pt(inPtr[i*ic], inPtr[i*ic + 1], inPtr[i*ic + 2]);
593  ptr[oi*4] = pt.x;
594  ptr[oi*4 + 1] = pt.y;
595  ptr[oi*4 + 2] = pt.z;
596 
597  //get color from rgb image
598  cv::Point3f org= pt;
600  if(pt.z > 0)
601  {
602  int u,v;
603  model.reproject(pt.x, pt.y, pt.z, u, v);
604  unsigned char r=255,g=255,b=255;
605  if(model.inFrame(u, v))
606  {
607  b=rgb.at<cv::Vec3b>(v,u).val[0];
608  g=rgb.at<cv::Vec3b>(v,u).val[1];
609  r=rgb.at<cv::Vec3b>(v,u).val[2];
610  if(kpts)
611  kpts->push_back(cv::KeyPoint(u,v,kptsSize));
612  if(kpts3D)
613  kpts3D->push_back(org);
614 
615  *(int*)&ptr[oi*4 + 3] = int(b) | (int(g) << 8) | (int(r) << 16);
616  ++oi;
617  }
618  }
619  //confidence
620  //*(int*)&ptr[i*4 + 3] = (int(pointCloudData[i*4 + 3] * 255.0f) << 8) | (int(255) << 16);
621 
622  }
623  return LaserScan::backwardCompatibility(scanData.colRange(0, oi), 0, 10, rtabmap::Transform::getIdentity());
624  }
625  return LaserScan();
626 }
627 
628 } /* namespace rtabmap */
rtabmap::SensorData
Definition: SensorData.h:51
int
int
UMutex::lock
int lock() const
Definition: UMutex.h:87
rtabmap::CameraMobile::postUpdate
void postUpdate()
Definition: CameraMobile.cpp:393
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:165
rtabmap::CameraMobile::captureImage
virtual SensorData captureImage(SensorCaptureInfo *info=0)
Definition: CameraMobile.cpp:517
rtabmap::CameraMobile::isCalibrated
virtual bool isCalibrated() const
Definition: CameraMobile.cpp:290
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:163
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:295
stream
stream
UMutex::unlock
int unlock() const
Definition: UMutex.h:113
rtabmap::CameraMobile::occlusionModel_
CameraModel occlusionModel_
Definition: CameraMobile.h:169
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:162
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:154
type
rtabmap::CameraMobile::dataMutex_
UMutex dataMutex_
Definition: CameraMobile.h:160
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:300
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:157
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:153
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:305
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:116
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::resetOrigin
void resetOrigin()
Definition: CameraMobile.cpp:111
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:369
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:801
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:571
rtabmap::CameraMobile::poseReceived
void poseReceived(const Transform &pose, double deviceStamp)
Definition: CameraMobile.cpp:175
rtabmap::CameraMobile::dataReady_
USemaphore dataReady_
Definition: CameraMobile.h:159
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:386
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::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:161
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:406
rtabmap::CameraMobile::previousAnchorLinearVelocity_
std::vector< float > previousAnchorLinearVelocity_
Definition: CameraMobile.h:155
rtabmap::CameraMobile::originOffset_
Transform originOffset_
Definition: CameraMobile.h:151
rtabmap::CameraMobile::previousAnchorStamp_
double previousAnchorStamp_
Definition: CameraMobile.h:156
rtabmap::CameraMobile::poseBuffer_
std::map< double, Transform > poseBuffer_
Definition: CameraMobile.h:166
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 Sun Dec 1 2024 03:42:42