From: Pierre C. <Ba...@us...> - 2012-05-09 20:59:06
|
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 5734668f606f94fd06962fae0aeb046bf4e7cf98 (commit) from 2f4db51988fbdeabce5d24892650c2db962d73bb (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 5734668f606f94fd06962fae0aeb046bf4e7cf98 Author: chicco <cha...@cr...> Date: Wed May 9 22:46:31 2012 +0200 [krobot_vm] stop the robot if it is too far from the ghost ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_message.mli b/info/control2011/src/lib/krobot_message.mli index f111d23..a071772 100644 --- a/info/control2011/src/lib/krobot_message.mli +++ b/info/control2011/src/lib/krobot_message.mli @@ -79,7 +79,9 @@ type t = - [a_rad_max] in m/s^2 *) | Odometry of float * float * float (** [Odometry(x, y, theta)] the position of the robot on the - table. *) + table. + - [x, y] in m + - [theta] in rad *) | Odometry_ghost of float * float * float * int * bool (** [Odometry_ghost(x, y, theta, following)]. [following] is [true] iff the robot is following the ghost. *) diff --git a/info/control2011/src/tools/krobot_vm.ml b/info/control2011/src/tools/krobot_vm.ml index a613692..9a67034 100644 --- a/info/control2011/src/tools/krobot_vm.ml +++ b/info/control2011/src/tools/krobot_vm.ml @@ -48,6 +48,9 @@ type robot = { mutable position : vertice; (* The position of the robot on the table. *) + mutable ghost_position : vertice; + (* The position of the ghost on the table. *) + mutable orientation : float; (* The orientation of the robot. *) @@ -100,6 +103,7 @@ let handle_message robot (timestamp, message) = robot.orientation <- math_mod_float theta (2. *. pi) | Odometry_ghost(x, y, theta, u, following) -> + robot.ghost_position <- { x; y }; robot.curve_parameter <- u; robot.moving <- following @@ -389,6 +393,15 @@ let run robot = () | Some curve -> try + (* Check that the robot is not too far from the ghost. + if it is then stop brutaly: + TODO do something interesting after the stop: retry what we were doing *) + if distance robot.ghost_position robot.position > 0.1 then begin + ignore (Lwt_log.info_f "Robot too far from the ghost"); + robot.strategy <- [Stop]; + reset robot; + raise Exit + end; (* Check that there is no colision between the current position and the end of the current curve. *) for i = robot.curve_parameter to 255 do @@ -457,6 +470,7 @@ lwt () = change_strategy = None; append_strategy = None; position = { x = 0.; y = 0. }; + ghost_position = { x = 0.; y = 0. }; orientation = 0.; objects = []; moving = false; diff --git a/info/vision/camlcv/src/cv_caml.c b/info/vision/camlcv/src/cv_caml.c index 7b70980..42cb9cd 100644 --- a/info/vision/camlcv/src/cv_caml.c +++ b/info/vision/camlcv/src/cv_caml.c @@ -963,21 +963,20 @@ CAMLprim value ocaml_cvInitUndistortMap( value vcameraMatrix, value vdistCoeffs, { CAMLparam4( vcameraMatrix, vdistCoeffs, vmap1, vmap2 ); - /* CvMat cameraMatrix = CvMat_val(vcameraMatrix); CvMat distCoeffs = CvMat_val(vdistCoeffs); - */ - /* + cvInitUndistortMap(&cameraMatrix, &distCoeffs, Image_val(vmap1)->image, Image_val(vmap2)->image); - */ + + /* cvInitUndistortMap(NULL, NULL, NULL, NULL); - + */ CAMLreturn(Val_unit); } hooks/post-receive -- krobot |