|
From: Xavier L. <Ba...@us...> - 2013-05-22 19:40:00
|
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 ce758846dbc2dfaf0e1d50ae203a0e955dc33aaf (commit)
via 295eeed1694fcd66c866a47adf80d185a5e006ed (commit)
via 1469f324204351a9fed364e7cd255536c1192bc2 (commit)
via 151f042d69b02a6f65a4ece42a5fb3bdba392546 (commit)
via 63aabe085353534abc4dba4d0ef0ffb5d04d1801 (commit)
via 3e283fa22033418ebf6c4d103c7e776301193f62 (commit)
via 4d0245d3a58ad206462f821ec5c3aeacc4b83ecb (commit)
via 31786065d863cf2d4aa07eb5cd7de558db72b4f0 (commit)
via c2c799d2a17fb401b88bc2849cc1f1841759486e (commit)
via c08a114cea56f74ab6b2f05c801ccc51298db979 (commit)
via 3bf0f7ea516321571c2aed4e4e7183643452575b (commit)
via 7dbe121c133f23ab4a6138e3dc96b930bac06d57 (commit)
via eb7dd7a042219ec1367ab1e4c70638abfb967aba (commit)
via 533f1301506c201c4eee01e880188aef30e46795 (commit)
via 290770ae636671de184457766135eac3185507bd (commit)
via d9d6be1512ead188854051362a1c02d3e98b430f (commit)
via 2b85f9f2fb495bdc813093536d4dfb118b317a93 (commit)
via 41de715dce9c59ddd5e01ad2e46cf9ca78cc2199 (commit)
via 4a99bb6f314d8fd380c838aca948c14fa74b3644 (commit)
via 928be7aa366f0f3dc8bddfa795fe8d770dd66d93 (commit)
via e9af8ac8951ba2f07d3c42b2cca4760635c49ca9 (commit)
via 8b3c3a760cfe86119055ab8a4efe0ef32708ba39 (commit)
via 6b10692ae39b4877fcbb3aac0ea13a4f705983e2 (commit)
via 21f4c7294724d3dd47cda68d1449f0c8ac0cc1f7 (commit)
via 7b0b7c21e1651c41b78feefad032dc9a7979ff3a (commit)
via 04b81baf4f9b35178c3ab8be28a188039df38447 (commit)
via 0c2fdf06b1b22b3fad45aed19e5340503d5e7c6b (commit)
via b6e98afc67a9ef75084b799937b41098aefbc941 (commit)
via e585caecbceac260f2445e29cc8a0b749e9e6f29 (commit)
via 5e1b821afc9a263e6d6ca62f147be3bc5f0f9a5c (commit)
via 5969c55d6a482da3c5ca64b297534ddc169d2f6b (commit)
via 4b9de7fd9542e1146be0c2acdf8f25531bb63ffe (commit)
via f6536242e8ccfa1a1be748f4d39f676ffdef4043 (commit)
via 6e85c22cba2f58f6fc3ca3e79531eba7c65c58a6 (commit)
via c03ebbe9394f6e3d6a2c6f259af7784201946857 (commit)
via a664d667f121bc3b28987193ace0c70e7e71b386 (commit)
via a4574aae138c61257232e728da0f70998ca57afa (commit)
via 06174d40f9dde8634a703d6d9e27826c9e91269a (commit)
via 53c2b745afb88b6702b451ca23e40610622fa961 (commit)
via c59ad622b32fe84e054198a44cccbeaabaee29b8 (commit)
via bb9d6760a512f97c12324052b9328668ccffeb07 (commit)
via 98ff61ee2de1ebd6c4a90a4d4d25428b054aa72e (commit)
via 01f7336a3ed8c3eab82b646dfc7d8dc4d723545f (commit)
via d3cf53369367cb157e87a197f8e417ac8f7c6569 (commit)
from bc96bdd7d9d8342fe018fe76ff3bf9b5a6fdc3c7 (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 ce758846dbc2dfaf0e1d50ae203a0e955dc33aaf
Author: Pierre Chambart <pie...@oc...>
Date: Sat May 11 10:05:24 2013 +0200
filter urg
commit 295eeed1694fcd66c866a47adf80d185a5e006ed
Author: Pierre Chambart <pie...@oc...>
Date: Sat May 11 09:34:45 2013 +0200
plop
commit 1469f324204351a9fed364e7cd255536c1192bc2
Author: Pierre Chambart <pie...@oc...>
Date: Sat May 11 09:20:33 2013 +0200
test
commit 151f042d69b02a6f65a4ece42a5fb3bdba392546
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 17:17:06 2013 +0200
Move back action, more things in homologation
commit 63aabe085353534abc4dba4d0ef0ffb5d04d1801
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 15:51:19 2013 +0200
more on xbee
commit 3e283fa22033418ebf6c4d103c7e776301193f62
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 15:51:08 2013 +0200
generate trajectories that does not go backward
commit 4d0245d3a58ad206462f821ec5c3aeacc4b83ecb
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 07:42:38 2013 +0200
Homologation: infinite loop
commit 31786065d863cf2d4aa07eb5cd7de558db72b4f0
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 07:16:10 2013 +0200
More flexible node, allow n retries/skip/loop
commit c2c799d2a17fb401b88bc2849cc1f1841759486e
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 06:22:13 2013 +0200
Finish krobot-xbee
commit c08a114cea56f74ab6b2f05c801ccc51298db979
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 02:31:21 2013 +0200
Stuff start
commit 3bf0f7ea516321571c2aed4e4e7183643452575b
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 02:30:52 2013 +0200
Start xbee
commit 7dbe121c133f23ab4a6138e3dc96b930bac06d57
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 01:23:07 2013 +0200
Little bit smarter
commit eb7dd7a042219ec1367ab1e4c70638abfb967aba
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 00:52:17 2013 +0200
Clean some dead code (since 2011)
commit 533f1301506c201c4eee01e880188aef30e46795
Author: Pierre Chambart <pie...@oc...>
Date: Fri May 10 00:45:27 2013 +0200
Many fixes, better startegy
commit 290770ae636671de184457766135eac3185507bd
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 20:04:28 2013 +0200
Add cake to the table extraction
commit d9d6be1512ead188854051362a1c02d3e98b430f
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 20:04:06 2013 +0200
Urg replay
commit 2b85f9f2fb495bdc813093536d4dfb118b317a93
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 17:38:37 2013 +0200
Multiple fix
commit 41de715dce9c59ddd5e01ad2e46cf9ca78cc2199
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 13:38:26 2013 +0200
krobot_urg_extract: Filter when only one point
commit 4a99bb6f314d8fd380c838aca948c14fa74b3644
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 13:34:17 2013 +0200
Return to nice homologation
commit 928be7aa366f0f3dc8bddfa795fe8d770dd66d93
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 13:28:36 2013 +0200
Fix vm explosions
commit e9af8ac8951ba2f07d3c42b2cca4760635c49ca9
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 11:45:12 2013 +0200
homo
commit 8b3c3a760cfe86119055ab8a4efe0ef32708ba39
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 10:34:29 2013 +0200
Hack homologation
commit 6b10692ae39b4877fcbb3aac0ea13a4f705983e2
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 10:09:36 2013 +0200
Fix homologation: changing switch reset timer
commit 21f4c7294724d3dd47cda68d1449f0c8ac0cc1f7
Author: Xavier Lagorce <Xav...@cr...>
Date: Thu May 9 13:26:40 2013 +0200
[krobot-vm] Blink all LEDs if emergency stop button if pressed
commit 7b0b7c21e1651c41b78feefad032dc9a7979ff3a
Author: Xavier Lagorce <Xav...@cr...>
Date: Thu May 9 08:53:49 2013 +0200
[krobot-viewer] Change robot's color for better visibility
commit 04b81baf4f9b35178c3ab8be28a188039df38447
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 08:48:30 2013 +0200
Change team led: red on red
commit 0c2fdf06b1b22b3fad45aed19e5340503d5e7c6b
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 08:44:57 2013 +0200
Remove safety margin: we start too close from the wall to have one...
commit b6e98afc67a9ef75084b799937b41098aefbc941
Author: Xavier Lagorce <Xav...@cr...>
Date: Thu May 9 08:27:34 2013 +0200
[krobot-vm] Fixed "typo"
commit e585caecbceac260f2445e29cc8a0b749e9e6f29
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 08:09:59 2013 +0200
Optimise Icp_utils.far_enougth_filter
commit 5e1b821afc9a263e6d6ca62f147be3bc5f0f9a5c
Author: Xavier Lagorce <Xav...@cr...>
Date: Thu May 9 07:47:41 2013 +0200
[Krobot_vm] Don't start the pump at the beggining of the match
commit 5969c55d6a482da3c5ca64b297534ddc169d2f6b
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 00:56:02 2013 +0200
try something is now an action when goto fail
commit 4b9de7fd9542e1146be0c2acdf8f25531bb63ffe
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 00:55:39 2013 +0200
Change homologation
commit f6536242e8ccfa1a1be748f4d39f676ffdef4043
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 00:55:20 2013 +0200
Fix initial position
commit 6e85c22cba2f58f6fc3ca3e79531eba7c65c58a6
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 00:10:01 2013 +0200
Fix ax12 position in homologation
commit c03ebbe9394f6e3d6a2c6f259af7784201946857
Author: Pierre Chambart <pie...@oc...>
Date: Thu May 9 00:09:27 2013 +0200
Update config
commit a664d667f121bc3b28987193ace0c70e7e71b386
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 23:30:57 2013 +0200
fix homologation
commit a4574aae138c61257232e728da0f70998ca57afa
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 23:28:20 2013 +0200
Fix end of match
commit 06174d40f9dde8634a703d6d9e27826c9e91269a
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 23:28:00 2013 +0200
Homologation with baloon
commit 53c2b745afb88b6702b451ca23e40610622fa961
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 23:27:25 2013 +0200
filter urg data to avoid spurious points
commit c59ad622b32fe84e054198a44cccbeaabaee29b8
Author: Xavier Lagorce <Xav...@cr...>
Date: Wed May 8 23:24:53 2013 +0200
[Krobot_viewer] Draw 2013 Table (better late than never...)
commit bb9d6760a512f97c12324052b9328668ccffeb07
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 21:56:46 2013 +0200
Trivial homologation program
commit 98ff61ee2de1ebd6c4a90a4d4d25428b054aa72e
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 19:58:27 2013 +0200
See and avoid objects
commit 01f7336a3ed8c3eab82b646dfc7d8dc4d723545f
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 18:17:14 2013 +0200
Fix build
commit d3cf53369367cb157e87a197f8e417ac8f7c6569
Author: Pierre Chambart <pie...@oc...>
Date: Wed May 8 18:10:48 2013 +0200
krobot_urg_extract: extract objects from urg captures
-----------------------------------------------------------------------
Changes:
diff --git a/info/control2011/_oasis b/info/control2011/_oasis
index 85d5e9e..adcbdf0 100644
--- a/info/control2011/_oasis
+++ b/info/control2011/_oasis
@@ -34,6 +34,10 @@ Flag sdl
Description: enable sdl
Default: true
+Flag lacaml
+ Description: compile icp depending on lacaml
+ Default: true
+
# +-------------------------------------------------------------------+
# | Libraries |
# +-------------------------------------------------------------------+
@@ -77,6 +81,8 @@ Library "krobot-can"
Library "krobot-icp"
FindlibName: icp
FindlibParent: krobot
+ Build$: flag(lacaml)
+ Install$: flag(lacaml)
BuildDepends: lacaml
XMETADescription: 2d Point cloud registration
XMETARequires: lacaml
@@ -317,6 +323,22 @@ Executable "krobot-urg"
MainIs: krobot_urg.ml
BuildDepends: krobot, urg, lwt.syntax, lwt.preemptive, threads
+Executable "krobot-urg-extract"
+ Path: src/tools
+ Build$: flag(lacaml)
+ Install$: flag(lacaml)
+ CompiledObject: best
+ MainIs: krobot_urg_extract.ml
+ BuildDepends: krobot, krobot.icp, lwt.syntax
+
+Executable "krobot-urg-replay"
+ Path: src/tools
+ Build$: flag(lacaml)
+ Install$: flag(lacaml)
+ CompiledObject: best
+ MainIs: krobot_urg_replay.ml
+ BuildDepends: krobot, lwt.syntax, krobot.icp
+
Executable "krobot-beacon-reader"
Path: src/tools
Install: true
@@ -324,6 +346,13 @@ Executable "krobot-beacon-reader"
MainIs: krobot_beacon_reader.ml
BuildDepends: krobot, lwt.syntax, lwt.unix
+Executable "krobot-xbee"
+ Path: src/tools
+ Install: true
+ CompiledObject: best
+ MainIs: krobot_xbee.ml
+ BuildDepends: krobot, lwt.syntax, lwt.unix, str
+
# +-------------------------------------------------------------------+
# | Examples |
# +-------------------------------------------------------------------+
diff --git a/info/control2011/_tags b/info/control2011/_tags
index 4b773d9..7aa1784 100644
--- a/info/control2011/_tags
+++ b/info/control2011/_tags
@@ -1,6 +1,6 @@
<**/*.ml{,i}>: syntax_camlp4o
<src/interfaces/*.ml>: -syntax_camlp4o
-<src/icp/*.ml>: -syntax_camlp4o
+<src/icp/*.ml{,i}>: -syntax_camlp4o
# OASIS_START
# DO NOT EDIT (digest: 9a283fb86531fb8de178da3ad5f872b1)
diff --git a/info/control2011/src/icp/icp_utils.ml b/info/control2011/src/icp/icp_utils.ml
index a961e5e..b85b81b 100644
--- a/info/control2011/src/icp/icp_utils.ml
+++ b/info/control2011/src/icp/icp_utils.ml
@@ -21,6 +21,12 @@ let shuffle l =
let l1,l2 = split ([],[]) l in
merge [] l1 (List.rev l2)
+let circle (dx,dy) r a0 an n =
+ let angle_ramp = linear a0 an n in
+ let x = Array.map (fun theta -> r *. cos theta +. dx) angle_ramp in
+ let y = Array.map (fun theta -> r *. sin theta +. dy) angle_ramp in
+ x,y
+
let table ~width ~length n =
let x1,y1 = line (0.,0.) (length,0.) n in
let x2,y2 = line (length,0.) (length,width) n in
@@ -31,6 +37,24 @@ let table ~width ~length n =
let f a = Array.of_list (shuffle (shuffle (Array.to_list a))) in
{ dx = f x; dy = f y }
+let pi = 3.14159265358979323
+
+let real_table n =
+ let length = 3. in
+ let width = 2. in
+ let x1,y1 = line (0.,0.) (length,0.) n in
+ let x2,y2 = line (length,0.) (length,width) n in
+ let x3,y3 = line (0.,width) (0.,0.) n in
+ let x4,y4 = line (0.,width) (1.,width) (n/2) in
+ let x5,y5 = line (2.,width) (length,width) (n/2) in
+ let x6,y6 = circle (1.5,2.0) 0.5 (-.pi) 0. n in
+ let x7,y7 = line (0.,0.1) (0.4,0.1) (n/4) in
+ let x8,y8 = line (3.,0.1) (2.6,0.1) (n/4) in
+ let x = Array.concat [x1;x2;x3;x4;x5;x6;x7;x8] in
+ let y = Array.concat [y1;y2;y3;y4;y5;y6;y7;y8] in
+ let f a = Array.of_list (shuffle (shuffle (Array.to_list a))) in
+ { dx = f x; dy = f y }
+
(**** dump loading ****)
@@ -76,18 +100,39 @@ let load_file ?(min_dist=0.15) ?(max_dist=6.) f =
ts, { dx = Array.of_list x; dy = Array.of_list y }) l in
Array.of_list l'
+let load_raw_file f =
+ let l = load_file' f in
+ let l' =
+ List.map (fun (ts,v) ->
+ let x,y = List.split v in
+ ts, { dx = Array.of_list x; dy = Array.of_list y }) l in
+ Array.of_list l'
(**** filtering ****)
-let far_enougth_filter kd a min_dist data =
- let dist = distance_transform (fun i -> i) kd a data in
- let dist = Array.mapi (fun i d -> i,d) dist in
- let distl = Array.to_list dist in
- let min_dist2 = min_dist *. min_dist in
- let far_enougth (i,d) = d >= min_dist2 in
- let ai = Array.of_list (List.filter far_enougth distl) in
- { dx = Array.map (fun (i,_) -> data.dx.(i)) ai;
- dy = Array.map (fun (i,_) -> data.dy.(i)) ai }
+(* TODO: can be done more efficiently using Kd_tree.closer *)
+(* let far_enougth_filter kd a min_dist data = *)
+(* let dist = distance_transform (fun i -> i) kd a data in *)
+(* let dist = Array.mapi (fun i d -> i,d) dist in *)
+(* let distl = Array.to_list dist in *)
+(* let min_dist2 = min_dist *. min_dist in *)
+(* let far_enougth (i,d) = d >= min_dist2 in *)
+(* let ai = Array.of_list (List.filter far_enougth distl) in *)
+(* { dx = Array.map (fun (i,_) -> data.dx.(i)) ai; *)
+(* dy = Array.map (fun (i,_) -> data.dy.(i)) ai } *)
+
+let far_enougth_filter kd min_dist data =
+ let dx = data.dx in
+ let dy = data.dy in
+ let l = ref [] in
+ for i = 0 to Array.length dx - 1 do
+ if not (Kd_tree.closer min_dist { Kd_tree.x = dx.(i); y = dy.(i) } kd)
+ then l := i :: !l
+ done;
+ let l = Array.of_list !l in
+ let x = Array.map (fun i -> dx.(i)) l in
+ let y = Array.map (fun i -> dy.(i)) l in
+ { dx = x; dy = y }
let invert_transform a =
let co = cos (-. a.ath) in
diff --git a/info/control2011/src/icp/icp_utils.mli b/info/control2011/src/icp/icp_utils.mli
index 1e23bba..55c30e3 100644
--- a/info/control2011/src/icp/icp_utils.mli
+++ b/info/control2011/src/icp/icp_utils.mli
@@ -2,15 +2,19 @@ open Icp_minimisation
val table : width:float -> length:float -> int -> data
+val real_table : int -> data
+
val load_file : ?min_dist:float -> ?max_dist:float -> string ->
(float * data) array
(** load a dump file in the format dumpped by [krobot_urg -listen] *)
+val load_raw_file : string -> (float * data) array
+(** load a dump file in the format dumpped by [krobot_urg -listen] *)
(* filtering *)
-val far_enougth_filter : 'a Kd_tree.t -> a -> float -> data -> data
-(** [far_enougth_filter kd a min_dist data] filter out values of
- [data] that are closer than [min_dist] to a vertex of kd *)
+val far_enougth_filter : 'a Kd_tree.t -> float -> data -> data
+(** [far_enougth_filter kd min_dist data] filter out values of [data]
+ that are closer than [min_dist] to a vertex of kd *)
val invert_transform : a -> a
diff --git a/info/control2011/src/icp/kd_tree.ml b/info/control2011/src/icp/kd_tree.ml
index 45601d4..96631a7 100644
--- a/info/control2011/src/icp/kd_tree.ml
+++ b/info/control2011/src/icp/kd_tree.ml
@@ -98,6 +98,58 @@ let nearest_neighbor v = function
let curr = (med_val, median_elt, sq_dist median_elt v) in
nearest_neighbor' v curr t
+let rec closer' dist_sq v t = match t with
+ | Empty -> false
+ | Leaf (va,p) -> sq_dist v p <= dist_sq
+ | Split (dir, med_val, median_elt, left, right) ->
+ let split_distance = match dir with
+ | Hori -> sq (v.x -. median_elt.x)
+ | Vert -> sq (v.y -. median_elt.y) in
+ if split_distance <= dist_sq
+ then begin
+ if sq_dist v median_elt <= dist_sq
+ then true
+ else closer' dist_sq v left || closer' dist_sq v right
+ end
+ else
+ let cmp = match dir with
+ | Hori -> compare v.x median_elt.x
+ | Vert -> compare v.y median_elt.y in
+ if cmp > 0
+ then closer' dist_sq v right
+ else closer' dist_sq v left
+
+let closer dist v t = closer' (sq dist) v t
+
+let add_closer dist_sq v p va acc =
+ if sq_dist v p <= dist_sq
+ then va::acc
+ else acc
+
+let rec closer_points' dist_sq v t acc = match t with
+ | Empty -> acc
+ | Leaf (va,p) ->
+ add_closer dist_sq v p va acc
+ | Split (dir, med_val, median_elt, left, right) ->
+ let split_distance = match dir with
+ | Hori -> sq (v.x -. median_elt.x)
+ | Vert -> sq (v.y -. median_elt.y) in
+ if split_distance <= dist_sq
+ then begin
+ let acc = add_closer dist_sq v median_elt med_val acc in
+ let acc = closer_points' dist_sq v left acc in
+ closer_points' dist_sq v right acc
+ end
+ else
+ let cmp = match dir with
+ | Hori -> compare v.x median_elt.x
+ | Vert -> compare v.y median_elt.y in
+ if cmp > 0
+ then closer_points' dist_sq v right acc
+ else closer_points' dist_sq v left acc
+
+let closer_points dist v t = closer_points' (sq dist) v t []
+
let rec depth = function
| Split (_, _, _, t1,t2 ) ->
1 + max (depth t1) (depth t2)
diff --git a/info/control2011/src/icp/kd_tree.mli b/info/control2011/src/icp/kd_tree.mli
index 947b1ad..9fd0f7c 100644
--- a/info/control2011/src/icp/kd_tree.mli
+++ b/info/control2011/src/icp/kd_tree.mli
@@ -12,3 +12,11 @@ val nearest_neighbor : vertice -> 'a t -> 'a * vertice * float
[vert] *)
val depth : 'a t -> int
+
+val closer : float -> vertice -> 'a t -> bool
+(** [closer dist vert t] returns true if there is a point in [t]
+ closer than [dist] of [vert] *)
+
+val closer_points : float -> vertice -> 'a t -> 'a list
+(** [closer_points dist vert t] returns the lis tof all points in [t]
+ closer than [dist] of [vert] *)
diff --git a/info/control2011/src/lib/krobot_action.ml b/info/control2011/src/lib/krobot_action.ml
index 8b86239..290f661 100644
--- a/info/control2011/src/lib/krobot_action.ml
+++ b/info/control2011/src/lib/krobot_action.ml
@@ -10,15 +10,24 @@
open Printf
open Krobot_geom
-type t =
- | Node of t option * t list
+type node_kind =
+ | Simple
+ | Retry of int * t
+ | Loop of t
+ | Next
+
+and t =
+ | Node of node_kind * t list
| Stop
| Think
| Goto of vertice * vector option
+ | Simple_goto of vertice * vector option
+ | Random_move of ( vertice * vertice )
| Set_limits of float * float * float * float
| Follow_path of vertice list * vector option * bool
| Bezier of float * vertice * vertice * vertice * vertice * float
- | Set_curve of Bezier.curve option
+ | Move_back of float
+ | Set_curve of (bool * Bezier.curve) option
| Wait_for_jack of bool
| Wait_for_bezier_moving of bool * float option
| Wait_for_motors_moving of bool * float option
@@ -27,18 +36,11 @@ type t =
| Try_something of vertice
| Fail
| Wait_for_odometry_reset of [ `Red | `Blue | `Auto ]
- | Load of [ `Front | `Back ]
- | Lift_down of [ `Front | `Back ]
- | Lift_up of [ `Front | `Back ]
- | Open_grip_low of [ `Front | `Back ]
- | Close_grip_low of [ `Front | `Back ]
- | Open_grip_high of [ `Front | `Back ]
- | Close_grip_high of [ `Front | `Back ]
| Wait_for of float
| Wait_until of float
- | Wait_for_grip_open_low of [ `Front | `Back ]
- | Wait_for_grip_close_low of [ `Front | `Back ]
| Start_timer of float * t list
+ | Stop_timer
+ | Start_match
| Can of Krobot_can.frame
| Set_led of [ `Red | `Yellow | `Green ] * bool
| Set_orientation of float
@@ -58,14 +60,27 @@ let string_of_face = function
| `Back -> "`Back"
let rec to_string = function
- | Node (t,l) ->
- sprintf "Node [%s, %s]" (string_of_option to_string t) (list_to_string l)
+ | Node (Simple,l) ->
+ sprintf "Node [%s]" (list_to_string l)
+ | Node (Next,l) ->
+ sprintf "Node [Next,%s]" (list_to_string l)
+ | Node (Retry(n,l'),l) ->
+ sprintf "Node [%i, %s, %s]"
+ n (to_string l') (list_to_string l)
+ | Node (Loop t,l) ->
+ sprintf "Node [loop, %s, %s]" (to_string t) (list_to_string l)
| Stop ->
"Stop"
| Think ->
"Think"
+ | Move_back f ->
+ sprintf "Move_back %f" f
+ | Random_move (v1,v2) ->
+ sprintf "Random move %s %s" (string_of_vertice v1) (string_of_vertice v2)
| Goto (v,vect) ->
sprintf "Goto %s %s" (string_of_vertice v) (string_of_option string_of_vector vect)
+ | Simple_goto (v,vect) ->
+ sprintf "Simple_goto %s %s" (string_of_vertice v) (string_of_option string_of_vector vect)
| Set_limits (vmax,omega_max,atan_max, arad_max) ->
sprintf "Set_limits(%f, %f, %f, %f)" vmax omega_max atan_max arad_max
| Set_led (_,_) -> "Set_led"
@@ -83,8 +98,8 @@ let rec to_string = function
(string_of_vertice r)
(string_of_vertice s)
end_velocity
- | Set_curve(Some c) ->
- sprintf "Set_curve(Some %s)" (Bezier.string_of_curve c)
+ | Set_curve(Some (dir,c)) ->
+ sprintf "Set_curve(Some (%b, %s))" dir (Bezier.string_of_curve c)
| Set_curve None ->
"Set_curve None"
| Wait_for_jack st ->
@@ -115,30 +130,14 @@ let rec to_string = function
"Wait_for_odometry_reset `Blue"
| Wait_for_odometry_reset `Auto ->
"Wait_for_odometry_reset `Auto"
- | Load face ->
- sprintf "Load %s" (string_of_face face)
- | Lift_down face ->
- sprintf "Lift_down %s" (string_of_face face)
- | Lift_up face ->
- sprintf "Lift_up %s" (string_of_face face)
- | Open_grip_low face ->
- sprintf "Open_grip_low %s" (string_of_face face)
- | Close_grip_low face ->
- sprintf "Close_grip_low %s" (string_of_face face)
- | Open_grip_high face ->
- sprintf "Open_grip_high %s" (string_of_face face)
- | Close_grip_high face ->
- sprintf "Close_grip_high %s" (string_of_face face)
| Wait_for t ->
sprintf "Wait_for %f" t
| Wait_until t ->
sprintf "Wait_until %f" t
- | Wait_for_grip_open_low face ->
- sprintf "Wait_for_grip_open_low %S" (string_of_face face)
- | Wait_for_grip_close_low face ->
- sprintf "Wait_for_grip_close_low %S" (string_of_face face)
| Start_timer (delay,t) ->
sprintf "Start_timer(%f,%s)" delay (list_to_string t)
+ | Stop_timer ->
+ sprintf "Stop_timer"
| Can c -> "Can"
| Try_something v ->
sprintf "Try_something %s" (string_of_vertice v)
@@ -152,5 +151,6 @@ let rec to_string = function
(string_of_option string_of_float o)
| Calibrate (_,_,_,_,_,_) -> "Calibrate"
| End -> "End"
+ | Start_match -> "Start_match"
and list_to_string l = String.concat "; " (List.map to_string l)
diff --git a/info/control2011/src/lib/krobot_action.mli b/info/control2011/src/lib/krobot_action.mli
index a2ebb91..0ec9114 100644
--- a/info/control2011/src/lib/krobot_action.mli
+++ b/info/control2011/src/lib/krobot_action.mli
@@ -11,9 +11,16 @@
open Krobot_geom
+type node_kind =
+ | Simple
+ | Retry of int * t
+ | Loop of t
+ | Next
+
(** Type of actions. *)
-type t =
- | Node of t option * t list
+and t =
+ | Node of node_kind * t list
+
(** A sequence of action to execute in order. *)
| Stop
(** Stop all actions. *)
@@ -24,6 +31,10 @@ type t =
(** Go to the given point.
if the bool parameter is true, the path is inverted according
to the robot team *)
+ | Simple_goto of vertice * vector option
+ (** Same as Goto but can fail when obstacles block the trajectory *)
+
+ | Random_move of ( vertice * vertice )
| Set_limits of float * float * float * float
(** limit the speed *)
@@ -40,7 +51,8 @@ type t =
(** Follow the bezier curve determined by the given four
vertices. The first float is the sign, the last one is the
end velocity. *)
- | Set_curve of Bezier.curve option
+ | Move_back of float
+ | Set_curve of (bool * Bezier.curve) option
(** Set the curve currently being followed. *)
| Wait_for_jack of bool
(** Wait for the jack to be in the given state. *)
@@ -65,30 +77,14 @@ type t =
| Wait_for_odometry_reset of [ `Red | `Blue | `Auto ]
(** Wait for the odometry to say it is in red or blue initial position. *)
- | Load of [ `Front | `Back ]
- (** Load a pawn. *)
- | Lift_down of [ `Front | `Back ]
- (** Move the front or back lift down. *)
- | Lift_up of [ `Front | `Back ]
- (** Move the front or back lift up. *)
- | Open_grip_low of [ `Front | `Back ]
- (** Open the front or back low grip. *)
- | Close_grip_low of [ `Front | `Back ]
- (** Close the front or back low grip. *)
- | Open_grip_high of [ `Front | `Back ]
- (** Open the front or back low grip. *)
- | Close_grip_high of [ `Front | `Back ]
- (** Close the front or back low grip. *)
| Wait_for of float
(** Wait for the given number of seconds. *)
| Wait_until of float
(** Wait until the given date. *)
- | Wait_for_grip_open_low of [ `Front | `Back ]
- (** Wait for the given low grip to be opened. *)
- | Wait_for_grip_close_low of [ `Front | `Back ]
- (** Wait for the given low grip to be opened. *)
| Start_timer of float * t list
+ | Stop_timer
+ | Start_match
| Can of Krobot_can.frame
| Set_led of [ `Red | `Yellow | `Green ] * bool
@@ -110,3 +106,5 @@ type t =
val to_string : t -> string
(** [to_string action] returns the string representation of the
given string. *)
+
+val list_to_string : t list -> string
diff --git a/info/control2011/src/lib/krobot_bus.ml b/info/control2011/src/lib/krobot_bus.ml
index 387f972..25b85b7 100644
--- a/info/control2011/src/lib/krobot_bus.ml
+++ b/info/control2011/src/lib/krobot_bus.ml
@@ -31,7 +31,7 @@ type message =
| Trajectory_simplify of float
| Trajectory_go
| Trajectory_find_path
- | Objects of vertice list
+ | Objects of (vertice*float) list
| Sharps of float array
| Strategy_append of Krobot_action.t list
| Strategy_stop
@@ -45,6 +45,7 @@ type message =
| Urg_lines of (vertice*vertice) array
| Beacon_raw of (int * int * int * int * int * int
* int * int * int * int * int)
+ | Match_start
type t = {
oc : Lwt_io.output_channel;
@@ -60,6 +61,9 @@ open Printf
let string_of_vertice v =
sprintf "{ x = %f; y = %f }" v.x v.y
+let string_of_object (v,d) =
+ sprintf "{ x = %f; y = %f; d = %f }" v.x v.y d
+
let string_of_vector v =
sprintf "{ vx = %f; vy = %f }" v.vx v.vy
@@ -109,7 +113,7 @@ let string_of_message = function
| Objects objects ->
sprintf
"Objects [%s]"
- (String.concat "; " (List.map string_of_vertice objects))
+ (String.concat "; " (List.map string_of_object objects))
| Sharps a ->
sprintf
"Sharps [|%s|]"
@@ -156,6 +160,8 @@ let string_of_message = function
sprintf "Urg_lines (many_lines...)"
| Beacon_raw _ ->
sprintf "Raw beacon packet"
+ | Match_start ->
+ sprintf "Match start"
(* +-----------------------------------------------------------------+
| Sending/receiving messages |
diff --git a/info/control2011/src/lib/krobot_bus.mli b/info/control2011/src/lib/krobot_bus.mli
index b04aac3..28a6c1d 100644
--- a/info/control2011/src/lib/krobot_bus.mli
+++ b/info/control2011/src/lib/krobot_bus.mli
@@ -52,7 +52,7 @@ type message =
(** Objects *)
- | Objects of vertice list
+ | Objects of (vertice*float) list
(** The list of objects on the board. *)
(** Sharps *)
@@ -93,6 +93,8 @@ type message =
| Beacon_raw of (int * int * int * int * int * int
* int...
[truncated message content] |