From: Nicolas D. <Ba...@us...> - 2011-04-03 12:44:58
|
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 359be2f1968db3385d01c70152350ce9f8a282c8 (commit) via 19089f6db1f39f24cf16f6205a818fb1ccac7032 (commit) via 1219a1b834232b76b2f02e29f2e00c3c463a9d42 (commit) from 5e6b68d0723980a8319d0f55cbdfb845d249f162 (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 359be2f1968db3385d01c70152350ce9f8a282c8 Author: Nicolas Dandrimont <Nic...@cr...> Date: Sun Apr 3 14:43:18 2011 +0200 [krobot_viewer] Add more info about the beacon in the UI commit 19089f6db1f39f24cf16f6205a818fb1ccac7032 Author: Nicolas Dandrimont <Nic...@cr...> Date: Sun Apr 3 14:43:10 2011 +0200 [krobot_viewer] consider the rotary beacon index position commit 1219a1b834232b76b2f02e29f2e00c3c463a9d42 Author: Nicolas Dandrimont <Nic...@cr...> Date: Sun Apr 3 14:42:01 2011 +0200 [krobot_message] Use the right data size for the Beacon low level packet ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/lib/krobot_config.ml b/info/control2011/src/lib/krobot_config.ml index acb9ff9..991a55d 100644 --- a/info/control2011/src/lib/krobot_config.ml +++ b/info/control2011/src/lib/krobot_config.ml @@ -13,3 +13,4 @@ let robot_size = 0.3 let wheels_diameter = 0.098 let wheels_distance = 0.259 let wheels_position = 0.045 +let rotary_beacon_index_pos = (4. *. atan 1.) /. 2. (* left side *) diff --git a/info/control2011/src/lib/krobot_config.mli b/info/control2011/src/lib/krobot_config.mli index bf336d5..266daaf 100644 --- a/info/control2011/src/lib/krobot_config.mli +++ b/info/control2011/src/lib/krobot_config.mli @@ -27,3 +27,7 @@ val wheels_distance : float val wheels_position : float (** The distance between the axe of the wheels and the back of the robot. *) + +val rotary_beacon_index_pos : float + (** The angle of the rotary beacon index angle with respect to the + robot's front *) diff --git a/info/control2011/src/lib/krobot_message.ml b/info/control2011/src/lib/krobot_message.ml index 3c3e51b..111d91a 100644 --- a/info/control2011/src/lib/krobot_message.ml +++ b/info/control2011/src/lib/krobot_message.ml @@ -203,10 +203,10 @@ let encode = function ~format:F29bits ~data | Beacon_lowlevel_position(angle, width, period) -> - let data = String.create 6 in + let data = String.create 8 in put_uint16 data 0 (truncate (angle *. 10000.)); put_uint16 data 2 (truncate (width *. 100000.)); - put_uint16 data 4 period; + put_uint32 data 4 period; frame ~identifier:302 ~kind:Data @@ -305,7 +305,7 @@ let decode frame = Beacon_lowlevel_position (float (get_uint16 frame.data 0) /. 10000., float (get_uint16 frame.data 2) /. 100000., - get_uint16 frame.data 4) + get_uint32 frame.data 4) | _ -> Unknown frame with Invalid_argument _ -> diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index c83ff15..fe95de4 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -556,14 +556,17 @@ module Board = struct board.ui#entry_moving3#set_text (if m3 then "yes" else "no"); board.ui#entry_moving4#set_text (if m4 then "yes" else "no") | Beacon_position(angle, distance, period) -> - let newangle = math_mod_float (board.state.theta +. angle) (2. *. pi) in + let newangle = math_mod_float (board.state.theta +. Krobot_config.rotary_beacon_index_pos +. angle) (2. *. pi) in let x = board.state.x +. distance *. cos (newangle) in let y = board.state.y +. distance *. sin (newangle) in let valid = distance <> 0. in let beacon = { xbeacon = x; ybeacon = y; valid; } in if beacon <> board.beacon then begin board.beacon <- beacon; - board.ui#entry_beacon#set_text (if valid then "valid" else "invalid"); + board.ui#beacon_status#set_text (if valid then "valid" else "invalid"); + board.ui#beacon_distance#set_text (string_of_float distance); + board.ui#beacon_angle#set_text (string_of_float angle); + board.ui#beacon_period#set_text (string_of_float period); queue_draw board end | _ -> diff --git a/info/control2011/src/tools/krobot_viewer_ui.glade b/info/control2011/src/tools/krobot_viewer_ui.glade index 45fbd13..485278d 100644 --- a/info/control2011/src/tools/krobot_viewer_ui.glade +++ b/info/control2011/src/tools/krobot_viewer_ui.glade @@ -793,11 +793,56 @@ </packing> </child> <child> - <widget class="GtkEntry" id="entry_beacon"> + <widget class="GtkHBox" id="hbox17"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="invisible_char">•</property> + <child> + <widget class="GtkEntry" id="beacon_status"> + <property name="width_request">1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="invisible_char">•</property> + </widget> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="beacon_distance"> + <property name="width_request">1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="invisible_char">•</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="beacon_angle"> + <property name="width_request">1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="invisible_char">•</property> + </widget> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="beacon_period"> + <property name="width_request">1</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="invisible_char">•</property> + </widget> + <packing> + <property name="position">3</property> + </packing> + </child> </widget> <packing> <property name="left_attach">1</property> hooks/post-receive -- krobot |