From: Jérémie D. <Ba...@us...> - 2011-04-25 19:21:14
|
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 a35b4e1cdf9f415501fa0ae4e44d2718ee5fb94c (commit) via 2ce237ac7b8e79e18262493ea91dfee1d91247b5 (commit) from 65ffbe46c0f588fd33ae4c84bb0d7309d1602293 (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 a35b4e1cdf9f415501fa0ae4e44d2718ee5fb94c Author: Jérémie Dimino <je...@di...> Date: Mon Apr 25 21:20:04 2011 +0200 [krobot_message] remove manual handling of the sign of theta in bezier messages commit 2ce237ac7b8e79e18262493ea91dfee1d91247b5 Author: Jérémie Dimino <je...@di...> Date: Mon Apr 25 21:00:37 2011 +0200 [info] change bezier messages ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_geom.ml b/info/control2011/src/lib/krobot_geom.ml index 1c84bf3..7ca6909 100644 --- a/info/control2011/src/lib/krobot_geom.ml +++ b/info/control2011/src/lib/krobot_geom.ml @@ -54,6 +54,9 @@ let div v s = { vy = v.vy /. s; } +let prod a b = + a.vx *. b.vx +. a.vy *. b.vy + let ( +| ) = add let ( -| ) = sub let ( ~| ) = minus @@ -167,12 +170,14 @@ module Bezier = struct in match vertices with | q :: r :: s :: _ -> + let initial = if prod initial (vector q r) < 0. then minus initial else initial in let v1 = initial and v2, _ = tangents q r s in let v1 = v1 *| (distance q r /. 2.) and v2 = v2 *| (distance q r /. 2.) in loop (add_vertices q r v1 v2 acc) vertices | [q; r] -> + let initial = if prod initial (vector q r) < 0. then minus initial else initial in let v1 = initial and v2 = vector r q /| distance q r in let v1 = v1 *| (distance q r /. 2.) diff --git a/info/control2011/src/lib/krobot_geom.mli b/info/control2011/src/lib/krobot_geom.mli index 59bee62..abebd94 100644 --- a/info/control2011/src/lib/krobot_geom.mli +++ b/info/control2011/src/lib/krobot_geom.mli @@ -28,6 +28,7 @@ val sub : vector -> vector -> vector val minus : vector -> vector val mul : vector -> float -> vector val div : vector -> float -> vector +val prod : vector -> vector -> float val ( +| ) : vector -> vector -> vector val ( -| ) : vector -> vector -> vector diff --git a/info/control2011/src/lib/krobot_message.ml b/info/control2011/src/lib/krobot_message.ml index 82df8a3..3a77845 100644 --- a/info/control2011/src/lib/krobot_message.ml +++ b/info/control2011/src/lib/krobot_message.ml @@ -233,7 +233,7 @@ let encode = function and y = int_of_float (y *. 1000.) and d1 = int_of_float (d1 *. 100.) and d2 = int_of_float (d2 *. 100.) - and theta = int_of_float (theta *. 1000.) land 0b1111111111111; + and theta = int_of_float (theta *. 100.) and v = int_of_float (v *. 1000.) in frame ~identifier:206 @@ -411,10 +411,7 @@ let decode frame = float y /. 1000., float d1 /. 100., float d2 /. 100., - (if theta >= 4096 then - float (theta - 8192) /. 1000. - else - float theta /. 1000.), + float theta /. 100., float v /. 1000.) | 301 -> Beacon_position diff --git a/info/control2011/src/lib/krobot_message_stubs.c b/info/control2011/src/lib/krobot_message_stubs.c index e34c242..ecb5de5 100644 --- a/info/control2011/src/lib/krobot_message_stubs.c +++ b/info/control2011/src/lib/krobot_message_stubs.c @@ -14,9 +14,9 @@ struct bezier_message { unsigned int x : 12; unsigned int y : 12; - unsigned int d1 : 8; + int d1 : 9; unsigned int d2 : 8; - int theta : 13; + int theta : 12; unsigned int v : 11; }; hooks/post-receive -- krobot |