Go to the documentation of this file.
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);
58 deviceTColorCamera_(
Transform::getIdentity()),
60 uvs_initialized_(
false),
61 stampEpochOffset_(0.0),
62 smoothing_(smoothing),
65 upstreamRelocalizationAccThr_(upstreamRelocalizationAccThr),
66 previousAnchorStamp_(0.0),
67 dataGoodTracking_(
true)
121 int maxWaitTimeMs = maxWaitTime * 1000;
128 while(maxWaitTimeMs>0 &&
poseBuffer_.rbegin()->first < epochStamp && waitTry < maxWaitTimeMs)
137 if(maxWaitTimeMs > 0)
139 UWARN(
"Could not find poses to interpolate at time %f after waiting %d ms (latest is %f)...", epochStamp, maxWaitTimeMs,
poseBuffer_.rbegin()->first);
143 UWARN(
"Could not find poses to interpolate at time %f (latest is %f)...", epochStamp,
poseBuffer_.rbegin()->first);
148 std::map<double, Transform>::const_iterator iterB =
poseBuffer_.lower_bound(epochStamp);
149 std::map<double, Transform>::const_iterator iterA = iterB;
158 if(iterA == iterB && epochStamp == iterA->first)
160 pose = iterA->second;
162 else if(epochStamp >= iterA->first && epochStamp <= iterB->
first)
164 pose = iterA->second.
interpolate((epochStamp-iterA->first) / (iterB->first-iterA->first), iterB->second);
168 UWARN(
"Could not find pose data to interpolate at time %f (earliest is %f). Are sensors synchronized?", epochStamp, iterA->first);
207 bool showLog =
false;
211 std::vector<float> currentLinearVelocity(3);
215 currentLinearVelocity[0] = dx /
dt;
216 currentLinearVelocity[1] = dy /
dt;
217 currentLinearVelocity[2] = dz /
dt;
223 float acceleration =
sqrt(ax*ax + ay*ay + az*az);
239 UERROR(
"Upstream re-localization has been suppressed because of "
240 "high acceleration detected (%f m/s^2) causing a jump!",
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;
272 UERROR(
"timestamp original_xyz corrected_xyz:\n%s",
stream.str().c_str());
336 cv::cvtColor(
data.imageRaw(), rgbImage, cv::COLOR_BGR2RGBA);
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);
344 glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
348 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rgbImage.cols, rgbImage.rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbImage.data);
350 GLint
error = glGetError();
351 if(
error != GL_NO_ERROR)
353 LOGE(
"OpenGL: Could not allocate texture (0x%x)\n",
error);
389 LOGE(
"To use CameraMobile::updateOnRender(), CameraMobile::updateDataOnRender() "
390 "should be overridden by inherited classes. Returning empty data!\n");
435 cv::transpose(rgb,rgbt);
439 cv::transpose(depth,deptht);
442 cv::Size sizet(
model.imageHeight(),
model.imageWidth());
448 model.localTransform()*
rtabmap::Transform(0,-1,0,0, 1,0,0,0, 0,0,1,0));
449 model.setImageSize(sizet);
453 for(
size_t i=0;
i<keypoints.size(); ++
i)
467 cv::flip(depth,depth,0);
469 cv::Size sizet(
model.imageWidth(),
model.imageHeight());
476 model.setImageSize(sizet);
480 for(
size_t i=0;
i<keypoints.size(); ++
i)
495 cv::flip(depth,depth,1);
497 cv::Size sizet(
model.imageHeight(),
model.imageWidth());
503 model.localTransform()*
rtabmap::Transform(0,1,0,0, -1,0,0,0, 0,0,1,0));
504 model.setImageSize(sizet);
508 for(
size_t i=0;
i<keypoints.size(); ++
i)
521 bool firstFrame =
true;
522 bool dataGoodTracking =
true;
544 info->odomCovariance = cv::Mat::eye(6,6,CV_64FC1) * (firstFrame?9999.0:0.00001);
549 info->odomCovariance.at<
double>(3,3) *= 0.01;
550 info->odomCovariance.at<
double>(4,4) *= 0.01;
551 if(!dataGoodTracking)
553 UERROR(
"not good tracking!");
556 info->odomCovariance.at<
double>(0,0) *= 10;
557 info->odomCovariance.at<
double>(1,1) *= 10;
558 info->odomCovariance.at<
double>(2,2) *= 10;
559 info->odomCovariance.at<
double>(5,5) *= 10;
562 info->odomPose = dataPose;
567 UWARN(
"CameraMobile::captureImage() invalid data!");
573 const cv::Mat & pointCloudData,
577 std::vector<cv::KeyPoint> * kpts,
578 std::vector<cv::Point3f> * kpts3D,
581 if(!pointCloudData.empty())
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);
590 for(
unsigned int i=0;
i<pointCloudData.cols; ++
i)
592 cv::Point3f pt(inPtr[
i*ic], inPtr[
i*ic + 1], inPtr[
i*ic + 2]);
595 ptr[oi*4 + 1] = pt.y;
596 ptr[oi*4 + 2] = pt.z;
604 model.reproject(pt.x, pt.y, pt.z, u,
v);
605 unsigned char r=255,
g=255,
b=255;
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];
612 kpts->push_back(cv::KeyPoint(u,
v,kptsSize));
614 kpts3D->push_back(org);
616 *(
int*)&ptr[oi*4 + 3] =
int(
b) | (
int(
g) << 8) | (
int(r) << 16);
void resetOrigin(const rtabmap::Transform &offset=rtabmap::Transform())
bool acquire(int n=1, int ms=0)
T uNorm(const std::vector< T > &v)
virtual SensorData captureImage(SensorCaptureInfo *info=0)
virtual bool isCalibrated() const
static LaserScan backwardCompatibility(const cv::Mat &oldScanFormat, int maxPoints=0, int maxRange=0, const Transform &localTransform=Transform::getIdentity())
ScreenRotation colorCameraToDisplayRotation_
glm::mat4 projectionMatrix_
void setGPS(const GPS &gps)
CameraModel occlusionModel_
rtabmap::Transform previousAnchorPose_
float transformed_uvs_[8]
void addEnvSensor(int type, float value)
@ ROTATION_270
270 degree rotation.
Transform deviceTColorCamera_
const std::vector< CameraModel > & cameraModels() const
std::map< double, std::pair< rtabmap::Transform, rtabmap::Transform > > relocalizationDebugBuffer_
CameraMobile(bool smoothing=false, float upstreamRelocalizationAccThr=0.0f)
void setLocalTransform(const Transform &transform)
void setRGBDImage(const cv::Mat &rgb, const cv::Mat &depth, const CameraModel &model, bool clearPreviousData=true)
cv::Point3f RTABMAP_CORE_EXPORT transformPoint(const cv::Point3f &pt, const Transform &transform)
float upstreamRelocalizationAccThr_
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)
cv::Mat RTABMAP_CORE_EXPORT fastBilateralFiltering(const cv::Mat &depth, float sigmaS=15.0f, float sigmaR=0.05f, bool earlyDivision=false)
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
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)
EnvSensors lastEnvSensors_
constexpr int first(int i)
void update(const SensorData &data, const Transform &pose, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix, const float *texCoord)
bool isValidForProjection() const
@ ROTATION_90
90 degree rotation.
virtual bool getPose(double epochStamp, Transform &pose, cv::Mat &covariance, double maxWaitTime=0.06)
#define UASSERT(condition)
void error(const char *str)
@ ROTATION_180
180 degree rotation.
const double & stamp() const
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
static const rtabmap::Transform opticalRotation
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
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
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
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)
void poseReceived(const Transform &pose, double deviceStamp)
std::string UTILITE_EXPORT uFormat(const char *fmt,...)
const cv::Mat & imageRaw() const
ULogger class and convenient macros.
virtual SensorData updateDataOnRender(Transform &pose)
iterator iter(handle obj)
rtabmap::Transform manualOriginOffset_
static const float bilateralFilteringSigmaS
const char * c_str(Args &&...args)
Array< int, Dynamic, 1 > v
static const float bilateralFilteringSigmaR
void uSleep(unsigned int ms)
static const rtabmap::Transform opticalRotationInv
const std::vector< cv::KeyPoint > & keypoints() const
@ ROTATION_0
0 degree rotation (natural orientation)
const cv::Mat & depthOrRightRaw() const
glm::mat4 glmFromTransform(const rtabmap::Transform &transform)
void setGPS(const GPS &gps)
const Transform & localTransform() const
const std::vector< cv::Point3f > & keypoints3D() const
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
void setEnvSensors(const EnvSensors &sensors)
RTABMAP_DEPRECATED void setDepthOrRightRaw(const cv::Mat &image)
std::vector< float > previousAnchorLinearVelocity_
double previousAnchorStamp_
std::map< double, Transform > poseBuffer_
void post(UEvent *event, bool async=true) const
rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Apr 28 2025 02:45:51