From: Pierre C. <Ba...@us...> - 2012-05-15 23:13:18
|
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 39d27a4038f8f91b6469513e63ba3ccb4da8d3e8 (commit) from ea5d9b40eb2d99f440301de0de5be3f232ef1e74 (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 39d27a4038f8f91b6469513e63ba3ccb4da8d3e8 Author: chicco <cha...@cr...> Date: Wed May 16 01:12:29 2012 +0200 [control] ready for homologation ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/controller_motor_stm32.mk b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/controller_motor_stm32.mk index cbfc980..ac9aa9a 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/controller_motor_stm32.mk +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/controller_motor_stm32.mk @@ -9,7 +9,7 @@ Firmware_DEBUG = 1 # Our target application TRG += controller_motor_stm32 -controller_motor_stm32_PREFIX = "/home/lxir/opt/arm/bin/arm-none-eabi-" +controller_motor_stm32_PREFIX = "/media/data/krobot/arm-i386/bin/arm-none-eabi-" controller_motor_stm32_SUFFIX = "" diff --git a/info/control2011/_tags b/info/control2011/_tags index c2c77dd..1deda0d 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 8b68a015ff8be0607836f173f33170fd) +# DO NOT EDIT (digest: 791dda707015630876eec58d1f5251cd) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -77,6 +77,11 @@ <src/tools/krobot_record.{native,byte}>: pkg_lwt.unix <src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_record.{native,byte}>: pkg_lwt.react +# Executable krobot-homologation +<src/tools/krobot_homologation.{native,byte}>: use_krobot +<src/tools/krobot_homologation.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_homologation.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_homologation.{native,byte}>: pkg_lwt.react # Executable krobot-simulator <src/tools/krobot_simulator.{native,byte}>: use_krobot <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index e0ea140..ac9febe 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 6276a9db280e9f6fd9a16f0e5e4359c8) *) +(* DO NOT EDIT (digest: b99935b89748cc3e2881684ab7d70ce0) *) (* Regenerated by OASIS v0.3.0~rc3 Visit http://oasis.forge.ocamlcore.org for more information and @@ -5540,6 +5540,36 @@ let setup_t = {exec_custom = false; exec_main_is = "krobot_record.ml"; }); Executable ({ + cs_name = "krobot-homologation"; + cs_data = PropList.Data.create (); + cs_plugin_data = []; + }, + { + bs_build = [(OASISExpr.EBool true, true)]; + bs_install = [(OASISExpr.EBool true, true)]; + bs_path = "src/tools"; + bs_compiled_object = Best; + bs_build_depends = + [ + InternalLibrary "krobot"; + FindlibPackage ("lwt.syntax", None) + ]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])]; + }, + { + exec_custom = false; + exec_main_is = "krobot_homologation.ml"; + }); + Executable + ({ cs_name = "krobot-simulator"; cs_data = PropList.Data.create (); cs_plugin_data = []; @@ -6220,13 +6250,13 @@ let setup_t = }; oasis_fn = Some "_oasis"; oasis_version = "0.3.0~rc3"; - oasis_digest = Some "\189Q=v\151\180\162\208\188\238+\208>;\014V"; + oasis_digest = Some "^\025\t\b\239\141[v`R\255\200\143\017g\177"; oasis_exec = None; oasis_setup_args = []; };; let setup () = BaseSetup.setup setup_t;; -# 6231 "setup.ml" +# 6261 "setup.ml" (* OASIS_STOP *) let () = setup ();; diff --git a/info/control2011/src/lib/krobot_config.ml b/info/control2011/src/lib/krobot_config.ml index 4c5ef37..a88c48b 100644 --- a/info/control2011/src/lib/krobot_config.ml +++ b/info/control2011/src/lib/krobot_config.ml @@ -22,3 +22,65 @@ let object_safety_distance = object_radius +. robot_size /. 2. let beacon_safety_distance = 0.7 let coin_radius = 0.12 + +open Krobot_geom + +let pi = 4. *. atan 1. + +let red_initial_position = + { x = 0.25; + y = world_height -. 0.25; }, + 0. + +let blue_initial_position = + { x = world_width -. 0.25; + y = world_height -. 0.25; }, + pi + + +let fixed_obstacles = + [ + (* the trees *) + { pos = + { x = 0.64 +. 0.477; + y = 1. }; + size = sqrt (2. *. 0.125 *. 0.125); }; + { pos = + { x = world_width -. (0.64 +. 0.477); + y = 1. }; + size = sqrt (2. *. 0.125 *. 0.125); }; + + { pos = + { x = 1.5; + y = 1. }; + size = 0.1; }; + + (* entry position *) + { pos = + { x = 0.; + y = 1.5 }; + size = 0.1; }; + { pos = + { x = 0.2; + y = 1.5 }; + size = 0.1; }; + { pos = + { x = 0.4; + y = 1.5 }; + size = 0.1; }; + + { pos = + { x = world_width; + y = 1.5 }; + size = 0.1; }; + { pos = + { x = world_width -. 0.2; + y = 1.5 }; + size = 0.1; }; + { pos = + { x = world_width -. 0.4; + y = 1.5 }; + size = 0.1; }; + + + ] diff --git a/info/control2011/src/lib/krobot_config.mli b/info/control2011/src/lib/krobot_config.mli index def3497..3ca4531 100644 --- a/info/control2011/src/lib/krobot_config.mli +++ b/info/control2011/src/lib/krobot_config.mli @@ -46,3 +46,12 @@ val beacon_safety_distance : float val coin_radius : float (** Radius of coins. *) + +val red_initial_position : Krobot_geom.vertice * float + (** position and angle of the robot as red *) + +val blue_initial_position : Krobot_geom.vertice * float + (** position and angle of the robot as blue *) + + +val fixed_obstacles : Krobot_geom.obj list diff --git a/info/control2011/src/lib/krobot_geom.ml b/info/control2011/src/lib/krobot_geom.ml index 2f87a84..2d8c61a 100644 --- a/info/control2011/src/lib/krobot_geom.ml +++ b/info/control2011/src/lib/krobot_geom.ml @@ -101,6 +101,8 @@ let mult m v = (fun k -> Array.fold_left (+.) 0. (Array.mapi (fun i n -> v.(i) *. n) m.(k))) +type obj = { pos : vertice; size : float } + (* +-----------------------------------------------------------------+ | Cubic bezier curves | +-----------------------------------------------------------------+ *) diff --git a/info/control2011/src/lib/krobot_geom.mli b/info/control2011/src/lib/krobot_geom.mli index 71ec7e9..fbbb624 100644 --- a/info/control2011/src/lib/krobot_geom.mli +++ b/info/control2011/src/lib/krobot_geom.mli @@ -20,6 +20,8 @@ val math_mod_float : float -> float -> float type vector = { vx : float; vy : float } type vertice = { x : float; y : float } +type obj = { pos : vertice; size : float } + val null : vector val origin : vertice diff --git a/info/control2011/src/lib/krobot_pathfinding.ml b/info/control2011/src/lib/krobot_pathfinding.ml index b3c5262..63bd27f 100644 --- a/info/control2011/src/lib/krobot_pathfinding.ml +++ b/info/control2011/src/lib/krobot_pathfinding.ml @@ -23,14 +23,14 @@ module Vect = struct type circle = { c : point; r : float } type segment = { p1 : point; p2 : point } type line = { p : point; v : vect } - + let epsilon = 0.0000000001 - + let vect p1 p2 = { vx = p2.px -. p1.px; vy = p2.py -. p1.py } - + let ( +! ) p v = { px = v.vx +. p.px; py = v.vy +. p.py } let ( -! ) p v = { px = p.px -. v.vx; py = p.py -. v.vy } - + let ( +| ) v1 v2 = { vx = v1.vx +. v2.vx; vy = v1.vy +. v2.vy } let ( -| ) v1 v2 = { vx = v1.vx -. v2.vx; vy = v1.vy -. v2.vy } let ( *@ ) n v = { vx = n *. v.vx; vy = n *. v.vy } @@ -42,7 +42,7 @@ module Vect = struct let line s = { p = s.p1; v = vect s.p1 s.p2 } let scal v1 v2 = v1.vx *. v2.vx +. v1.vy *. v2.vy let colineaire v1 v2 = abs_float (v1.vx *. v2.vy -. v1.vy *. v2.vx) < epsilon - + let distance s p = let middle = ( scal diff --git a/info/control2011/src/tools/krobot_dump.ml b/info/control2011/src/tools/krobot_dump.ml index a734159..5b7f7ca 100644 --- a/info/control2011/src/tools/krobot_dump.ml +++ b/info/control2011/src/tools/krobot_dump.ml @@ -79,9 +79,7 @@ lwt () = Lwt_io.printl "" | Trajectory_go -> Lwt_io.printf "trajectory_go" - | _ -> - Lwt_io.printf "truc" - (*return ()*)) + | _ -> return ()) (Krobot_bus.recv bus)); fst (wait ()) diff --git a/info/control2011/src/tools/krobot_homologation.ml b/info/control2011/src/tools/krobot_homologation.ml index e06a26a..c69761b 100644 --- a/info/control2011/src/tools/krobot_homologation.ml +++ b/info/control2011/src/tools/krobot_homologation.ml @@ -11,6 +11,7 @@ open Krobot_bus open Krobot_action +open Krobot_geom let init_pos, init_angle = Krobot_config.red_initial_position @@ -21,14 +22,14 @@ let path = { x = 0.7; y = 1.15 }; { x = 0.5; y = 1.15 }; { x = 0.4; y = 1.15 }; - ]; + ] lwt () = lwt bus = Krobot_bus.get () in Krobot_bus.send bus (Unix.gettimeofday (), Strategy_set [ + Reset_odometry `Red; Wait_for_jack false; - Reset_odometry `Auto; Follow_path path; ]) diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index c7453b7..81adc86 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -283,6 +283,17 @@ let draw viewer = Cairo.stroke ctx) viewer.coins; + (* Draw obstacles *) + Cairo.set_source_rgba ctx 255. 255. 255. 0.5; + let () = + let open Krobot_geom in + List.iter + (fun { pos = { x; y }; size } -> + Cairo.arc ctx x y size 0. (2. *. pi); + Cairo.fill ctx) + Krobot_config.fixed_obstacles + in + (* Draw the robot and the ghost *) List.iter (fun (state, alpha) -> @@ -497,7 +508,7 @@ let handle_message viewer (timestamp, message) = (fun v -> let v = [|v.x;v.y;1.|] in let v = mult (rot_mat viewer.state.theta) v in - { x = v.(0); y = v.(1) }) l; + Krobot_geom.translate viewer.state.pos { vx = v.(0); vy = v.(1) }) l; queue_draw viewer | _ -> diff --git a/info/control2011/src/tools/krobot_vm.ml b/info/control2011/src/tools/krobot_vm.ml index 5bd2d11..1b38347 100644 --- a/info/control2011/src/tools/krobot_vm.ml +++ b/info/control2011/src/tools/krobot_vm.ml @@ -57,6 +57,9 @@ type robot = { mutable objects : vertice list; (* Position of objects on the table. *) + mutable coins : vertice list; + (* Position of coins on the table *) + mutable moving : bool; (* Is the robot moving ? *) @@ -171,6 +174,14 @@ let handle_message robot (timestamp, message) = | Objects l -> robot.objects <- l + | Coins l -> + robot.coins <- + List.map + (fun v -> + let v = [|v.x;v.y;1.|] in + let v = mult (rot_mat robot.orientation) v in + Krobot_geom.translate robot.position { vx = v.(0); vy = v.(1) }) l + | Strategy_append l -> begin match robot.append_strategy with | Some l' -> @@ -343,7 +354,7 @@ let rec exec robot actions = ignore (Lwt_log.info "Bezier"); (* Compute parameters. *) let d1 = sign *. distance p q and d2 = distance r s in - if d1 = 0. || d2 = 0. + if abs_float d1 <= 0.01 || abs_float d2 = 0.01 then (* in that case: there is an error somewhere else: search and destroy it ! *) @@ -361,10 +372,13 @@ let rec exec robot actions = Send (match which, robot.team with | `Red, _ | `Auto, `Red -> - Set_odometry(0.215 -. robot_size /. 2. +. wheels_position, - world_height -. robot_size -. 0.1 , 0.) + let { Krobot_geom.x; y }, angle = Krobot_config.red_initial_position in + Set_odometry( x, + y, 0. ) | `Blue, _ | `Auto, `Blue -> - Set_odometry(2.77, world_height -. 0.1 , pi))) + let { Krobot_geom.x; y }, angle = Krobot_config.blue_initial_position in + Set_odometry( x, + y, pi))) | Load face :: rest -> exec robot (Node [ Lift_down face; @@ -501,6 +515,7 @@ lwt () = ghost_position = { x = 0.; y = 0. }; orientation = 0.; objects = []; + coins = []; moving = false; path = None; curve = None; hooks/post-receive -- krobot |