summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/common-cc
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io-hub/src/common-cc')
-rw-r--r--digital/io-hub/src/common-cc/path.cc8
-rw-r--r--digital/io-hub/src/common-cc/path.hh11
2 files changed, 9 insertions, 10 deletions
diff --git a/digital/io-hub/src/common-cc/path.cc b/digital/io-hub/src/common-cc/path.cc
index 151eedd0..411ce9de 100644
--- a/digital/io-hub/src/common-cc/path.cc
+++ b/digital/io-hub/src/common-cc/path.cc
@@ -56,12 +56,6 @@ extern "C" {
#define PATH_IN_CIRCLE(pOINT, cENTER, rADIUS) \
(distance_point_point((pOINT), (cENTER)) <= (rADIUS))
-/** Static nodes index for the endpoints */
-enum {
- PATH_NAVPOINT_SRC_IDX = 0,
- PATH_NAVPOINT_DST_IDX
-};
-
static int32_t pos_dot_product(vect_t* pa, vect_t* pb, vect_t* pc, vect_t* pd)
{
vect_t vab = *pb; vect_sub(&vab, pa);
@@ -287,7 +281,7 @@ void Path::compute(weight_t escape)
if (path_found)
{
/* Store next node to go to */
- next_node = astar_nodes[0].prev;
+ next_node = astar_nodes[PATH_NAVPOINT_SRC_IDX].prev;
#ifdef PATH_DEBUG
/* Log and display the path found */
diff --git a/digital/io-hub/src/common-cc/path.hh b/digital/io-hub/src/common-cc/path.hh
index 1232cda1..28b5a8d8 100644
--- a/digital/io-hub/src/common-cc/path.hh
+++ b/digital/io-hub/src/common-cc/path.hh
@@ -31,6 +31,13 @@ extern "C" {
#include "modules/path/astar/astar.h"
}
+/** Static nodes index for the endpoints */
+enum {
+ PATH_NAVPOINT_SRC_IDX = 0,
+ PATH_NAVPOINT_DST_IDX,
+ PATH_RESERVED_NAVPOINTS_NB
+};
+
/** Obstacle */
typedef struct path_obstacle_t
{
@@ -87,8 +94,6 @@ class Path
/** 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 the cake. */
static const int PATH_CAKE_NAVPOINTS_LAYERS = 1;
/** Number of navigation points layers for each obstacle. */
@@ -121,7 +126,7 @@ class Path
/** List of nodes used for A*. */
struct astar_node_t astar_nodes[PATH_NAVPOINTS_NB];
/** Which node to look at for next step. */
- int next_node;
+ uint8_t next_node;
/** TRUE when a path has been found */
bool path_found;
};