summaryrefslogtreecommitdiff
path: root/digital/io-hub/src/common-cc/path.hh
diff options
context:
space:
mode:
authorOlivier Lanneluc2013-04-18 02:59:36 +0200
committerNicolas Schodet2013-04-27 00:23:24 +0200
commit4e67c3e2e763eab19d253fad78331a0b4ac6625a (patch)
tree7e40faee5e6172a0c7f3cdd26e6fcfe409ed011d /digital/io-hub/src/common-cc/path.hh
parentf2067b32e290f27fd891bb69e02f71d7226062e0 (diff)
digital/io-hub/src/common-cc: allow robot to target an obstacle (the cake)
Diffstat (limited to 'digital/io-hub/src/common-cc/path.hh')
-rw-r--r--digital/io-hub/src/common-cc/path.hh15
1 files changed, 12 insertions, 3 deletions
diff --git a/digital/io-hub/src/common-cc/path.hh b/digital/io-hub/src/common-cc/path.hh
index 4a3cb072..8003f32b 100644
--- a/digital/io-hub/src/common-cc/path.hh
+++ b/digital/io-hub/src/common-cc/path.hh
@@ -25,6 +25,7 @@
//
// }}}
#include "defs.hh"
+#include "playground_2013.hh"
extern "C" {
#include "modules/path/astar/astar.h"
@@ -52,7 +53,7 @@ class Path
/** Set a moving obstacle position, radius and factor*/
void obstacle(int index, const vect_t &c, uint16_t r, int f = 0);
/** Set path source and destination */
- void endpoints(const vect_t &src, const vect_t &dst);
+ void endpoints(const vect_t &src, const vect_t &dst, const bool force_move=false);
/** Compute path with the given escape factor */
void compute(weight_t escape = 0);
/** Return a point vector by index */
@@ -78,16 +79,20 @@ class Path
static const int PATH_OBSTACLES_NB = (4+1/*cake*/);
/** Number of points per standard obstacle. */
static const int PATH_OBSTACLES_NAVPOINTS_NB = 8;
+#ifdef playground_2013_hh
/** Number of points for the cake */
static const int PATH_CAKE_NAVPOINTS_NB = 14;
+#endif
/** 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 navigation points. */
static const int PATH_NAVPOINTS_NB = (PATH_RESERVED_NAVPOINTS_NB +
- PATH_NAVPOINTS_LAYERS * (PATH_OBSTACLES_NB * PATH_OBSTACLES_NAVPOINTS_NB) +
- PATH_NAVPOINTS_LAYERS * (PATH_CAKE_NAVPOINTS_NB - PATH_OBSTACLES_NAVPOINTS_NB));
+#ifdef playground_2013_hh
+ PATH_NAVPOINTS_LAYERS * (PATH_CAKE_NAVPOINTS_NB - PATH_OBSTACLES_NAVPOINTS_NB) +
+#endif
+ PATH_NAVPOINTS_LAYERS * (PATH_OBSTACLES_NB * PATH_OBSTACLES_NAVPOINTS_NB));
/** Navigation points weight precision (2^-n). */
static const int PATH_WEIGHT_PRECISION = 4;
/** Navigation points weight step (2^-n). */
@@ -113,6 +118,10 @@ class Path
int next_node;
/** TRUE when a path has been found */
bool path_found;
+ /** TRUE to allow last movement to enter an obstacle
+ * This may be used to target the center of an obstacle
+ * and stop closed to it */
+ bool force_move;
};
#endif // path_hh