From: Jérémie D. <Ba...@us...> - 2010-02-24 21:54:50
|
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 d5cabf5265f1cf7f5d47fd193ada0bd3b4c36e68 (commit) from c8338ac1db819595ad7883625879bc2180fe872c (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 d5cabf5265f1cf7f5d47fd193ada0bd3b4c36e68 Author: Olivier BICHLER <oli...@en...> Date: Wed Feb 24 22:41:14 2010 +0100 [driver] stop motors on velocity=0 ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/driver/driver.ml b/PC_Mainboard/driver/driver.ml index 1bc7bc8..eae08a2 100644 --- a/PC_Mainboard/driver/driver.ml +++ b/PC_Mainboard/driver/driver.ml @@ -443,27 +443,27 @@ struct let date = Unix.gettimeofday () in if (((direction_l = `Forward && velocity_l > 0) || (direction_r = `Forward && velocity_r > 0)) && date < dev.inhibit_forward_until) || (((direction_l = `Backward && velocity_l > 0) || (direction_r = `Backward && velocity_r > 0)) && date < dev.inhibit_backward_until) then - fail (Failure "inhibited move") + fail (Failure "inhibited move") else begin - if velocity_l <> 0 || velocity_r <> 0 then + cancel stopper; + if velocity_l <> 0 || velocity_r <> 0 then begin dev.state <- Manual(Lwt_unix.sleep duration >> stop_motors dev `Smooth, { velocity = velocity_l; acceleration = acceleration_l; direction = direction_l }, - { velocity = velocity_r; acceleration = acceleration_r; direction = direction_r }) - else - dev.state <- Static; - cancel stopper; - lwt () = - if acceleration_l <> settings_l.acceleration then - USB_commands.Motors.traj_new_velocity dev.card `Left velocity_l acceleration_l direction_l - else - USB_commands.Motors.traj_change_velocity dev.card `Left velocity_l direction_l - and () = - if acceleration_r <> settings_r.acceleration then - USB_commands.Motors.traj_new_velocity dev.card `Right velocity_r acceleration_r direction_r - else - USB_commands.Motors.traj_change_velocity dev.card `Right velocity_r direction_r - in - USB_commands.Motors.traj_start dev.card `Both + { velocity = velocity_r; acceleration = acceleration_r; direction = direction_r }); + lwt () = + if acceleration_l <> settings_l.acceleration then + USB_commands.Motors.traj_new_velocity dev.card `Left velocity_l acceleration_l direction_l + else + USB_commands.Motors.traj_change_velocity dev.card `Left velocity_l direction_l + and () = + if acceleration_r <> settings_r.acceleration then + USB_commands.Motors.traj_new_velocity dev.card `Right velocity_r acceleration_r direction_r + else + USB_commands.Motors.traj_change_velocity dev.card `Right velocity_r direction_r + in + USB_commands.Motors.traj_start dev.card `Both + end else + stop_motors dev `Smooth end let set_velocities dev velocities accelerations duration = hooks/post-receive -- krobot |