50 void CLandmarksMap::TMapDefinition::loadFromConfigFile_map_specific(
56 sectionNamePrefix +
string(
"_creationOpts");
57 this->initialBeacons.clear();
58 const unsigned int nBeacons =
source.read_int(sSectCreation,
"nBeacons", 0);
59 for (
unsigned int q = 1;
q <= nBeacons;
q++)
63 source.read_int(sSectCreation,
format(
"beacon_%03u_ID",
q), 0);
66 source.read_float(sSectCreation,
format(
"beacon_%03u_x",
q), 0);
68 source.read_float(sSectCreation,
format(
"beacon_%03u_y",
q), 0);
70 source.read_float(sSectCreation,
format(
"beacon_%03u_z",
q), 0);
72 this->initialBeacons.push_back(newPair);
75 insertionOpts.loadFromConfigFile(
76 source, sectionNamePrefix +
string(
"_insertOpts"));
77 likelihoodOpts.loadFromConfigFile(
78 source, sectionNamePrefix +
string(
"_likelihoodOpts"));
81 void CLandmarksMap::TMapDefinition::dumpToTextStream_map_specific(
82 std::ostream& out)
const 85 "number of initial beacons = %u\n",
86 (
int)initialBeacons.size());
90 "--------------------------------------------------------\n");
92 p != initialBeacons.end(); ++
p)
94 " %03u (%8.03f,%8.03f,%8.03f)\n",
p->second,
95 p->first.x,
p->first.y,
p->first.z);
97 this->insertionOpts.dumpToTextStream(out);
98 this->likelihoodOpts.dumpToTextStream(out);
126 obj->landmarks.push_back(lm);
144 CLandmarksMap::_mEDD;
146 bool CLandmarksMap::_maxIDUpdated =
false;
150 CLandmarksMap::CLandmarksMap()
209 for (i = 0; i <
n; i++)
295 unsigned int sensedID = it->beaconID;
302 (lm_it->ID == sensedID) &&
303 (!std::isnan(it->sensedDistance)))
305 lm_it->getPose(beaconPDF);
306 beacon3D = beaconPDF.
mean;
309 point3D = robotPose3D + it->sensorLocationOnRobot;
311 const float expectedRange = point3D.
distanceTo(beacon3D);
312 float sensedDist = it->sensedDistance;
313 if (sensedDist < 0) sensedDist = 0;
321 square((expectedRange - sensedDist) / sensorStd));
357 CMatrixD dij(1, 6), Cij(6, 6), Cij_1;
358 dij(0, 0) = o->
pose.
mean.
x() - sensorPose3D.
x();
359 dij(0, 1) = o->
pose.
mean.
y() - sensorPose3D.
y();
360 dij(0, 2) = o->
pose.
mean.z() - sensorPose3D.z();
369 double distMahaFlik2 = dij.multiply_HCHt_scalar(Cij_1);
389 double earth_radius = 6378137;
479 robotPose2D =
CPose2D(*robotPose);
480 robotPose3D = (*robotPose);
596 float maxDistForCorrespondence,
float maxAngularDistForCorrespondence,
598 float& correspondencesRatio,
float* sumSqrDist,
bool onlyKeepTheClosest,
599 bool onlyUniqueRobust)
const 611 CPose3D otherMapPose3D(otherMapPose);
613 correspondencesRatio = 0;
619 std::vector<bool> otherCorrespondences;
626 otherMap2, correspondences, correspondencesRatio, otherCorrespondences);
666 for (sift = siftList.
begin(); sift != siftList.
end(); sift++)
680 landmark3DPositionPDF.
mean *= d;
686 D(0, 0) =
square(0.5 * d);
699 Normal *= -1 / Normal.
norm();
735 fExt.options = feat_options;
753 leftSiftList, rightSiftList, matchesList, matchingOptions);
757 std::cerr <<
"Warning: insertionOptions.PLOT_IMAGES has no effect " 758 "since MRPT 0.9.1\n";
776 stereoParams.
minZ = 0.0f;
779 size_t numM = matchesList.size();
787 (*ii).seenTimesCount = 1;
791 "%u (out of %u) corrs!\n", static_cast<unsigned>(
landmarks.
size()),
792 static_cast<unsigned>(numM));
813 double R11 = HM.get_unsafe(0, 0);
814 double R12 = HM.get_unsafe(0, 1);
815 double R13 = HM.get_unsafe(0, 2);
816 double R21 = HM.get_unsafe(1, 0);
817 double R22 = HM.get_unsafe(1, 1);
818 double R23 = HM.get_unsafe(1, 2);
819 double R31 = HM.get_unsafe(2, 0);
820 double R32 = HM.get_unsafe(2, 1);
821 double R33 = HM.get_unsafe(2, 2);
823 double c11, c22, c33, c12, c13, c23;
833 float C11 = lm->pose_cov_11;
834 float C22 = lm->pose_cov_22;
835 float C33 = lm->pose_cov_33;
836 float C12 = lm->pose_cov_12;
837 float C13 = lm->pose_cov_13;
838 float C23 = lm->pose_cov_23;
841 c11 = R11 * (C11 * R11 + C12 * R12 + C13 * R13) +
842 R12 * (C12 * R11 + C22 * R12 + C23 * R13) +
843 R13 * (C13 * R11 + C23 * R12 + C33 * R13);
844 c12 = (C11 * R11 + C12 * R12 + C13 * R13) * R21 +
845 (C12 * R11 + C22 * R12 + C23 * R13) * R22 +
846 (C13 * R11 + C23 * R12 + C33 * R13) * R23;
847 c13 = (C11 * R11 + C12 * R12 + C13 * R13) * R31 +
848 (C12 * R11 + C22 * R12 + C23 * R13) * R32 +
849 (C13 * R11 + C23 * R12 + C33 * R13) * R33;
850 c22 = R21 * (C11 * R21 + C12 * R22 + C13 * R23) +
851 R22 * (C12 * R21 + C22 * R22 + C23 * R23) +
852 R23 * (C13 * R21 + C23 * R22 + C33 * R23);
853 c23 = (C11 * R21 + C12 * R22 + C13 * R23) * R31 +
854 (C12 * R21 + C22 * R22 + C23 * R23) * R32 +
855 (C13 * R21 + C23 * R22 + C33 * R23) * R33;
856 c33 = R31 * (C11 * R31 + C12 * R32 + C13 * R33) +
857 R32 * (C12 * R31 + C22 * R32 + C23 * R33) +
858 R33 * (C13 * R31 + C23 * R32 + C33 * R33);
861 lm->pose_cov_11 = c11;
862 lm->pose_cov_22 = c22;
863 lm->pose_cov_33 = c33;
864 lm->pose_cov_12 = c12;
865 lm->pose_cov_13 = c13;
866 lm->pose_cov_23 = c23;
870 float Nx = lm->normal.x;
871 float Ny = lm->normal.y;
872 float Nz = lm->normal.z;
874 lm->normal.x = Nx * R11 + Ny * R12 + Nz * R13;
875 lm->normal.y = Nx * R21 + Ny * R22 + Nz * R23;
876 lm->normal.z = Nx * R31 + Ny * R32 + Nz * R33;
896 double R11 = HM.get_unsafe(0, 0);
897 double R12 = HM.get_unsafe(0, 1);
898 double R13 = HM.get_unsafe(0, 2);
899 double R21 = HM.get_unsafe(1, 0);
900 double R22 = HM.get_unsafe(1, 1);
901 double R23 = HM.get_unsafe(1, 2);
902 double R31 = HM.get_unsafe(2, 0);
903 double R32 = HM.get_unsafe(2, 1);
904 double R33 = HM.get_unsafe(2, 2);
906 double c11, c22, c33, c12, c13, c23;
920 float C11 = lm->pose_cov_11;
921 float C22 = lm->pose_cov_22;
922 float C33 = lm->pose_cov_33;
923 float C12 = lm->pose_cov_12;
924 float C13 = lm->pose_cov_13;
925 float C23 = lm->pose_cov_23;
928 c11 = R11 * (C11 * R11 + C12 * R12 + C13 * R13) +
929 R12 * (C12 * R11 + C22 * R12 + C23 * R13) +
930 R13 * (C13 * R11 + C23 * R12 + C33 * R13);
931 c12 = (C11 * R11 + C12 * R12 + C13 * R13) * R21 +
932 (C12 * R11 + C22 * R12 + C23 * R13) * R22 +
933 (C13 * R11 + C23 * R12 + C33 * R13) * R23;
934 c13 = (C11 * R11 + C12 * R12 + C13 * R13) * R31 +
935 (C12 * R11 + C22 * R12 + C23 * R13) * R32 +
936 (C13 * R11 + C23 * R12 + C33 * R13) * R33;
937 c22 = R21 * (C11 * R21 + C12 * R22 + C13 * R23) +
938 R22 * (C12 * R21 + C22 * R22 + C23 * R23) +
939 R23 * (C13 * R21 + C23 * R22 + C33 * R23);
940 c23 = (C11 * R21 + C12 * R22 + C13 * R23) * R31 +
941 (C12 * R21 + C22 * R22 + C23 * R23) * R32 +
942 (C13 * R21 + C23 * R22 + C33 * R23) * R33;
943 c33 = R31 * (C11 * R31 + C12 * R32 + C13 * R33) +
944 R32 * (C12 * R31 + C22 * R32 + C23 * R33) +
945 R33 * (C13 * R31 + C23 * R32 + C33 * R33);
957 float Nx = lm->normal.x;
958 float Ny = lm->normal.y;
959 float Nz = lm->normal.z;
961 newLandmark.
normal.
x = Nx * R11 + Ny * R12 + Nz * R13;
962 newLandmark.
normal.
y = Nx * R21 + Ny * R22 + Nz * R23;
963 newLandmark.
normal.
z = Nx * R31 + Ny * R32 + Nz * R33;
965 newLandmark.
ID = lm->ID;
967 newLandmark.
features = lm->features;
985 std::vector<bool> otherCorrs(other.
size(),
false);
993 unsigned int nRemoved = 0;
995 if (!justInsertAllOfThem)
1003 for (corrIt = corrs.begin(); corrIt != corrs.end(); corrIt++)
1031 for (i = 0; i <
n; i++)
1044 if (!justInsertAllOfThem)
1050 for (i =
n - 1; i >= 0; i--)
1057 std::chrono::duration_cast<std::chrono::milliseconds>(
1073 "[CLandmarksMap::fuseWith] %u fused/ %u new/ %u removed -> %u " 1075 static_cast<unsigned int>(corrs.size()),
1076 static_cast<unsigned int>(other.
size() - corrs.size()),
1077 static_cast<unsigned int>(nRemoved),
1081 f,
"%u\t%u\t%u\t%u\n", static_cast<unsigned int>(corrs.size()),
1082 static_cast<unsigned int>(other.
size() - corrs.size()),
1083 static_cast<unsigned int>(nRemoved),
1097 std::vector<bool>& otherCorrespondences)
const 1102 unsigned int nThis, nOther;
1105 unsigned int i,
n, j, k;
1107 double lik_dist, lik_desc, lik, maxLik;
1111 std::vector<bool> thisLandmarkAssigned;
1112 double K_desc = 0.0;
1113 double K_dist = 0.0;
1123 thisLandmarkAssigned.resize(nThis,
false);
1126 correspondences.clear();
1127 otherCorrespondences.clear();
1128 otherCorrespondences.resize(nOther,
false);
1129 correspondencesRatio = 0;
1151 otherIt != anotherMap->
landmarks.
end(); otherIt++, k++)
1154 otherIt->getPose(pointPDF_k);
1156 if (otherIt->getType() ==
featSIFT)
1178 if (thisIt->getType() ==
featSIFT &&
1179 thisIt->features.size() ==
1180 otherIt->features.size() &&
1181 !thisIt->features.empty() && thisIt->features[0] &&
1182 otherIt->features[0] &&
1183 thisIt->features[0]->descriptors.SIFT.size() ==
1184 otherIt->features[0]->descriptors.SIFT.size())
1190 thisIt->getPose(pointPDF_j);
1197 double distMahaFlik2;
1205 pointPDF_k.
mean.z() - pointPDF_j.
mean.z();
1212 distMahaFlik2 = dij.multiply_HCHt_scalar(
1216 exp(K_dist * distMahaFlik2);
1221 if (lik_dist > 1e-2)
1234 mPair(thisIt->ID, otherIt->ID);
1238 n = otherIt->features[0]
1239 ->descriptors.SIFT.size();
1241 for (i = 0; i <
n; i++)
1243 otherIt->features[0]
1244 ->descriptors.SIFT[i] -
1246 ->descriptors.SIFT[i]);
1264 lik_desc = exp(K_desc * desc);
1275 lik = lik_dist * lik_desc;
1305 if (!thisLandmarkAssigned[maxIdx])
1307 thisLandmarkAssigned[maxIdx] =
true;
1310 otherCorrespondences[k] =
true;
1325 correspondences.push_back(match);
1334 correspondencesRatio =
1335 correspondences.size() /
static_cast<float>(nOther);
1355 ->descriptors.SIFT.size();
1357 otherIt != anotherMap->
landmarks.
end(); otherIt++, k++)
1360 unsigned int mEDDidx = 0;
1366 for (i = 0; i < dLen; i++)
1368 otherIt->features[0]->descriptors.SIFT[i] -
1369 thisIt->features[0]->descriptors.SIFT[i]);
1383 if (!thisLandmarkAssigned[mEDDidx])
1387 thisLandmarkAssigned[mEDDidx] =
true;
1390 otherCorrespondences[k] =
true;
1392 otherIt->getPose(pointPDF_k);
1393 thisIt->getPose(pointPDF_j);
1408 correspondences.push_back(match);
1416 correspondencesRatio =
1417 correspondences.size() /
static_cast<float>(nOther);
1433 FILE* f =
os::fopen(file.c_str(),
"wt");
1434 if (!f)
return false;
1447 f,
"%10f %10f %10f %4i %4u %10f", it->pose_mean.x, it->pose_mean.y,
1448 it->pose_mean.z, static_cast<int>(it->getType()),
1453 it->timestampLastSeen));
1457 ASSERT_(!it->features.empty() && it->features[0]);
1458 for (
unsigned int i = 0;
1459 i < it->features[0]->descriptors.SIFT.size(); i++)
1460 os::fprintf(f,
" %u ", it->features[0]->descriptors.SIFT[i]);
1478 std::string file,
const char* style,
float confInterval)
const 1480 FILE* f =
os::fopen(file.c_str(),
"wt");
1481 if (!f)
return false;
1485 f,
"%%-------------------------------------------------------\n");
1486 os::fprintf(f,
"%% File automatically generated using the MRPT method:\n");
1487 os::fprintf(f,
"%% 'CLandmarksMap::saveToMATLABScript3D'\n");
1491 f,
"%% Jose Luis Blanco Claraco, University of Malaga @ 2006\n");
1494 f,
"%%-------------------------------------------------------\n\n");
1503 f,
"m=[%.4f %.4f %.4f];", it->pose_mean.x, it->pose_mean.y,
1506 f,
"c=[%.8f %.8f %.8f;%.8f %.8f %.8f;%.8f %.8f %.8f]; ",
1507 it->pose_cov_11, it->pose_cov_12, it->pose_cov_13, it->pose_cov_12,
1508 it->pose_cov_22, it->pose_cov_23, it->pose_cov_13, it->pose_cov_23,
1513 "error_ellipse(c,m,'conf',%f,'style','%s','numPointsEllipse',10);" 1515 confInterval, style);
1518 os::fprintf(f,
"axis equal;grid on;xlabel('x'); ylabel('y'); zlabel('z');");
1529 std::string file,
const char* style,
float stdCount)
1531 FILE* f =
os::fopen(file.c_str(),
"wt");
1532 if (!f)
return false;
1534 const int ELLIPSE_POINTS = 30;
1535 std::vector<float> X, Y, COS, SIN;
1540 X.resize(ELLIPSE_POINTS);
1541 Y.resize(ELLIPSE_POINTS);
1542 COS.resize(ELLIPSE_POINTS);
1543 SIN.resize(ELLIPSE_POINTS);
1546 for (Cos = COS.begin(), Sin = SIN.begin(), ang = 0; Cos != COS.end();
1547 Cos++, Sin++, ang += (
M_2PI / (ELLIPSE_POINTS - 1)))
1555 f,
"%%-------------------------------------------------------\n");
1556 os::fprintf(f,
"%% File automatically generated using the MRPT method:\n");
1557 os::fprintf(f,
"%% 'CLandmarksMap::saveToMATLABScript2D'\n");
1561 f,
"%% Jose Luis Blanco Claraco, University of Malaga @ 2006\n");
1564 f,
"%%-------------------------------------------------------\n\n");
1573 cov(0, 0) = it->pose_cov_11;
1574 cov(1, 1) = it->pose_cov_22;
1575 cov(0, 1) =
cov(1, 0) = it->pose_cov_12;
1577 cov.eigenVectors(eigVec, eigVal);
1578 eigVal = eigVal.array().sqrt().matrix();
1579 M = eigVal * eigVec.transpose();
1583 for (
x = X.begin(),
y = Y.begin(), Cos = COS.begin(), Sin = SIN.begin();
1584 x != X.end();
x++,
y++, Cos++, Sin++)
1588 stdCount * (*Cos * M(0, 0) + *Sin * M(1, 0)));
1591 stdCount * (*Cos * M(0, 1) + *Sin * M(1, 1)));
1597 for (
x = X.begin();
x != X.end();
x++)
1603 for (
y = Y.begin();
y != Y.end();
y++)
1624 unsigned int downSampleFactor)
1628 double J11, J12, J21, J22;
1639 sensorGlobalPose = *robotPose + obs.
sensorPose;
1654 double var_d =
square(0.005);
1655 double var_th =
square(dTh / 10.0);
1658 for (i = 0; i <
n; i += downSampleFactor, Th += downSampleFactor * dTh)
1677 newLandmark.
features[0]->orientation = Th;
1678 newLandmark.
features[0]->scale = d;
1696 newLandmark.
pose_cov_11 = (J11 * J11 * var_th + J12 * J12 * var_d);
1697 newLandmark.
pose_cov_12 = (J11 * J21 * var_th + J12 * J22 * var_d);
1698 newLandmark.
pose_cov_22 = (J21 * J21 * var_th + J22 * J22 * var_d);
1736 double nFoundCorrs = 0;
1737 std::vector<int32_t>* corrs;
1738 unsigned int cx, cy, cx_1, cx_2, cy_1, cy_2;
1747 for (itOther =
s->landmarks.begin(); itOther !=
s->landmarks.end();
1750 itOther->getPose(poseOther);
1752 cx = cy = grid->
y2idx(itOther->pose_mean.y);
1754 cx_1 = max(0, grid->
x2idx(itOther->pose_mean.x - 0.10f));
1757 grid->
x2idx(itOther->pose_mean.x + 0.10f));
1758 cy_1 = max(0, grid->
y2idx(itOther->pose_mean.y - 0.10f));
1761 grid->
y2idx(itOther->pose_mean.y + 0.10f));
1772 for (cx = cx_1; cx <= cx_2; cx++)
1773 for (cy = cy_1; cy <= cy_2; cy++)
1777 if (!corrs->empty())
1779 it != corrs->end(); ++it)
1787 if (fabs(lm->
pose_mean.
x - itOther->pose_mean.x) >
1789 fabs(lm->
pose_mean.
y - itOther->pose_mean.y) >
1806 PrNoCorr *= 1 - corr;
1813 nFoundCorrs += 1 - PrNoCorr;
1844 lik *= 1 - PrNoCorr;
1848 lik = nFoundCorrs /
static_cast<double>(
s->size());
1865 m_grid(-10.0f, 10.0f, -10.0f, 10.f, 0.20f),
1866 m_largestDistanceFromOrigin(),
1867 m_largestDistanceFromOriginIsUpdated(false)
1873 m_landmarks.clear();
1878 m_largestDistanceFromOriginIsUpdated =
false;
1884 std::vector<int32_t> dummyEmpty;
1890 max(m_grid.getYMax(), l.
pose_mean.
y + 0.1), dummyEmpty);
1892 m_landmarks.push_back(l);
1897 cell->push_back(m_landmarks.size() - 1);
1899 m_largestDistanceFromOriginIsUpdated =
false;
1904 return &m_landmarks[indx];
1908 unsigned int indx)
const 1910 return &m_landmarks[indx];
1915 std::vector<int32_t>* cell = m_grid.cellByPos(
1916 m_landmarks[indx].pose_mean.x, m_landmarks[indx].pose_mean.y);
1919 for (it = cell->begin(); it != cell->end(); it++)
1921 if (*it == static_cast<int>(indx))
1928 m_largestDistanceFromOriginIsUpdated =
false;
1933 m_landmarks.erase(m_landmarks.begin() + indx);
1934 m_largestDistanceFromOriginIsUpdated =
false;
1939 std::vector<int32_t> dummyEmpty;
1943 min(m_grid.getXMin(), m_landmarks[indx].pose_mean.x),
1944 max(m_grid.getXMax(), m_landmarks[indx].pose_mean.x),
1945 min(m_grid.getYMin(), m_landmarks[indx].pose_mean.y),
1946 max(m_grid.getYMax(), m_landmarks[indx].pose_mean.y), dummyEmpty);
1949 std::vector<int32_t>* cell = m_grid.cellByPos(
1950 m_landmarks[indx].pose_mean.x, m_landmarks[indx].pose_mean.y);
1951 cell->push_back(indx);
1952 m_largestDistanceFromOriginIsUpdated =
false;
1961 double min_x = -10.0, max_x = 10.0;
1962 double min_y = -10.0, max_y = 10.0;
1963 std::vector<int32_t> dummyEmpty;
1969 for (idx = 0, it = m_landmarks.begin(); it != m_landmarks.end();
1972 min_x =
min(min_x, it->pose_mean.x);
1973 max_x = max(max_x, it->pose_mean.x);
1974 min_y =
min(min_y, it->pose_mean.y);
1975 max_y = max(max_y, it->pose_mean.y);
1977 m_grid.resize(min_x, max_x, min_y, max_y, dummyEmpty);
1980 for (idx = 0, it = m_landmarks.begin(); it != m_landmarks.end();
1983 std::vector<int32_t>* cell =
1984 m_grid.cellByPos(it->pose_mean.x, it->pose_mean.y);
1985 cell->push_back(idx);
1988 m_largestDistanceFromOriginIsUpdated =
false;
1999 if (!m_largestDistanceFromOriginIsUpdated)
2002 float maxDistSq = 0, d;
2005 d =
square(it->pose_mean.x) +
square(it->pose_mean.y) +
2007 maxDistSq = max(d, maxDistSq);
2010 m_largestDistanceFromOrigin = sqrt(maxDistSq);
2011 m_largestDistanceFromOriginIsUpdated =
true;
2013 return m_largestDistanceFromOrigin;
2021 std::vector<bool>* otherCorrespondences)
2025 unsigned long distDesc;
2026 double likByDist, likByDesc;
2033 unsigned int idx1, idx2;
2035 CMatrixD dij(1, 3), Cij(3, 3), Cij_1;
2036 double distMahaFlik2;
2050 lm1 += decimation, idx1 += decimation)
2055 lm1->getPose(lm1_pose);
2066 lm2->getPose(lm2_pose);
2071 dij(0, 0) = lm1->pose_mean.x - lm2->pose_mean.x;
2072 dij(0, 1) = lm1->pose_mean.y - lm2->pose_mean.y;
2073 dij(0, 2) = lm1->pose_mean.z - lm2->pose_mean.z;
2082 distMahaFlik2 = dij.multiply_HCHt_scalar(
2085 likByDist = exp(K_dist * distMahaFlik2);
2087 if (likByDist > 1e-2)
2099 mPair(lm2->ID, lm1->ID);
2107 !lm1->features.empty() &&
2108 !lm2->features.empty());
2110 lm1->features[0] && lm2->features[0]);
2113 ->descriptors.SIFT.size() ==
2115 ->descriptors.SIFT.size());
2117 for (it1 = lm1->features[0]
2118 ->descriptors.SIFT.begin(),
2119 it2 = lm2->features[0]
2120 ->descriptors.SIFT.begin();
2121 it1 != lm1->features[0]
2122 ->descriptors.SIFT.end();
2124 distDesc +=
square(*it1 - *it2);
2132 distDesc = (
unsigned long)
2135 likByDesc = exp(K_desc * distDesc);
2136 lik_i += likByDist *
2148 lik *= (0.1 + 0.9 * lik_i);
2162 if (correspondences ==
nullptr)
2164 "When using this method with SIFTLikelihoodMethod = 1, " 2165 "TMatchingPairList *correspondence can not be NULL");
2167 if (otherCorrespondences ==
nullptr)
2169 "When using this method with SIFTLikelihoodMethod = 1, " 2170 "std::vector<bool> *otherCorrespondences can not be NULL");
2172 for (itCorr = correspondences->begin();
2173 itCorr != correspondences->end(); itCorr++)
2186 distMahaFlik2 = dij.multiply_HCHt_scalar(
2193 lik *= exp(-0.5 * dist);
2198 for (k = 1; k <= (theMap->
size() - correspondences->size()); k++)
2214 : insert_SIFTs_from_monocular_images(true),
2215 insert_SIFTs_from_stereo_images(true),
2216 insert_Landmarks_from_range_scans(true),
2217 SiftCorrRatioThreshold(0.4f),
2218 SiftLikelihoodThreshold(0.5f),
2220 SiftEDDThreshold(200.0f),
2221 SIFTMatching3DMethod(0),
2222 SIFTLikelihoodMethod(0),
2224 SIFTsLoadDistanceOfTheMean(3.0f),
2225 SIFTsLoadEllipsoidWidth(0.05f),
2228 SIFTs_stdDisparity(1.0f),
2230 SIFTs_numberOfKLTKeypoints(60),
2231 SIFTs_stereo_maxDepth(15.0f),
2233 SIFTs_epipolar_TH(1.5f),
2236 SIFT_feat_options(vision::
featSIFT)
2246 "\n----------- [CLandmarksMap::TInsertionOptions] ------------ \n\n");
2249 "insert_SIFTs_from_monocular_images = %c\n",
2250 insert_SIFTs_from_monocular_images ?
'Y' :
'N');
2252 "insert_SIFTs_from_stereo_images = %c\n",
2253 insert_SIFTs_from_stereo_images ?
'Y' :
'N');
2255 "insert_Landmarks_from_range_scans = %c\n",
2256 insert_Landmarks_from_range_scans ?
'Y' :
'N');
2259 "SiftCorrRatioThreshold = %f\n",
2260 SiftCorrRatioThreshold);
2262 "SiftLikelihoodThreshold = %f\n",
2263 SiftLikelihoodThreshold);
2265 "SiftEDDThreshold = %f\n", SiftEDDThreshold);
2267 "SIFTMatching3DMethod = %d\n", SIFTMatching3DMethod);
2269 "SIFTLikelihoodMethod = %d\n", SIFTLikelihoodMethod);
2272 "SIFTsLoadDistanceOfTheMean = %f\n",
2273 SIFTsLoadDistanceOfTheMean);
2275 "SIFTsLoadEllipsoidWidth = %f\n",
2276 SIFTsLoadEllipsoidWidth);
2279 "SIFTs_stdXY = %f\n", SIFTs_stdXY);
2281 "SIFTs_stdDisparity = %f\n", SIFTs_stdDisparity);
2284 "SIFTs_numberOfKLTKeypoints = %i\n",
2285 SIFTs_numberOfKLTKeypoints);
2287 "SIFTs_stereo_maxDepth = %f\n",
2288 SIFTs_stereo_maxDepth);
2290 "SIFTs_epipolar_TH = %f\n", SIFTs_epipolar_TH);
2292 "PLOT_IMAGES = %c\n",
2293 PLOT_IMAGES ?
'Y' :
'N');
2295 SIFT_feat_options.dumpToTextStream(out);
2306 insert_SIFTs_from_monocular_images =
iniFile.read_bool(
2307 section.c_str(),
"insert_SIFTs_from_monocular_images",
2308 insert_SIFTs_from_monocular_images);
2309 insert_SIFTs_from_stereo_images =
iniFile.read_bool(
2310 section.c_str(),
"insert_SIFTs_from_stereo_images",
2311 insert_SIFTs_from_stereo_images);
2312 insert_Landmarks_from_range_scans =
iniFile.read_bool(
2313 section.c_str(),
"insert_Landmarks_from_range_scans",
2314 insert_Landmarks_from_range_scans);
2315 SiftCorrRatioThreshold =
iniFile.read_float(
2316 section.c_str(),
"SiftCorrRatioThreshold", SiftCorrRatioThreshold);
2317 SiftLikelihoodThreshold =
iniFile.read_float(
2318 section.c_str(),
"SiftLikelihoodThreshold", SiftLikelihoodThreshold);
2319 SiftEDDThreshold =
iniFile.read_float(
2320 section.c_str(),
"SiftEDDThreshold", SiftEDDThreshold);
2321 SIFTMatching3DMethod =
iniFile.read_int(
2322 section.c_str(),
"SIFTMatching3DMethod", SIFTMatching3DMethod);
2323 SIFTLikelihoodMethod =
iniFile.read_int(
2324 section.c_str(),
"SIFTLikelihoodMethod", SIFTLikelihoodMethod);
2325 SIFTsLoadDistanceOfTheMean =
iniFile.read_float(
2326 section.c_str(),
"SIFTsLoadDistanceOfTheMean",
2327 SIFTsLoadDistanceOfTheMean);
2328 SIFTsLoadEllipsoidWidth =
iniFile.read_float(
2329 section.c_str(),
"SIFTsLoadEllipsoidWidth", SIFTsLoadEllipsoidWidth);
2331 iniFile.read_float(section.c_str(),
"SIFTs_stdXY", SIFTs_stdXY);
2332 SIFTs_stdDisparity =
iniFile.read_float(
2333 section.c_str(),
"SIFTs_stdDisparity", SIFTs_stdDisparity);
2334 SIFTs_numberOfKLTKeypoints =
iniFile.read_int(
2335 section.c_str(),
"SIFTs_numberOfKLTKeypoints",
2336 SIFTs_numberOfKLTKeypoints);
2337 SIFTs_stereo_maxDepth =
iniFile.read_float(
2338 section.c_str(),
"SIFTs_stereo_maxDepth", SIFTs_stereo_maxDepth);
2339 SIFTs_epipolar_TH =
iniFile.read_float(
2340 section.c_str(),
"SIFTs_epipolar_TH", SIFTs_epipolar_TH);
2342 iniFile.read_bool(section.c_str(),
"PLOT_IMAGES", PLOT_IMAGES);
2344 SIFT_feat_options.loadFromConfigFile(
iniFile, section);
2351 : rangeScan2D_decimation(20),
2352 SIFTs_sigma_euclidean_dist(0.30f),
2353 SIFTs_sigma_descriptor_dist(100.0f),
2354 SIFTs_mahaDist_std(4.0f),
2355 SIFTnullCorrespondenceDistance(4.0f),
2356 SIFTs_decimation(1),
2357 SIFT_feat_options(vision::
featSIFT),
2358 beaconRangesStd(0.08f),
2359 beaconRangesUseObservationStd(false),
2360 extRobotPoseStd(0.05f),
2367 : longitude(-4.47763833333333),
2368 latitude(36.71559000000000),
2381 std::ostream& out)
const 2384 "\n----------- [CLandmarksMap::TLikelihoodOptions] ------------ \n\n");
2387 "rangeScan2D_decimation = %i\n",
2390 "SIFTs_sigma_euclidean_dist = %f\n",
2393 "SIFTs_sigma_descriptor_dist = %f\n",
2400 "SIFTnullCorrespondenceDistance = %f\n",
2405 "beaconRangesUseObservationStd = %c\n",
2442 section.c_str(),
"SIFTs_sigma_euclidean_dist",
2445 section.c_str(),
"SIFTs_sigma_descriptor_dist",
2452 section.c_str(),
"SIFTnullCorrespondenceDistance",
2476 section.c_str(),
"beaconRangesUseObservationStd",
2489 : minTimesSeen(2), ellapsedTime(4.0f)
2501 const CPose3D& in_robotPose,
const CPoint3D& in_sensorLocationOnRobot,
2510 point3D = in_robotPose + in_sensorLocationOnRobot;
2522 it->getPose(beaconPDF);
2523 beacon3D = beaconPDF.
mean;
2541 out_Observations.
sensedData.push_back(newMeas);
2563 mrpt::make_aligned_shared<mrpt::opengl::CSetOfObjects>();
2567 mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
2568 -100, 100, -100, 100, 0, 1);
2595 mrpt::make_aligned_shared<opengl::CEllipsoid>();
2597 it->getPose(pointGauss);
2599 ellip->setPose(pointGauss.
mean);
2600 ellip->setCovMatrix(pointGauss.
cov);
2601 ellip->enableDrawSolid3D(
false);
2602 ellip->setQuantiles(3.0);
2603 ellip->set3DsegmentsCount(10);
2604 ellip->setColor(0, 0, 1);
2606 mrpt::format(
"LM.ID=%u", static_cast<unsigned int>(it->ID)));
2607 ellip->enableShowName(
true);
2609 outObj->insert(ellip);
2622 for (
size_t indx = 0; indx < m_landmarks.size(); indx++)
2624 if (m_landmarks[indx].ID == ID)
return &m_landmarks[indx];
2641 unsigned int ID)
const 2643 for (
size_t indx = 0; indx < m_landmarks.size(); indx++)
2645 if (m_landmarks[indx].ID == ID)
return &m_landmarks[indx];
2678 otherMap = static_cast<const CLandmarksMap*>(otherMap2);
2680 if (!otherMap)
return 0;
2683 std::deque<CPointPDFGaussian::Ptr> poses3DThis, poses3DOther;
2687 size_t nOther = otherMap->landmarks.size();
2688 size_t otherLandmarkWithCorrespondence = 0;
2691 if (!nThis)
return 0;
2692 if (!nOther)
return 0;
2697 float Tx = pose3DMatrix.get_unsafe(0, 3);
2698 float Ty = pose3DMatrix.get_unsafe(1, 3);
2699 float Tz = pose3DMatrix.get_unsafe(2, 3);
2709 otherMap->landmarks.getLargestDistanceFromOrigin() + 1.0f))
2713 poses3DOther.resize(nOther);
2714 for (
size_t i = 0; i < nOther; i++)
2715 poses3DOther[i] = mrpt::make_aligned_shared<CPointPDFGaussian>();
2717 poses3DThis.resize(nThis);
2718 for (
size_t i = 0; i < nThis; i++)
2719 poses3DThis[i] = mrpt::make_aligned_shared<CPointPDFGaussian>();
2722 for (itOther = otherMap->landmarks.begin(),
2723 itPoseOther = poses3DOther.begin();
2724 itOther != otherMap->landmarks.end(); itOther++, itPoseOther++)
2726 itOther->getPose(**itPoseOther);
2727 (*itPoseOther)->changeCoordinatesReference(otherMapPose);
2731 for (itThis =
landmarks.
begin(), itPoseThis = poses3DThis.begin();
2734 itThis->getPose(**itPoseThis);
2738 for (itOther = otherMap->landmarks.begin(),
2739 itPoseOther = poses3DOther.begin();
2740 itOther != otherMap->landmarks.end(); itOther++, itPoseOther++)
2742 for (itThis =
landmarks.
begin(), itPoseThis = poses3DThis.begin();
2748 (*itPoseThis)->mean.x() - (*itPoseOther)->mean.x(),
2749 (*itPoseThis)->mean.y() - (*itPoseOther)->mean.y(),
2750 (*itPoseThis)->mean.z() - (*itPoseOther)->mean.z());
2756 float distMaha = sqrt(d.multiply_HCHt_scalar(
2759 if (distMaha <
params.maxMahaDistForCorr)
2762 if (!itThis->features.empty() && !itOther->features.empty() &&
2763 itThis->features[0]->descriptors.SIFT.size() ==
2764 itOther->features[0]->descriptors.SIFT.size())
2766 unsigned long descrDist = 0;
2768 for (it1 = itThis->features[0]->descriptors.SIFT.begin(),
2769 it2 = itOther->features[0]->descriptors.SIFT.begin();
2770 it1 != itThis->features[0]->descriptors.SIFT.end();
2772 descrDist +=
square(*it1 - *it2);
2775 sqrt(static_cast<float>(descrDist)) /
2776 itThis->features[0]->descriptors.SIFT.size();
2778 if (descrDist_f < 1.5f)
2780 otherLandmarkWithCorrespondence++;
2789 return static_cast<float>(otherLandmarkWithCorrespondence) / nOther;
2817 const CPose3D& in_robotPose,
const CPose3D& in_sensorLocationOnRobot,
2819 const float in_stdRange,
const float in_stdYaw,
const float in_stdPitch,
2820 std::vector<size_t>* out_real_associations,
2821 const double spurious_count_mean,
const double spurious_count_std)
const 2829 if (out_real_associations) out_real_associations->clear();
2832 const CPose3D point3D = in_robotPose +
CPose3D(in_sensorLocationOnRobot);
2849 it->getPose(beaconPDF);
2870 if (sensorDetectsIDs)
2879 out_Observations.
sensedData.push_back(newMeas);
2881 if (out_real_associations)
2882 out_real_associations->push_back(idx);
2887 spurious_count_mean, spurious_count_std);
2888 size_t nSpurious = 0;
2889 if (spurious_count_std != 0 || spurious_count_mean != 0)
2895 for (
size_t i = 0; i < nSpurious; i++)
2908 const double pitch =
2923 out_Observations.
sensedData.push_back(newMeas);
2925 if (out_real_associations)
2926 out_real_associations->push_back(
void clear()
Erase all the contents of the map.
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
A namespace of pseudo-random numbers generators of diferent distributions.
float fieldOfView_yaw
Information about the.
double drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
float EDD_RATIO
Boundary Ratio between the two lowest EDD.
internal::TSequenceLandmarks::iterator iterator
double x() const
Common members of all points & poses classes.
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
TFuseOptions()
Initialization.
Parameters for CMetricMap::compute3DMatchingRatio()
float SiftEDDThreshold
[For SIFT landmarks only] The minimum Euclidean Descriptor Distance value of a match to set as corres...
GLuint GLuint GLsizei count
Non-defined feature (also used for Occupancy features)
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
size_t size() const
Returns the stored landmarks count.
mrpt::maps::CLandmarksMap::TInsertionOptions insertionOpts
int y2idx(double y) const
CPose3D mean
The mean value.
A 2D grid of dynamic size which stores any kind of data at each cell.
bool insert_SIFTs_from_stereo_images
If set to true (default), the insertion of a CObservationStereoImages in the map will insert SIFT 3D ...
This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric<double>".
void createOneFeature()
Creates one feature in the vector "features", calling the appropriate constructor of the smart pointe...
std::vector< mrpt::vision::CFeature::Ptr > features
The set of features from which the landmark comes.
float range
The sensed landmark distance, in meters.
double latitude_degrees
The measured latitude, in degrees (North:+ , South:-)
TInternalFeatList::iterator iterator
mrpt::img::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
#define THROW_EXCEPTION(msg)
unsigned int SIFTLikelihoodMethod
[For SIFT landmarks only] Method to compute the likelihood (Default = 0 (Our method)) 0: Our method -...
static bool _maxIDUpdated
bool enableSaveAs3DObject
(Default=true) If false, calling CMetricMap::getAs3DObject() will have no effects ...
float beaconRangesStd
The standard deviation used for Beacon ranges likelihood (default=0.08) [meters]. ...
const CLandmark * getByID(CLandmark::TLandmarkID ID) const
Returns the landmark with a given landmrk ID, or nullptr if not found.
int void fclose(FILE *f)
An OS-independent version of fclose.
mrpt::system::TTimeStamp getCurrentTime()
Returns the current (UTC) system time.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
CPoint3D mean
The mean value.
float SIFTs_stereo_maxDepth
Maximum depth of 3D landmarks when loading a landmarks map from a stereo image observation.
double DEG2RAD(const double x)
Degrees to radians.
void fuseWith(CLandmarksMap &other, bool justInsertAllOfThem=false)
Fuses the contents of another map with this one, updating "this" object with the result.
GLdouble GLdouble GLdouble GLdouble q
long round_long(const T value)
Returns the closer integer (long) to x.
Declares a class derived from "CObservation" that stores a Landmarks Map as seen from a stereo camera...
uint32_t satellitesUsed
The number of satelites used to compute this estimation.
struct mrpt::maps::CLandmarksMap::TFuseOptions fuseOptions
double norm() const
Point norm.
EIGEN_STRONG_INLINE iterator begin()
float extRobotPoseStd
The standard deviation used for external robot poses likelihood (default=0.05) [meters].
double extractDayTimeFromTimestamp(const mrpt::system::TTimeStamp t)
Returns the number of seconds ellapsed from midnight in the given timestamp.
An observation providing an alternative robot pose from an external source.
double pitch() const
Get the PITCH angle (in radians)
double yaw() const
Get the YAW angle (in radians)
Declares a class derived from "CObservation" that represents one (or more) range measurements to labe...
A pair (x,y) of pixel coordinates (subpixel resolution).
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
int32_t beaconID
The ID of the sensed beacon (or INVALID_BEACON_ID if unknown)
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
TMapGenericParams genericMapParams
Common params to all maps.
float epipolar_TH
Epipolar constraint (rows of pixels)
float minZ
Maximum allowed distance.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
GLsizei GLsizei GLuint * obj
void simulateBeaconReadings(const mrpt::poses::CPose3D &in_robotPose, const mrpt::poses::CPoint3D &in_sensorLocationOnRobot, mrpt::obs::CObservationBeaconRanges &out_Observations) const
Simulates a noisy reading toward each of the beacons in the landmarks map, if any.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
mrpt::poses::CPose3D sensorPose
The pose of the sensor on the robot/vehicle.
const CLandmark * getByBeaconID(unsigned int ID) const
Returns the landmark with a given beacon ID, or nullptr if not found.
void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const override
This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >...
double drawGaussian1D(const double mean, const double std)
Generate a normally distributed pseudo-random number.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< char > > validRange
It's false (=0) on no reflected rays, referenced to elements in scan.
void internal_clear() override
Internal method called by clear()
std::vector< CLandmark > TSequenceLandmarks
bool beaconRangesUseObservationStd
(Default: false) If true, beaconRangesStd is ignored and each individual CObservationBeaconRanges::st...
static mrpt::maps::CLandmark::TLandmarkID _mapMaxID
float stdPixel
Standard deviation of the error in feature detection.
int64_t TLandmarkID
The type for the IDs of landmarks.
float yaw
The sensed landmark direction, in radians, measured as the yaw (azimuth) and pitch (negative elevatio...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
bool insert_SIFTs_from_monocular_images
If set to true (default), the insertion of a CObservationImage in the map will insert SIFT 3D feature...
T square(const T x)
Inline function for the square of a number.
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
mrpt::math::CMatrixDouble33 intrinsicParams
Matrix of intrinsic parameters (containing the focal length and principal point coordinates) ...
int32_t landmarkID
The ID of the sensed beacon, or INVALID_LANDMARK_ID (-1) if the sensor does not identify the landmark...
#define ASSERT_(f)
Defines an assertion mechanism.
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
void bayesianFusion(const CPointPDFGaussian &p1, const CPointPDFGaussian &p2)
Bayesian fusion of two points gauss.
mrpt::maps::CLandmark::TLandmarkID getMapMaxID()
double altitude_meters
The measured altitude, in meters (A).
float SIFTsLoadDistanceOfTheMean
[For SIFT landmarks only] The distance (in meters) of the mean value of landmarks, for the initial position PDF (Default = 3m)
Matching by Euclidean distance between SIFT descriptors.
int SIFTs_numberOfKLTKeypoints
Number of points to extract in the image.
This class allows loading and storing values and vectors of different types from a configuration text...
This base provides a set of functions for maths stuff.
void setPose(const mrpt::poses::CPointPDFGaussian &p)
Sets the pose from an object:
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
int SIFTs_decimation
Considers 1 out of "SIFTs_decimation" visual landmarks in the observation during the likelihood compu...
A class for storing a map of 3D probabilistic landmarks.
float getLargestDistanceFromOrigin() const
This method returns the largest distance from the origin to any of the points, such as a sphere cente...
void erase(unsigned int indx)
mrpt::img::CImage image
The image captured by the camera, that is, the main piece of information of this observation.
#define MRPT_CHECK_NORMAL_NUMBER(v)
Throws an exception if the number is NaN, IND, or +/-INF, or return the same number otherwise...
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
double norm() const
Returns the euclidean norm of vector: .
Parameters associated to a stereo system.
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
void push_back(const CLandmark &lm)
The object is copied, thus the original copy passed as a parameter can be released.
CMatrixTemplateNumeric< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).
float SIFTs_stdXY
[For SIFT landmarks only] The standard deviation (in pixels) for the SIFTs detector (This is used for...
Scale Invariant Feature Transform [LOWE'04].
std::pair< mrpt::math::TPoint3D, unsigned int > TPairIdBeacon
std::deque< TMeasurement > sensedData
The list of observed ranges.
void sphericalCoordinates(const mrpt::math::TPoint3D &point, double &out_range, double &out_yaw, double &out_pitch) const
Computes the spherical coordinates of a 3D point as seen from the 6D pose specified by this object...
double longitude_degrees
The measured longitude, in degrees (East:+ , West:-)
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
float fieldOfView_pitch
Information about the sensor: The "field-of-view" of the sensor, in radians (for pitch )...
virtual ~CLandmarksMap()
Virtual destructor.
This namespace contains representation of robot actions and observations.
string iniFile(myDataDir+string("benchmark-options.ini"))
double computeLikelihood_SIFT_LandmarkMap(CLandmarksMap *map, mrpt::tfest::TMatchingPairList *correspondences=nullptr, std::vector< bool > *otherCorrespondences=nullptr)
Returns the (logarithmic) likelihood of a set of landmarks "map" given "this" map.
Classes for computer vision, detectors, features, etc.
double x
X,Y,Z coordinates.
void getPose(mrpt::poses::CPointPDFGaussian &p) const
Returns the pose as an object:
mrpt::img::TCamera cameraParams
Intrinsic and distortion parameters of the camera.
T * cellByIndex(unsigned int cx, unsigned int cy)
Returns a pointer to the contents of a cell given by its cell indexes, or nullptr if it is out of the...
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
size_t getSizeX() const
Returns the horizontal size of grid map in cells count.
float SIFTnullCorrespondenceDistance
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) override
Computes the (logarithmic) likelihood that a given observation was taken from a given pose in the wor...
GLsizei const GLchar ** string
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
MSG_CLASS & getMsgByClass()
Returns a reference to the message in the list CObservationGPS::messages of the requested class...
A class used to store a 3D point.
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double roll() const
Get the ROLL angle (in radians)
float stdError
The "sigma" of the sensor, assuming a zero-mean Gaussian noise model.
mrpt::system::TTimeStamp timestampLastSeen
The last time that this landmark was observed.
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
bool saveToFile(const std::string &fil) const
Saves the scene to a 3Dscene file, loadable by the application SceneViewer3D.
mrpt::poses::CPose3D sensorLocationOnRobot
The position of the sensor on the robot.
Each one of the measurements:
void changeCoordinatesReference(const mrpt::poses::CPose3D &newOrg)
Changes the reference system of the map to a given 3D pose.
mrpt::vision::CFeatureExtraction::TOptions SIFT_feat_options
Parameters of the SIFT feature detector/descriptors while inserting images in the landmark map...
size_t getSizeY() const
Returns the vertical size of grid map in cells count.
mrpt::maps::CLandmarksMap::TInsertionOptions insertionOptions
unsigned int minTimesSeen
Required number of times of a landmark to be seen not to be removed, in "ellapsedTime" seconds...
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
static std::map< std::pair< mrpt::maps::CLandmark::TLandmarkID, mrpt::maps::CLandmark::TLandmarkID >, double > _mEDD
Map of the Euclidean Distance between the descriptors of two SIFT-based landmarks.
float minSensorDistance
Info about sensor.
mrpt::math::TPoint3D asTPoint() const
bool saveToTextFile(std::string file)
Save to a text file.
void hasBeenModified(unsigned int indx)
float sensedDistance
The sensed range itself (in meters).
unsigned int rangeScan2D_decimation
The number of rays from a 2D range scan will be decimated by this factor (default = 1...
mrpt::math::CMatrixDouble66 cov
The 6x6 covariance matrix.
mrpt::maps::CLandmarksMap::TLikelihoodOptions likelihoodOpts
mrpt::poses::CPose3D refCameraPose
The 3D pose of the reference camera relative to robot coordinates.
void hasBeenModifiedAll()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The class for storing "landmarks" (visual or laser-scan-extracted features,...)
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
CMatrixTemplateNumeric< T > generateAxisBaseFromDirection(T dx, T dy, T dz)
Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of the...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
mrpt::poses::CPose3DPDFGaussian pose
The observed robot pose.
double productIntegralNormalizedWith2D(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
Virtual base class for "archives": classes abstracting I/O streams.
float ellapsedTime
See "minTimesSeen".
internal_msg_test_proxy< gnss::NMEA_GGA > has_GGA_datum
Evaluates as a bool; true if the corresponding field exists in messages.
Declares a virtual base class for all metric maps storage classes.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
bool PLOT_IMAGES
Indicates if the images (as well as the SIFT detected features) should be shown in a window...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
mrpt::math::TPoint3D normal
The "normal" to the landmark, i.e.
std::deque< TPairIdBeacon > initialBeacons
Initial contents of the map, especified by a set of 3D Beacons with associated IDs.
float SIFTsLoadEllipsoidWidth
[For SIFT landmarks only] The width (in meters, standard deviation) of the ellipsoid in the axis perp...
void loadSiftFeaturesFromStereoImageObservation(const mrpt::obs::CObservationStereoImages &obs, mrpt::maps::CLandmark::TLandmarkID fID, const mrpt::vision::CFeatureExtraction::TOptions &feat_options=mrpt::vision::CFeatureExtraction::TOptions(mrpt::vision::featSIFT))
Loads into this landmarks map the SIFT features extracted from an observation consisting of a pair of...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=nullptr, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
float maxZ
Maximum allowed distance.
mrpt::containers::CDynamicGrid< std::vector< int32_t > > * getGrid()
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
mrpt::vision::TFeatureType getType() const
Gets the type of the first feature in its feature vector.
size_t matchFeatures(const CFeatureList &list1, const CFeatureList &list2, CMatchedFeatureList &matches, const TMatchingOptions &options=TMatchingOptions(), const TStereoSystemParams ¶ms=TStereoSystemParams())
Find the matches between two lists of features which must be of the same type.
CMatrixFixedNumeric< double, 3, 3 > CMatrixDouble33
This observation represents a number of range-bearing value pairs, each one for a detected landmark...
A structure containing options for the matching.
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Internal method called by insertObservation()
TInsertionOptions()
Initilization of default parameters.
mrpt::maps::CLandmarksMap landmarks
The landmarks, with coordinates origin in the camera reference system.
void loadSiftFeaturesFromImageObservation(const mrpt::obs::CObservationImage &obs, const mrpt::vision::CFeatureExtraction::TOptions &feat_options=mrpt::vision::CFeatureExtraction::TOptions(mrpt::vision::featSIFT))
Loads into this landmarks map the SIFT features extracted from an image observation (Previous content...
content_t fields
Message content, accesible by individual fields.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
GLsizei GLsizei GLchar * source
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
mrpt::poses::CPoint3D sensorLocationOnRobot
Position of the sensor on the robot.
int x2idx(double x) const
Transform a coordinate values into cell indexes.
#define INVALID_LANDMARK_ID
Used for CObservationBearingRange::TMeasurement::beaconID and others.
void computeMatchingWith2D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose2D &otherMapPose, float maxDistForCorrespondence, float maxAngularDistForCorrespondence, const mrpt::poses::CPose2D &angularDistPivotPoint, mrpt::tfest::TMatchingPairList &correspondences, float &correspondencesRatio, float *sumSqrDist=nullptr, bool onlyKeepTheClosest=false, bool onlyUniqueRobust=false) const
virtual void auxParticleFilterCleanUp() override
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::...
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
Each one of the measurements.
bool insert_Landmarks_from_range_scans
If set to true (default), inserting a CObservation2DRangeScan in the map will generate landmarks for ...
double computeLikelihood_RSLC_2007(const CLandmarksMap *s, const mrpt::poses::CPose2D &sensorPose)
Computes the (logarithmic) likelihood function for a sensed observation "o" according to "this" map...
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
CLandmark * get(unsigned int indx)
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
float maxEDD_TH
Maximum Euclidean Distance Between SIFT Descriptors.
bool saveToMATLABScript2D(std::string file, const char *style="b", float stdCount=2.0f)
Save to a MATLAB script which displays 2D error ellipses for the map (top-view, projection on the XY ...
internal::TSequenceLandmarks::const_iterator const_iterator
void simulateRangeBearingReadings(const mrpt::poses::CPose3D &robotPose, const mrpt::poses::CPose3D &sensorLocationOnRobot, mrpt::obs::CObservationBearingRange &observations, bool sensorDetectsIDs=true, const float stdRange=0.01f, const float stdYaw=mrpt::DEG2RAD(0.1f), const float stdPitch=mrpt::DEG2RAD(0.1f), std::vector< size_t > *real_associations=nullptr, const double spurious_count_mean=0, const double spurious_count_std=0) const
Simulates a noisy bearing-range observation of all the beacons (landamrks with type glBeacon) in the ...
A especial case: this is not an image feature, but a 2D/3D beacon (used for range-only SLAM from mrpt...
bool validCovariances
True: The individual 3x3 covariance matrices must be taken into account, false (default): All the mea...
TCustomSequenceLandmarks()
Default constructor.
bool saveToMATLABScript3D(std::string file, const char *style="b", float confInterval=0.95f) const
Save to a MATLAB script which displays 3D error ellipses for the map.
struct mrpt::maps::CLandmarksMap::TLikelihoodOptions::TGPSOrigin GPSOrigin
mrpt::math::TPoint3D pose_mean
The mean of the landmark 3D position.
float SIFTs_epipolar_TH
Maximum distance (in pixels) from a point to a certain epipolar line to be considered a potential mat...
void projectMatchedFeatures(const CMatchedFeatureList &matches, const mrpt::img::TStereoCamera &stereo_camera, std::vector< mrpt::math::TPoint3D > &out_points)
TMatchingMethod matching_method
Matching method.
This class stores messages from GNSS or GNSS+IMU devices, from consumer-grade inexpensive GPS receive...
float SiftLikelihoodThreshold
[For SIFT landmarks only] The minimum likelihood value of a match to set as correspondence (Default=0...
unsigned __int32 uint32_t
mrpt::vision::CFeatureExtraction::TOptions SIFT_feat_options
Parameters of the SIFT feature detector/descriptors while inserting images in the landmark map...
float sensor_std_range
Taken into account only if validCovariances=false: the standard deviation of the sensor noise model f...
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
void insert(const CRenderizable::Ptr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport)...
mrpt::img::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras...
Functions for estimating the optimal transformation between two frames of references given measuremen...
double ang
These 3 params allow rotating and shifting GPS coordinates with other 2D maps (e.g.
GLenum const GLfloat * params
void computeMatchingWith3DLandmarks(const mrpt::maps::CLandmarksMap *otherMap, mrpt::tfest::TMatchingPairList &correspondences, float &correspondencesRatio, std::vector< bool > &otherCorrespondences) const
Perform a search for correspondences between "this" and another lansmarks map: In this class...
const Scalar * const_iterator
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
float SiftCorrRatioThreshold
[For SIFT landmarks only] The ratio between the best and second best descriptor distances to set as c...
bool isEmpty() const override
Returns true if the map is empty/no observation has been inserted.
void isToBeModified(unsigned int indx)
uint32_t seenTimesCount
The number of times that this landmark has been seen.
double SIFTs_sigma_euclidean_dist
mrpt::math::TPoint3D pixelTo3D(const mrpt::img::TPixelCoordf &xy, const mrpt::math::CMatrixDouble33 &A)
Extract a UNITARY 3D vector in the direction of a 3D point, given from its (x,y) pixels coordinates...
struct mrpt::maps::CLandmarksMap::TCustomSequenceLandmarks landmarks
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
void loadOccupancyFeaturesFrom2DRangeScan(const mrpt::obs::CObservation2DRangeScan &obs, const mrpt::poses::CPose3D *robotPose=nullptr, unsigned int downSampleFactor=1)
Loads into this landmarks-map a set of occupancy features according to a 2D range scan (Previous cont...
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
mrpt::img::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
unsigned int min_sat
Minimum number of sats to take into account the data.
A gaussian distribution for 3D points.
float GPS_sigma
A constant "sigma" for GPS localization data (in meters)
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams ¶ms) const override
Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose" In the case of a multi-metric map, this returns the average between the maps.
double SIFTs_sigma_descriptor_dist
A class for storing images as grayscale or RGB bitmaps.
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise.
float stdDisp
Standard deviation of the error in disparity computation.
TLandmarkID ID
An ID for the landmark (see details next...) This ID was introduced in the version 3 of this class (2...
TMeasurementList sensedData
The list of observed ranges:
double drawGaussian1D_normalized()
Generate a normalized (mean=0, std=1) normally distributed sample.
mrpt::math::CMatrixDouble33 K
Intrinsic parameters.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
mrpt::maps::CLandmarksMap::TLikelihoodOptions likelihoodOptions
unsigned int SIFTMatching3DMethod
[For SIFT landmarks only] Method to compute 3D matching (Default = 0 (Our method)) 0: Our method -> E...