added new helper methods to work with ground-truth
made some assertions optional [i know what i am doing!]
This commit is contained in:
@@ -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);}
|
||||
};
|
||||
|
||||
|
||||
@@ -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! \
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -14,6 +14,9 @@ class WiFiModel {
|
||||
|
||||
public:
|
||||
|
||||
/** dtor */
|
||||
virtual ~WiFiModel() {;}
|
||||
|
||||
// /** get the given access-point's RSSI at the provided location */
|
||||
// virtual float getRSSI(const LocatedAccessPoint& ap, const Point3 p) = 0;
|
||||
|
||||
|
||||
@@ -71,21 +71,28 @@ public:
|
||||
|
||||
}
|
||||
|
||||
/** load AP information from the floorplan. use the given fixed TXP/EXP/WAF for all APs */
|
||||
void loadAPs(const Floorplan::IndoorMap* map, const VAPGrouper& vg, const float txp = -40.0f, const float exp = 2.5f, const float waf = -8.0f) {
|
||||
/**
|
||||
* load AP information from the floorplan.
|
||||
* use the given fixed TXP/EXP/WAF for all APs.
|
||||
* usually txp,exp,waf are checked for a sane range. if you know what you are doing, set assertSafe to false!
|
||||
*/
|
||||
void loadAPs(const Floorplan::IndoorMap* map, const VAPGrouper& vg, const float txp = -40.0f, const float exp = 2.5f, const float waf = -8.0f, const bool assertSafe = true) {
|
||||
|
||||
for (const Floorplan::Floor* floor : map->floors) {
|
||||
for (const Floorplan::AccessPoint* ap : floor->accesspoints) {
|
||||
const APEntry ape(ap->getPos(floor), txp, exp, waf);
|
||||
const MACAddress mac = vg.getBaseMAC(MACAddress(ap->mac));
|
||||
Log::add("WiModLDC", "AP: " + ap->mac + " -> " + mac.asString());
|
||||
addAP(MACAddress(mac), ape);
|
||||
Log::add("WiModLDC", "AP added! given: " + ap->mac + " -> after VAP: " + mac.asString());
|
||||
addAP(MACAddress(mac), ape, assertSafe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** make the given AP (and its parameters) known to the model */
|
||||
/**
|
||||
* make the given AP (and its parameters) known to the model
|
||||
* usually txp,exp,waf are checked for a sane range. if you know what you are doing, set assertSafe to false!
|
||||
*/
|
||||
void addAP(const MACAddress& accessPoint, const APEntry& params, const bool assertSafe = true) {
|
||||
|
||||
// sanity check
|
||||
@@ -126,7 +133,13 @@ public:
|
||||
const float wafLoss = params.waf * ceilings.numCeilingsBetween(position_m, params.position_m);
|
||||
|
||||
// combine
|
||||
return rssiLOS + wafLoss;
|
||||
const float res = rssiLOS + wafLoss;
|
||||
|
||||
// sanity check
|
||||
Assert::isNotNaN(res, "detected NaN within WiFiModelLogDistCeiling::getRSSI()");
|
||||
|
||||
// ok
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user