From: Jérémie D. <Ba...@us...> - 2010-02-23 18:17: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 4559f9bbbab6518f243fd21f6e406354ac8705ec (commit) from e4578a9f84417da74eafeb2d81d2ab8079cdb6b3 (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 4559f9bbbab6518f243fd21f6e406354ac8705ec Author: Jérémie Dimino <je...@di...> Date: Tue Feb 23 19:17:20 2010 +0100 [driver] fix forward/backward for motors ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/driver/driver.ml b/PC_Mainboard/driver/driver.ml index 8c5b020..305a8d7 100644 --- a/PC_Mainboard/driver/driver.ml +++ b/PC_Mainboard/driver/driver.ml @@ -366,10 +366,10 @@ struct USB_commands.Motor.traj_stop dev.card `Both mode let _set_velocities dev (settings_l, settings_r) (velocity_l, velocity_r) (acceleration_l, acceleration_r) duration = - let direction_l, velocity_l = if velocity_l < 0 then (`Backward, -velocity_l) else (`Forward, velocity_l) in - let direction_r, velocity_r = if velocity_r < 0 then (`Forward, -velocity_r) else (`Backward, velocity_r) in + let fake_direction_l, direction_l, velocity_l = if velocity_l < 0 then (`Backward, `Backward, -velocity_l) else (`Forward, `Forward, velocity_l) in + let fake_direction_r, direction_r, velocity_r = if velocity_r < 0 then (`Forward, `Backward, -velocity_r) else (`Backward, `Forward, velocity_r) in let date = Unix.gettimeofday () in - if ((direction_l = `Forward || direction_r = `Backward) && date < dev.inhibit_forward_until) + if ((direction_l = `Forward || direction_r = `Forward) && date < dev.inhibit_forward_until) || ((direction_l = `Backward || direction_r = `Backward) && date < dev.inhibit_backward_until) then fail (Failure "inhibited move") else begin @@ -381,14 +381,14 @@ struct { velocity = velocity_r; acceleration = acceleration_r; direction = direction_r }); lwt () = if acceleration_l <> settings_l.acceleration then - USB_commands.Motor.traj_new_velocity dev.card `Left velocity_l acceleration_l direction_l + USB_commands.Motor.traj_new_velocity dev.card `Left velocity_l acceleration_l fake_direction_l else - USB_commands.Motor.traj_change_velocity dev.card `Left velocity_l direction_l + USB_commands.Motor.traj_change_velocity dev.card `Left velocity_l fake_direction_l and () = if acceleration_r <> settings_r.acceleration then - USB_commands.Motor.traj_new_velocity dev.card `Right velocity_r acceleration_r direction_r + USB_commands.Motor.traj_new_velocity dev.card `Right velocity_r acceleration_r fake_direction_r else - USB_commands.Motor.traj_change_velocity dev.card `Right velocity_r direction_r + USB_commands.Motor.traj_change_velocity dev.card `Right velocity_r fake_direction_r in USB_commands.Motor.traj_start dev.card `Both end hooks/post-receive -- krobot |