summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/common-cc/path.hh
diff options
context:
space:
mode:
authorOlivier Lanneluc2013-05-02 23:30:24 +0200
committerNicolas Schodet2013-05-03 23:07:14 +0200
commit53534d968ac93bc8d908c3a7e80c0afd26baa15b (patch)
tree3846850ed5ec5d29d0df3a7b11ad54e041a16607 /digital/io-hub/src/common-cc/path.hh
parent9c76e84a63d87a2806581265eeee02fe9f1bb523 (diff)
digital/io-hub/src/common-cc/path.cc: new way to allow robot to target the cake
Remove the parameter force_move in method set_endpoint, add it in the structure obstacle_t, and set it to true statically for the cake obstacle, false for the other ones.
Diffstat (limited to 'digital/io-hub/src/common-cc/path.hh')
-rw-r--r--digital/io-hub/src/common-cc/path.hh14
1 files changed, 7 insertions, 7 deletions
diff --git a/digital/io-hub/src/common-cc/path.hh b/digital/io-hub/src/common-cc/path.hh
index e683b83a..1232cda1 100644
--- a/digital/io-hub/src/common-cc/path.hh
+++ b/digital/io-hub/src/common-cc/path.hh
@@ -38,6 +38,10 @@ typedef struct path_obstacle_t
vect_t c;
/** Radius. */
uint16_t r;
+ /** Allow the robot to target the obstacle
+ * in order to go in front of it, while stopping
+ * at a given distance, before the collision happens */
+ bool target_allowed;
} path_obstacle_t;
typedef uint16_t weight_t;
@@ -51,9 +55,9 @@ class Path
/** Reset path computation, remove every obstacles */
void reset(void);
/** Set a moving obstacle position, radius and factor*/
- void obstacle(int index, const vect_t &c, uint16_t r, int f = 0);
+ void obstacle(const int index, const vect_t &c, const uint16_t r, const int f = 0, const bool target = false);
/** Set path source and destination */
- void endpoints(const vect_t &src, const vect_t &dst, const bool force_move=false);
+ void endpoints(const vect_t &src, const vect_t &dst);
/** Compute path with the given escape factor */
void compute(weight_t escape = 0);
/** Return a point vector by index */
@@ -73,7 +77,7 @@ class Path
private:
/** Add an obstacle on the field */
- void add_obstacle(const vect_t &c, uint16_t r, const int nodes, const int nlayers, const uint16_t clearance);
+ void add_obstacle(const vect_t &c, uint16_t r, const int nodes, const int nlayers, const uint16_t clearance, const bool target);
/** Number of possible obstacles. */
static const int PATH_OBSTACLES_NB = (4+1/*cake*/);
@@ -120,10 +124,6 @@ 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