added new helper methods to work with ground-truth

made some assertions optional [i know what i am doing!]
This commit is contained in:
2017-03-24 11:20:29 +01:00
parent c0cef979bb
commit e34e773e31
5 changed files with 52 additions and 10 deletions

View File

@@ -197,7 +197,7 @@ namespace Floorplan {
using FloorPOIs = std::vector<POI*>;
using FloorStairs = std::vector<Stair*>;
using FloorElevators = std::vector<Elevator*>;
using FloorGroundTruthPoints = std::vector<GroundTruthPoint*>;
using FloorGroundTruthPoints = std::vector<GroundTruthPoint*>;
/** describes one floor within the map, starting at a given height */
struct Floor {
@@ -215,7 +215,7 @@ namespace Floorplan {
FloorPOIs pois; // POIs within the floor
FloorStairs stairs; // all stairs within one floor
FloorElevators elevators; // all elevators within one floor
FloorGroundTruthPoints gtpoints; // all ground truth points within one floor
FloorGroundTruthPoints gtpoints; // all ground truth points within one floor
//FloorKeyValue other; // other, free elements
Floor() {;}
@@ -251,9 +251,10 @@ namespace Floorplan {
/** a GroundTruthPoint located somewhere on a floor */
struct GroundTruthPoint {
int id; //TODO: this value can be changed and isn't set incremental within the indoormap
Point3 pos;
Point3 pos; // TODO: splint into 2D position + float for "heightAboveGround" [waypoints' height is relative to the floor's height!
GroundTruthPoint() : id(), pos() {;}
GroundTruthPoint(const int& id, const Point3& pos) : id(id), pos(pos) {;}
const Point3 getPosition(const Floor& f) const {return pos + Point3(0,0,f.atHeight);}
bool operator == (const GroundTruthPoint& o) const {return (o.id == id) && (o.pos == pos);}
};

View File

@@ -87,7 +87,7 @@ namespace Floorplan {
if (diff < 0.1) {++numNear;} else {++numFar;}
}
if ((numNear + numFar) > 150000) {
Assert::isTrue(numNear < numFar*0.1,
Assert::isTrue(numNear < numFar*0.15,
"many requests to Floorplan::Ceilings::numCeilingsBetween address nodes (very) near to a ground! \
due to rounding issues, determining the number of floors between AP and point-in-question is NOT possible! \
expect very wrong outputs! \

View File

@@ -40,6 +40,31 @@ public:
return res;
}
/** get all ground-truth points within the map as hash-map: id->pos */
static std::unordered_map<int, Point3> getGroundTruthPoints(const Floorplan::IndoorMap* map) {
std::unordered_map<int, Point3> res;
for (const Floorplan::Floor* f : map->floors) {
for (const Floorplan::GroundTruthPoint* gtp : f->gtpoints) {
res[gtp->id] = gtp->getPosition(*f);
}
}
return res;
}
/** get all ground-truth points, identified by the given indices */
static std::vector<Point3> getGroundTruth(const Floorplan::IndoorMap* map, const std::vector<int> indices) {
// get a map id->pos for all ground-truth-points within the map
const std::unordered_map<int, Point3> src = getGroundTruthPoints(map);
std::vector<Point3> res;
for (const int idx : indices) {
const auto& it = src.find(idx);
if (it == src.end()) {throw Exception("map does not contain a ground-truth-point with ID " + std::to_string(idx));}
res.push_back(it->second);
}
return res;
}
public:
/** align all floorplan values to the given grid size. needed for the grid factory */