From: Pierre C. <Ba...@us...> - 2013-04-24 21:35:23
|
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 7e53c27bb7cc49869dcc77be44a3197065722367 (commit) from 1958da2ab5fcb90d724dbe3f44b5c5a0e6843998 (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 7e53c27bb7cc49869dcc77be44a3197065722367 Author: Pierre Chambart <pie...@oc...> Date: Wed Apr 24 23:34:25 2013 +0200 Remove symetry from Goto and Follow_path actions ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_action.ml b/info/control2011/src/lib/krobot_action.ml index 8009c90..8507d79 100644 --- a/info/control2011/src/lib/krobot_action.ml +++ b/info/control2011/src/lib/krobot_action.ml @@ -14,9 +14,9 @@ type t = | Node of t option * t list | Stop | Think - | Goto of bool * vertice * vector option + | Goto of vertice * vector option | Set_limits of float * float * float - | Follow_path of bool * vertice list * vector option * bool + | Follow_path of vertice list * vector option * bool | Bezier of float * vertice * vertice * vertice * vertice * float | Set_curve of Bezier.curve option | Wait_for_jack of bool @@ -64,13 +64,13 @@ let rec to_string = function "Stop" | Think -> "Think" - | Goto (reverted,v,vect) -> - sprintf "Goto %b %s %s" reverted (string_of_vertice v) (string_of_option string_of_vector vect) + | Goto (v,vect) -> + sprintf "Goto %s %s" (string_of_vertice v) (string_of_option string_of_vector vect) | Set_limits (vmax,atan_max, arad_max) -> sprintf "Set_limits(%f, %f, %f)" vmax atan_max arad_max | Set_led (_,_) -> "Set_led" - | Follow_path (reverted,l,vect, correct) -> - sprintf "Follow_path [%b, %s, %s, %b]" reverted + | Follow_path (l,vect, correct) -> + sprintf "Follow_path [%s, %s, %b]" (String.concat "; " (List.map string_of_vertice l)) (string_of_option string_of_vector vect) correct diff --git a/info/control2011/src/lib/krobot_action.mli b/info/control2011/src/lib/krobot_action.mli index 9b6711e..e5c9f04 100644 --- a/info/control2011/src/lib/krobot_action.mli +++ b/info/control2011/src/lib/krobot_action.mli @@ -20,7 +20,7 @@ type t = | Think (** This is the highest-level action. It instruct the VM to think about a new strategy. *) - | Goto of bool * vertice * vector option + | Goto of vertice * vector option (** Go to the given point. if the bool parameter is true, the path is inverted according to the robot team *) @@ -31,10 +31,8 @@ type t = (* TODO: en faire un node pour pouvoir revenir a des limites normales en sortant d'une serie d'actions *) - | Follow_path of bool * vertice list * vector option * bool + | Follow_path of vertice list * vector option * bool (** Follow the given path. It does not check for obstacles. - if the bool parameter is true, the path is inverted according - to the robot team. the last boolean tells to correct the bezier curves to avoid obstacles. Use only if the lines between vertices does not colide obstacles *) diff --git a/info/control2011/src/tools/krobot_homologation.ml b/info/control2011/src/tools/krobot_homologation.ml index 556c957..c0d7dcf 100644 --- a/info/control2011/src/tools/krobot_homologation.ml +++ b/info/control2011/src/tools/krobot_homologation.ml @@ -43,10 +43,10 @@ let strat_loop = None, Some (pi) ); - Goto (false, { x = 1.5; y = 0.5 }, None); - Goto (false, { x = 1.5; y = 1.5 }, None); - Goto (false, { x = 1.5; y = 0.5 }, None); - Goto (false, { x = 1.5; y = 1.5 }, None); + Goto ({ x = 1.5; y = 0.5 }, None); + Goto ({ x = 1.5; y = 1.5 }, None); + Goto ({ x = 1.5; y = 0.5 }, None); + Goto ({ x = 1.5; y = 1.5 }, None); Wait_for 2.; End; ] diff --git a/info/control2011/src/tools/krobot_planner.ml b/info/control2011/src/tools/krobot_planner.ml index c12861a..6b8e8d5 100644 --- a/info/control2011/src/tools/krobot_planner.ml +++ b/info/control2011/src/tools/krobot_planner.ml @@ -148,7 +148,7 @@ let handle_message planner (timestamp, message) = | Trajectory_go -> let path = planner.vertices in - ignore (Krobot_bus.send planner.bus (Unix.gettimeofday (), Strategy_set [Krobot_action.Follow_path (false,path,None,false)])); + ignore (Krobot_bus.send planner.bus (Unix.gettimeofday (), Strategy_set [Krobot_action.Follow_path (path,None,false)])); set_vertices planner [] | Trajectory_find_path -> begin diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index 140b292..81c0ef4 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -615,10 +615,10 @@ let handle_message viewer (timestamp, message) = queue_draw viewer | Set_simulation_mode m -> - match m with - | Sim_HIL -> viewer.ui#menu_mode_hil#set_active true - | _ -> viewer.ui#menu_mode_normal#set_active true - + begin match m with + | Sim_HIL -> viewer.ui#menu_mode_hil#set_active true + | _ -> viewer.ui#menu_mode_normal#set_active true + end | _ -> () end @@ -795,7 +795,7 @@ lwt () = if GdkEvent.Button.button ev = 1 then begin match viewer.planner_path with | curve :: _ -> - ignore (Krobot_bus.send bus (Unix.gettimeofday (), Strategy_set [Krobot_action.Goto(false,Bezier.dst curve,None)])) + ignore (Krobot_bus.send bus (Unix.gettimeofday (), Strategy_set [Krobot_action.Goto(Bezier.dst curve,None)])) | _ -> () end; diff --git a/info/control2011/src/tools/krobot_vm.ml b/info/control2011/src/tools/krobot_vm.ml index c88eca8..015573d 100644 --- a/info/control2011/src/tools/krobot_vm.ml +++ b/info/control2011/src/tools/krobot_vm.ml @@ -262,12 +262,6 @@ let string_of_test = function | `Lt -> "Lt" | `Le -> "Le" -let revert_vertice v = { v with x = Krobot_config.world_width -. v.x } -let revert_vector_opt v = - match v with - | None -> None - | Some v -> Some { v with vx = -. v.vx } - let bezier_collide objects curve c1 c2 shift_vector curve_parameter = let curve = Bezier.mul_d1 curve c1 in let curve = Bezier.mul_d2 curve c2 in @@ -424,12 +418,8 @@ let rec exec robot actions = | Set_curve(Some curve) :: rest -> robot.curve <- Some curve; exec robot rest - | Goto (revert,v,last_vector) :: rest -> begin + | Goto (v,last_vector) :: rest -> begin ignore (Lwt_log.info_f "Goto"); - let v,last_vector = if revert && robot.team = `Blue - then revert_vertice v, revert_vector_opt last_vector - else v, last_vector - in (* Try to find a path to the destination. *) match Krobot_path.find ~src:robot.position ~dst:v ~beacon:robot.beacon with | Some vertices -> @@ -438,11 +428,11 @@ let rec exec robot actions = (Node ( Some (Node (None, [Stop; Wait_for 0.05; - Goto (false,v,last_vector)])), - [Follow_path (false,vertices,last_vector, true)]) :: rest) + Goto (v,last_vector)])), + [Follow_path (vertices,last_vector, true)]) :: rest) | None -> - ([Stop; Wait_for 0.05; Goto (revert,v,last_vector)] @ rest, + ([Stop; Wait_for 0.05; Goto (v,last_vector)] @ rest, Wait) end | Can c ::rest -> @@ -458,12 +448,8 @@ let rec exec robot actions = | `Green -> 6 | `Yellow -> 5 in (rest, Send[Switch_request(led,value)]) - | Follow_path (revert,vertices,last_vector, correct_curve ) :: rest -> begin + | Follow_path (vertices,last_vector, correct_curve ) :: rest -> begin ignore (Lwt_log.info_f "Follow_path"); - let vertices,vector = if revert && robot.team = `Blue - then List.map revert_vertice vertices, revert_vector_opt last_vector - else vertices, last_vector - in (* Compute bezier curves. *) let vector = { vx = cos robot.orientation; vy = sin robot.orientation } in (* @@ -651,7 +637,7 @@ let rec exec robot actions = | Calibrate ( approach_position, approach_orientation, distance, supposed_x, supposed_y, supposed_orientation )::rest -> Node (None, - ([ Goto (false,approach_position, + ([ Goto (approach_position, Some { vx = cos approach_orientation; vy = cos approach_orientation }); Set_orientation approach_orientation; hooks/post-receive -- krobot |