From: Jérémie D. <Ba...@us...> - 2011-03-31 20:12:11
|
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 d73605b0d6b8ce682a0db9516748f0c3636a30cd (commit) from eb90593156e38fbbfaa7e6573d3f12c65e2d3a5d (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 d73605b0d6b8ce682a0db9516748f0c3636a30cd Author: Jérémie Dimino <je...@di...> Date: Thu Mar 31 22:11:33 2011 +0200 [krobot_viewer] fix computations of limits ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index 6b3dd20..de1696a 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -466,7 +466,8 @@ module Board = struct let rec loop () = match board.points with | (x, y) :: rest -> - let radius = sqrt (2. *. robot_size *. robot_size) in + let sqr x = x *. x in + let radius = sqrt (sqr (max wheels_position (robot_size -. wheels_position)) +. sqr (robot_size /. 2.)) in if x >= radius && x <= world_width -. radius && y >= radius && y <= world_height -. radius then begin (* Turn the robot. *) let alpha = math_mod_float (atan2 (y -. board.state.y) (x -. board.state.x) -. board.state.theta) (2. *. pi) in @@ -478,7 +479,6 @@ module Board = struct lwt () = wait_done board in (* Move the robot. *) - let sqr x = x *. x in let dist = sqrt (sqr (x -. board.state.x) +. sqr (y -. board.state.y)) in lwt () = Lwt_log.info_f "moving by %f meters" dist in lwt () = Krobot_message.send board.bus (Unix.gettimeofday (), hooks/post-receive -- krobot |