From 4c9fd5ccdee7a024806f8dda85afeb9a4b41650a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez=20Antequera?= Date: Thu, 16 Jan 2014 13:48:00 +0100 Subject: [PATCH 1/4] New insertion option noInvalidPoints. If true, points with x,y,z coordinates set to zero will also be inserted --- libs/maps/include/mrpt/slam/CPointsMap.h | 1 + libs/maps/src/maps/CColouredPointsMap.cpp | 8 +++++++- libs/maps/src/maps/CPointsMap.cpp | 7 ++++++- libs/maps/src/maps/CPointsMap_crtp_common.h | 2 +- libs/maps/src/maps/CSimplePointsMap.cpp | 8 +++++++- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/libs/maps/include/mrpt/slam/CPointsMap.h b/libs/maps/include/mrpt/slam/CPointsMap.h index 75592d7140..66d1eaae45 100644 --- a/libs/maps/include/mrpt/slam/CPointsMap.h +++ b/libs/maps/include/mrpt/slam/CPointsMap.h @@ -181,6 +181,7 @@ namespace slam bool isPlanarMap; //!< If set to true, only HORIZONTAL (in the XY plane) measurements will be inserted in the map (Default value is false, thus 3D maps are generated). \sa horizontalTolerance float horizontalTolerance; //!< The tolerance in rads in pitch & roll for a laser scan to be considered horizontal, considered only when isPlanarMap=true (default=0). float maxDistForInterpolatePoints; //!< The maximum distance between two points to interpolate between them (ONLY when also_interpolate=true) + bool noInvalidPoints; //!< Points with x,y,z coordinates set to zero will also be inserted }; diff --git a/libs/maps/src/maps/CColouredPointsMap.cpp b/libs/maps/src/maps/CColouredPointsMap.cpp index 79bb170af8..ff8955ce8c 100644 --- a/libs/maps/src/maps/CColouredPointsMap.cpp +++ b/libs/maps/src/maps/CColouredPointsMap.cpp @@ -119,7 +119,7 @@ void CColouredPointsMap::copyFrom(const CPointsMap &obj) void CColouredPointsMap::writeToStream(CStream &out, int *version) const { if (version) - *version = 7; + *version = 8; else { uint32_t n = x.size(); @@ -156,6 +156,9 @@ void CColouredPointsMap::writeToStream(CStream &out, int *version) const // V5: likelihoodOptions.writeToStream(out); + + // Added in version 8: + out << insertionOptions.horizontalTolerance; } } @@ -270,6 +273,9 @@ void CColouredPointsMap::readFromStream(CStream &in, int version) if (version>=5) // version 5: added likelihoodOptions likelihoodOptions.readFromStream(in); + if (version>=8) // version 8: added noInvalidPoints + in >> insertionOptions.noInvalidPoints; + } break; default: MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version) diff --git a/libs/maps/src/maps/CPointsMap.cpp b/libs/maps/src/maps/CPointsMap.cpp index d570ccf620..61d188b4c9 100644 --- a/libs/maps/src/maps/CPointsMap.cpp +++ b/libs/maps/src/maps/CPointsMap.cpp @@ -612,7 +612,8 @@ CPointsMap::TInsertionOptions::TInsertionOptions() : fuseWithExisting ( false), isPlanarMap ( false), horizontalTolerance ( DEG2RAD(0.05) ), - maxDistForInterpolatePoints ( 2.0f ) + maxDistForInterpolatePoints ( 2.0f ), + noInvalidPoints ( false) { } @@ -664,6 +665,8 @@ void CPointsMap::TInsertionOptions::dumpToTextStream(CStream &out) const LOADABLEOPTS_DUMP_VAR(fuseWithExisting,bool); LOADABLEOPTS_DUMP_VAR(isPlanarMap,bool); + LOADABLEOPTS_DUMP_VAR(noInvalidPoints,bool); + out.printf("\n"); } @@ -693,6 +696,8 @@ void CPointsMap::TInsertionOptions::loadFromConfigFile( MRPT_LOAD_CONFIG_VAR(isPlanarMap, bool, iniFile,section); MRPT_LOAD_CONFIG_VAR(maxDistForInterpolatePoints, float, iniFile,section); + + MRPT_LOAD_CONFIG_VAR(noInvalidPoints,bool, iniFile,section); } void CPointsMap::TLikelihoodOptions::loadFromConfigFile( diff --git a/libs/maps/src/maps/CPointsMap_crtp_common.h b/libs/maps/src/maps/CPointsMap_crtp_common.h index 45431a8093..9dbf2383a5 100644 --- a/libs/maps/src/maps/CPointsMap_crtp_common.h +++ b/libs/maps/src/maps/CPointsMap_crtp_common.h @@ -352,7 +352,7 @@ namespace detail for (size_t i=0;i=5) // version 5: added likelihoodOptions likelihoodOptions.readFromStream(in); + if (version>=8) // version 8: added noInvalidPoints + in >> insertionOptions.noInvalidPoints; + } break; default: MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version) From 0a01bfcde9ab9c30e13b71e52e5e7927fa56666b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez=20Antequera?= Date: Fri, 17 Jan 2014 10:47:38 +0100 Subject: [PATCH 2/4] Fixed one of the new lines from the last commit. --- libs/maps/src/maps/CColouredPointsMap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/maps/src/maps/CColouredPointsMap.cpp b/libs/maps/src/maps/CColouredPointsMap.cpp index ff8955ce8c..f9693454f9 100644 --- a/libs/maps/src/maps/CColouredPointsMap.cpp +++ b/libs/maps/src/maps/CColouredPointsMap.cpp @@ -158,7 +158,7 @@ void CColouredPointsMap::writeToStream(CStream &out, int *version) const likelihoodOptions.writeToStream(out); // Added in version 8: - out << insertionOptions.horizontalTolerance; + out << insertionOptions.noInvalidPoints; } } From 7a81f4781229940c52c96aed57b4419ea3fe3fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez=20Antequera?= Date: Fri, 17 Jan 2014 10:47:38 +0100 Subject: [PATCH 3/4] Fixed some lines from the last commit. --- libs/maps/src/maps/CColouredPointsMap.cpp | 2 +- libs/maps/src/maps/CSimplePointsMap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/maps/src/maps/CColouredPointsMap.cpp b/libs/maps/src/maps/CColouredPointsMap.cpp index ff8955ce8c..f9693454f9 100644 --- a/libs/maps/src/maps/CColouredPointsMap.cpp +++ b/libs/maps/src/maps/CColouredPointsMap.cpp @@ -158,7 +158,7 @@ void CColouredPointsMap::writeToStream(CStream &out, int *version) const likelihoodOptions.writeToStream(out); // Added in version 8: - out << insertionOptions.horizontalTolerance; + out << insertionOptions.noInvalidPoints; } } diff --git a/libs/maps/src/maps/CSimplePointsMap.cpp b/libs/maps/src/maps/CSimplePointsMap.cpp index 6062687e8a..b340947c41 100644 --- a/libs/maps/src/maps/CSimplePointsMap.cpp +++ b/libs/maps/src/maps/CSimplePointsMap.cpp @@ -121,7 +121,7 @@ void CSimplePointsMap::writeToStream(CStream &out, int *version) const likelihoodOptions.writeToStream(out); // Added in version 8: - out << insertionOptions.horizontalTolerance; + out << insertionOptions.noInvalidPoints; } } From bc36db789d03cf110cec27ad128694385f9de271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez=20Antequera?= Date: Fri, 17 Jan 2014 12:33:49 +0100 Subject: [PATCH 4/4] Renamed 'noInvalidPoints' to 'insertInvalidPoints' --- libs/maps/include/mrpt/slam/CPointsMap.h | 2 +- libs/maps/src/maps/CColouredPointsMap.cpp | 6 +++--- libs/maps/src/maps/CPointsMap.cpp | 6 +++--- libs/maps/src/maps/CPointsMap_crtp_common.h | 2 +- libs/maps/src/maps/CSimplePointsMap.cpp | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/maps/include/mrpt/slam/CPointsMap.h b/libs/maps/include/mrpt/slam/CPointsMap.h index 66d1eaae45..e3f061cc89 100644 --- a/libs/maps/include/mrpt/slam/CPointsMap.h +++ b/libs/maps/include/mrpt/slam/CPointsMap.h @@ -181,7 +181,7 @@ namespace slam bool isPlanarMap; //!< If set to true, only HORIZONTAL (in the XY plane) measurements will be inserted in the map (Default value is false, thus 3D maps are generated). \sa horizontalTolerance float horizontalTolerance; //!< The tolerance in rads in pitch & roll for a laser scan to be considered horizontal, considered only when isPlanarMap=true (default=0). float maxDistForInterpolatePoints; //!< The maximum distance between two points to interpolate between them (ONLY when also_interpolate=true) - bool noInvalidPoints; //!< Points with x,y,z coordinates set to zero will also be inserted + bool insertInvalidPoints; //!< Points with x,y,z coordinates set to zero will also be inserted }; diff --git a/libs/maps/src/maps/CColouredPointsMap.cpp b/libs/maps/src/maps/CColouredPointsMap.cpp index f9693454f9..5240382d4c 100644 --- a/libs/maps/src/maps/CColouredPointsMap.cpp +++ b/libs/maps/src/maps/CColouredPointsMap.cpp @@ -158,7 +158,7 @@ void CColouredPointsMap::writeToStream(CStream &out, int *version) const likelihoodOptions.writeToStream(out); // Added in version 8: - out << insertionOptions.noInvalidPoints; + out << insertionOptions.insertInvalidPoints; } } @@ -273,8 +273,8 @@ void CColouredPointsMap::readFromStream(CStream &in, int version) if (version>=5) // version 5: added likelihoodOptions likelihoodOptions.readFromStream(in); - if (version>=8) // version 8: added noInvalidPoints - in >> insertionOptions.noInvalidPoints; + if (version>=8) // version 8: added insertInvalidPoints + in >> insertionOptions.insertInvalidPoints; } break; default: diff --git a/libs/maps/src/maps/CPointsMap.cpp b/libs/maps/src/maps/CPointsMap.cpp index 61d188b4c9..f0acc49134 100644 --- a/libs/maps/src/maps/CPointsMap.cpp +++ b/libs/maps/src/maps/CPointsMap.cpp @@ -613,7 +613,7 @@ CPointsMap::TInsertionOptions::TInsertionOptions() : isPlanarMap ( false), horizontalTolerance ( DEG2RAD(0.05) ), maxDistForInterpolatePoints ( 2.0f ), - noInvalidPoints ( false) + insertInvalidPoints ( false) { } @@ -665,7 +665,7 @@ void CPointsMap::TInsertionOptions::dumpToTextStream(CStream &out) const LOADABLEOPTS_DUMP_VAR(fuseWithExisting,bool); LOADABLEOPTS_DUMP_VAR(isPlanarMap,bool); - LOADABLEOPTS_DUMP_VAR(noInvalidPoints,bool); + LOADABLEOPTS_DUMP_VAR(insertInvalidPoints,bool); out.printf("\n"); } @@ -697,7 +697,7 @@ void CPointsMap::TInsertionOptions::loadFromConfigFile( MRPT_LOAD_CONFIG_VAR(maxDistForInterpolatePoints, float, iniFile,section); - MRPT_LOAD_CONFIG_VAR(noInvalidPoints,bool, iniFile,section); + MRPT_LOAD_CONFIG_VAR(insertInvalidPoints,bool, iniFile,section); } void CPointsMap::TLikelihoodOptions::loadFromConfigFile( diff --git a/libs/maps/src/maps/CPointsMap_crtp_common.h b/libs/maps/src/maps/CPointsMap_crtp_common.h index 9dbf2383a5..f23eed536e 100644 --- a/libs/maps/src/maps/CPointsMap_crtp_common.h +++ b/libs/maps/src/maps/CPointsMap_crtp_common.h @@ -352,7 +352,7 @@ namespace detail for (size_t i=0;i=5) // version 5: added likelihoodOptions likelihoodOptions.readFromStream(in); - if (version>=8) // version 8: added noInvalidPoints - in >> insertionOptions.noInvalidPoints; + if (version>=8) // version 8: added insertInvalidPoints + in >> insertionOptions.insertInvalidPoints; } break; default: