From: Nicolas D. <Ba...@us...> - 2011-03-29 16:02:22
|
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 09cc51bf25cafe064191d4b69a7f66c2a4bb2312 (commit) from 24c465a1c1fc2b591a4e1f90959bc398d22df7e9 (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 09cc51bf25cafe064191d4b69a7f66c2a4bb2312 Author: Nicolas Dandrimont <Nic...@cr...> Date: Tue Mar 29 18:01:29 2011 +0200 [krobot_simulator] Support negative angles for turn. ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_simulator.ml b/info/control2011/src/tools/krobot_simulator.ml index 055acba..72f0182 100644 --- a/info/control2011/src/tools/krobot_simulator.ml +++ b/info/control2011/src/tools/krobot_simulator.ml @@ -116,9 +116,10 @@ let turn sim angle velocity acceleration = sim.command_end <- sim.time +. t_end end end else begin - let t_acc = sqrt (angle /. acceleration) in + let t_acc = sqrt (abs_float (angle) /. acceleration) in let t_end = 2. *. t_acc in - let velocity = acceleration *. t_acc in + let sign = if angle >= 0. then 1. else -1. in + let velocity = sign *. acceleration *. t_acc in if t_acc <> 0. then begin sim.command <- Turn(t_acc, velocity); sim.command_start <- sim.time; hooks/post-receive -- krobot |