From: Xavier L. <Ba...@us...> - 2011-03-29 17:26:42
|
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 5d598864322684bb871d17034c47b16e123dd56b (commit) from 73d098f1abe08b3ce46993d9500d7d38c0bc407b (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 5d598864322684bb871d17034c47b16e123dd56b Author: Xavier Lagorce <Xav...@cr...> Date: Tue Mar 29 19:25:13 2011 +0200 [krobot_simulator] Unify and reproduce Controller Motor STM32 behavior ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/tools/krobot_simulator.ml b/info/control2011/src/tools/krobot_simulator.ml index 72f0182..d0da734 100644 --- a/info/control2011/src/tools/krobot_simulator.ml +++ b/info/control2011/src/tools/krobot_simulator.ml @@ -84,7 +84,7 @@ let velocities sim = (vel *. (sim.command_end -. sim.time) /. t_acc, 0.) let move sim distance velocity acceleration = - if velocity <> 0. && acceleration <> 0. then begin + if distance <> 0. && velocity > 0. && acceleration > 0. then begin let t_acc = velocity /. acceleration in let t_end = (velocity *. velocity +. distance *. acceleration) /. (velocity *. acceleration) in if t_end > 2. *. t_acc then begin @@ -95,9 +95,10 @@ let move sim distance velocity acceleration = end end else begin if t_acc <> 0. then begin - let t_acc = sqrt (distance /. acceleration) in + let t_acc = sqrt (abs_float (distance) /. acceleration) in let t_end = 2. *. t_acc in - let velocity = acceleration *. t_acc in + let sign = if distance >= 0. then 1. else -1. in + let velocity = sign *. acceleration *. t_acc in sim.command <- Move(t_acc, velocity); sim.command_start <- sim.time; sim.command_end <- sim.time +. t_end @@ -106,7 +107,7 @@ let move sim distance velocity acceleration = end let turn sim angle velocity acceleration = - if velocity <> 0. && acceleration <> 0. then begin + if angle <> 0. && velocity > 0. && acceleration > 0. then begin let t_acc = velocity /. acceleration in let t_end = (velocity *. velocity +. angle *. acceleration) /. (velocity *. acceleration) in if t_end > 2. *. t_acc then begin hooks/post-receive -- krobot |