Merge branch 'master' of https://git.frank-ebner.de/FHWS/Indoor
This commit is contained in:
@@ -10,6 +10,12 @@ struct GridNodeImportance {
|
||||
/** get the node's nav importance */
|
||||
float getNavImportance() const {return navImportance;}
|
||||
|
||||
/** importance-weight for random walks */
|
||||
float walkImportance;
|
||||
|
||||
/** get the node's random-walk importance */
|
||||
float getWalkImportance() const {return walkImportance;}
|
||||
|
||||
/** ctor */
|
||||
GridNodeImportance() : navImportance(1.0f) {;}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
KNN<KNNArray<std::vector<T>>, 3> knnStairs(knnArrStairs);
|
||||
|
||||
// probability adjustments
|
||||
Distribution::Triangle<float> avoidWalls(0.0, 0.45f);
|
||||
Distribution::Triangle<float> avoidWalls(0.0, 0.35f);
|
||||
Distribution::Normal<float> favorDoors(0.0f, 0.4f);
|
||||
Distribution::Normal<float> favorStairs(0.0f, 1.5f);
|
||||
|
||||
@@ -111,8 +111,8 @@ public:
|
||||
// get the node
|
||||
T& n1 = g[i];
|
||||
|
||||
// get the distance to the nearest wall
|
||||
const float distToWall_m = Units::cmToM(knn.getNearestDistance( {n1.x_cm, n1.y_cm, n1.z_cm} ));
|
||||
// get the distance to the nearest outline node [an outline node is directly adjacent to a wall]
|
||||
const float distToOutline_m = Units::cmToM(knn.getNearestDistance( {n1.x_cm, n1.y_cm, n1.z_cm} ));
|
||||
|
||||
// get the distance to the nearest door
|
||||
const float distToDoor_m = Units::cmToM(knnDoors.getNearestDistance( {n1.x_cm, n1.y_cm, n1.z_cm} ));
|
||||
@@ -120,7 +120,13 @@ public:
|
||||
// get the distance to the nearest stair
|
||||
const float distToStair_m = Units::cmToM(knnStairs.getNearestDistance( {n1.x_cm, n1.y_cm, n1.z_cm} ));
|
||||
|
||||
const bool useNormal = (distToWall_m*3.5 < distToDoor_m && distToWall_m*3.5 < distToStair_m);
|
||||
// use wall-avoidance?
|
||||
//const bool useWallAvoidance = (distToWall_m*6.0 < distToDoor_m && distToWall_m*6.0 < distToStair_m);
|
||||
//const bool useWallAvoidance = (distToDoor_m > 0.4f) && (distToStair_m > 0.4f);
|
||||
const bool useWallAvoidance =
|
||||
(distToOutline_m < 0.001f) && // node is an outline node [outline-nodes are adjacent to a wall]
|
||||
(distToDoor_m > 0.3f) && // doors are 30cm away
|
||||
(distToStair_m > 0.6f); // stairs are 60cm away;
|
||||
|
||||
// final probability
|
||||
n1.walkImportance = 1.0f;
|
||||
@@ -128,18 +134,20 @@ public:
|
||||
n1.walkImportance += favorStairs.getProbability(distToStair_m) * 1.0f;
|
||||
|
||||
// use wall avoidance
|
||||
if (useNormal) {
|
||||
n1.walkImportance -= avoidWalls.getProbability(distToWall_m) * 0.4f;
|
||||
if (useWallAvoidance) {
|
||||
//n1.walkImportance -= avoidWalls.getProbability(distToWall_m) * 0.3f;
|
||||
n1.walkImportance = 0.20f; // only addresses direct outline nodes
|
||||
}
|
||||
|
||||
|
||||
// navigation importance is calculated using other formulae
|
||||
n1.navImportance = 1.0f;
|
||||
if (useNormal) {
|
||||
n1.navImportance -= avoidWalls.getProbability(distToWall_m) * 0.4;
|
||||
if (useWallAvoidance) {
|
||||
n1.navImportance -= avoidWalls.getProbability(distToOutline_m) * 0.3f;
|
||||
|
||||
}
|
||||
//n1.navImportance += favorDoors.getProbability(distToDoor_m) * 0.5;
|
||||
n1.navImportance += favorStairs.getProbability(distToStair_m) * 1.0;
|
||||
n1.navImportance += favorStairs.getProbability(distToStair_m) * 1.0f;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user