From: Pierre C. <Ba...@us...> - 2012-05-15 22:13:29
|
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 ea5d9b40eb2d99f440301de0de5be3f232ef1e74 (commit) via 8405c1cc560b0db86389ae2f7e169ba460463f09 (commit) from ff93134afe82b8e1bc1ea72a8d8af8a2b6c756e6 (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 ea5d9b40eb2d99f440301de0de5be3f232ef1e74 Author: chicco <cha...@cr...> Date: Wed May 16 00:12:18 2012 +0200 [control] add a small homologation program commit 8405c1cc560b0db86389ae2f7e169ba460463f09 Author: chicco <cha...@cr...> Date: Tue May 15 18:12:19 2012 +0200 [control] vm: protect against invalid bezier curve ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index 3227ab2..c9dcb61 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -212,6 +212,13 @@ Executable "krobot-ia" MainIs: krobot_ia.ml BuildDepends: krobot, lwt.syntax +Executable "krobot-homologation" + Path: src/tools + Install: true + CompiledObject: best + MainIs: krobot_homologation.ml + BuildDepends: krobot, lwt.syntax + Executable "krobot-can-display" Path: src/tools Build$: flag(gtk) diff --git a/info/control2011/src/tools/krobot_homologation.ml b/info/control2011/src/tools/krobot_homologation.ml new file mode 100644 index 0000000..e06a26a --- /dev/null +++ b/info/control2011/src/tools/krobot_homologation.ml @@ -0,0 +1,34 @@ +(* + * krobot_homologation.ml + * ------------ + * Copyright : (c) 2012, Pierre Chambart <cha...@cr...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* The simple ai for homologation. *) + +open Krobot_bus +open Krobot_action + +let init_pos, init_angle = Krobot_config.red_initial_position + +let path = + [ + { x = 0.7; y = init_pos.y }; + { x = 0.8; y = 1.5 }; + { 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 [ + Wait_for_jack false; + Reset_odometry `Auto; + Follow_path path; + ]) diff --git a/info/control2011/src/tools/krobot_vm.ml b/info/control2011/src/tools/krobot_vm.ml index 32d541a..5bd2d11 100644 --- a/info/control2011/src/tools/krobot_vm.ml +++ b/info/control2011/src/tools/krobot_vm.ml @@ -343,9 +343,16 @@ let rec exec robot actions = ignore (Lwt_log.info "Bezier"); (* Compute parameters. *) let d1 = sign *. distance p q and d2 = distance r s in - let v = vector r s in - let theta_end = atan2 v.vy v.vx in - (rest, Send(Motor_bezier(s.x, s.y, d1, d2, theta_end, v_end))) + if d1 = 0. || d2 = 0. + then + (* in that case: there is an error somewhere else: + search and destroy it ! *) + (ignore (Lwt_log.error_f "Error: Bezier with d1 = %f, d2 = %f" d1 d2); + ([], Wait)) + else + let v = vector r s in + let theta_end = atan2 v.vy v.vx in + (rest, Send(Motor_bezier(s.x, s.y, d1, d2, theta_end, v_end))) | Stop :: rest -> reset robot; (rest, Send(Motor_stop(1.0, 0.0))) @@ -354,9 +361,10 @@ let rec exec robot actions = Send (match which, robot.team with | `Red, _ | `Auto, `Red -> - Set_odometry(0.215 -. robot_size /. 2. +. wheels_position, 1.885, 0.) + Set_odometry(0.215 -. robot_size /. 2. +. wheels_position, + world_height -. robot_size -. 0.1 , 0.) | `Blue, _ | `Auto, `Blue -> - Set_odometry(2.77, 1.915, pi))) + Set_odometry(2.77, world_height -. 0.1 , pi))) | Load face :: rest -> exec robot (Node [ Lift_down face; hooks/post-receive -- krobot |