This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "krobot".
The branch, master has been updated
via 038fccc6bbf8b374593b12eb2bfd4cf793b8477e (commit)
from 1e3124e9a7bb03d9c9e7d2ba729a716f55d20488 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 038fccc6bbf8b374593b12eb2bfd4cf793b8477e
Author: Jérémie Dimino <je...@di...>
Date: Sat May 28 22:26:22 2011 +0200
[krobot_planner] remove the destination object from obstacles when planning a path
-----------------------------------------------------------------------
Changes:
diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml
index 32bcd4a..f68832d 100644
--- a/info/control2011/src/tools/krobot_planner.ml
+++ b/info/control2011/src/tools/krobot_planner.ml
@@ -127,6 +127,8 @@ let rec intersection va vb objects =
intersection va vb rest
let find_path planner src dst =
+ (* Remove the destination object from obstacles. *)
+ let objects = List.filter (fun obj -> distance dst obj >= object_radius) planner.objects in
(* Build bounding boxes. *)
let r1 = object_radius +. robot_size in
let r2 = object_radius +. robot_size *. 3. /. 4. in
@@ -151,7 +153,7 @@ let find_path planner src dst =
let set = add obj.x (obj.y +. r2) set in
let set = add (obj.x -. r2) obj.y set in
set)
- Vertice_set.empty planner.objects
+ Vertice_set.empty objects
in
(* Add the source and the destination. *)
let vertices = Vertice_set.add src (Vertice_set.add dst vertices) in
@@ -179,7 +181,7 @@ let find_path planner src dst =
let path, weight = Dijkstra.shortest_path graph src dst in
List.map (fun (a, b) -> b) path
with Not_found ->
- [dst]
+ []
(* +-----------------------------------------------------------------+
| Primitives |
hooks/post-receive
--
krobot
|