Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new insertionOptions: 'noInvalidPoints' #8

Merged
merged 5 commits into from
Jan 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/maps/include/mrpt/slam/CPointsMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 insertInvalidPoints; //!< Points with x,y,z coordinates set to zero will also be inserted

};

Expand Down
8 changes: 7 additions & 1 deletion libs/maps/src/maps/CColouredPointsMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -156,6 +156,9 @@ void CColouredPointsMap::writeToStream(CStream &out, int *version) const

// V5:
likelihoodOptions.writeToStream(out);

// Added in version 8:
out << insertionOptions.insertInvalidPoints;
}
}

Expand Down Expand Up @@ -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 insertInvalidPoints
in >> insertionOptions.insertInvalidPoints;

} break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
Expand Down
7 changes: 6 additions & 1 deletion libs/maps/src/maps/CPointsMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ CPointsMap::TInsertionOptions::TInsertionOptions() :
fuseWithExisting ( false),
isPlanarMap ( false),
horizontalTolerance ( DEG2RAD(0.05) ),
maxDistForInterpolatePoints ( 2.0f )
maxDistForInterpolatePoints ( 2.0f ),
insertInvalidPoints ( false)
{
}

Expand Down Expand Up @@ -664,6 +665,8 @@ void CPointsMap::TInsertionOptions::dumpToTextStream(CStream &out) const
LOADABLEOPTS_DUMP_VAR(fuseWithExisting,bool);
LOADABLEOPTS_DUMP_VAR(isPlanarMap,bool);

LOADABLEOPTS_DUMP_VAR(insertInvalidPoints,bool);

out.printf("\n");
}

Expand Down Expand Up @@ -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(insertInvalidPoints,bool, iniFile,section);
}

void CPointsMap::TLikelihoodOptions::loadFromConfigFile(
Expand Down
2 changes: 1 addition & 1 deletion libs/maps/src/maps/CPointsMap_crtp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ namespace detail
for (size_t i=0;i<sizeRangeScan;i++)
{
// Valid point?
if ( rangeScan.points3D_x[i]!=0 || rangeScan.points3D_y[i]!=0 || rangeScan.points3D_z[i]!=0 )
if ( rangeScan.points3D_x[i]!=0 || rangeScan.points3D_y[i]!=0 || rangeScan.points3D_z[i]!=0 || obj.insertionOptions.insertInvalidPoints)
{
lric.scan_x = rangeScan.points3D_x[i];
lric.scan_y = rangeScan.points3D_y[i];
Expand Down
8 changes: 7 additions & 1 deletion libs/maps/src/maps/CSimplePointsMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void CSimplePointsMap::copyFrom(const CPointsMap &obj)
void CSimplePointsMap::writeToStream(CStream &out, int *version) const
{
if (version)
*version = 7;
*version = 8;
else
{
uint32_t n = x.size();
Expand Down Expand Up @@ -119,6 +119,9 @@ void CSimplePointsMap::writeToStream(CStream &out, int *version) const

// Added in version 5:
likelihoodOptions.writeToStream(out);

// Added in version 8:
out << insertionOptions.insertInvalidPoints;
}
}

Expand Down Expand Up @@ -211,6 +214,9 @@ void CSimplePointsMap::readFromStream(CStream &in, int version)
if (version>=5) // version 5: added likelihoodOptions
likelihoodOptions.readFromStream(in);

if (version>=8) // version 8: added insertInvalidPoints
in >> insertionOptions.insertInvalidPoints;

} break;
default:
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version)
Expand Down