summaryrefslogtreecommitdiff
path: root/digital/io-hub/src/common-cc/path.hh
diff options
context:
space:
mode:
authorOlivier Lanneluc2013-04-16 18:06:12 +0200
committerNicolas Schodet2013-04-27 00:22:06 +0200
commitfa5eaa43b492c6fad8675de3542918c492770eb6 (patch)
tree6a9028f338f0f30a9b194594bf6166078198377f /digital/io-hub/src/common-cc/path.hh
parent8f63fa287cf35d7c960ce8d2ec4fc3a498967d17 (diff)
Add possibility for multiple navigation points layers
Diffstat (limited to 'digital/io-hub/src/common-cc/path.hh')
-rw-r--r--digital/io-hub/src/common-cc/path.hh18
1 files changed, 11 insertions, 7 deletions
diff --git a/digital/io-hub/src/common-cc/path.hh b/digital/io-hub/src/common-cc/path.hh
index 61326aac..ad283492 100644
--- a/digital/io-hub/src/common-cc/path.hh
+++ b/digital/io-hub/src/common-cc/path.hh
@@ -6,7 +6,7 @@
// Copyright (C) 2013 Olivier Lanneluc
//
// APBTeam:
-// Web: http://apbteam.org/
+// Web: http://apbteam.org/
// Email: team AT apbteam DOT org
//
// This program is free software; you can redistribute it and/or modify
@@ -52,7 +52,7 @@ class Path
/** Set path source and destination */
void endpoints(const vect_t &src, const vect_t &dst);
/** Compute path with the given escape factor */
- void compute(int escape = 0);
+ void compute(uint16_t escape = 0);
/** Return a point vector by index */
vect_t& get_point_vect(const int index);
/** Return a point index */
@@ -63,14 +63,14 @@ class Path
/** Find all neighbors of a given node, fill the astar_neighbor structure */
int find_neighbors(int node, struct astar_neighbor_t *neighbors);
/** Prepare score computation for the given source, with given escape factor */
- void prepare_score(const vect_t &src, int escape = 0);
+ void prepare_score(const vect_t &src, uint16_t escape = 0);
/** Return score for a given destination, using a previous preparation
(also reuse previously given escape factor) */
uint16_t get_score(const vect_t &dst);
private:
/** Add an obstacle on the field */
- void add_obstacle(const vect_t &c, uint16_t r, int nodes);
+ void add_obstacle(const vect_t &c, uint16_t r, const int nodes);
/** Number of possible obstacles. */
static const int PATH_OBSTACLES_NB = (4+1/*cake*/);
@@ -80,21 +80,25 @@ class Path
static const int PATH_CAKE_NAVPOINTS_NB = 14;
/** Number of reserved points for the 2 endpoints */
static const int PATH_RESERVED_NAVPOINTS_NB = 2;
+ /** Number of navigation points layers for each obstacle. */
+ static const int PATH_NAVPOINTS_LAYERS = 2;
/** Number of points. */
static const int PATH_NAVPOINTS_NB = (PATH_RESERVED_NAVPOINTS_NB +
- (PATH_OBSTACLES_NB * PATH_OBSTACLES_NAVPOINTS_NB) +
- (PATH_CAKE_NAVPOINTS_NB - PATH_OBSTACLES_NAVPOINTS_NB));
+ PATH_NAVPOINTS_LAYERS * (PATH_OBSTACLES_NB * PATH_OBSTACLES_NAVPOINTS_NB) +
+ PATH_NAVPOINTS_LAYERS * (PATH_CAKE_NAVPOINTS_NB - PATH_OBSTACLES_NAVPOINTS_NB));
/** Borders, any point outside borders is eliminated. */
const uint16_t border_xmin, border_ymin, border_xmax, border_ymax;
/** Escape factor, 0 if none. */
- int escape_factor;
+ uint16_t escape_factor;
/** List of obstacles. */
path_obstacle_t obstacles[PATH_OBSTACLES_NB];
/** Number of obstacles */
int obstacles_nb;
/** List of navigation points coordonates */
vect_t navpoints[PATH_NAVPOINTS_NB];
+ /** List of navigation points weights */
+ uint16_t navweights[PATH_NAVPOINTS_NB];
/** Number of navigation points */
int navpoints_nb;
/** List of nodes used for A*. */