|
From: Jérémie D. <Ba...@us...> - 2010-02-10 21:28:14
|
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 2cb0b2a1da174f7a32acebc769607b05a1cd4938 (commit)
from 51ecd70a79d4b6d4cfffc41676e4c9dc21a3fba3 (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 2cb0b2a1da174f7a32acebc769607b05a1cd4938
Author: Jérémie Dimino <je...@di...>
Date: Wed Feb 10 22:27:21 2010 +0100
[client-tools] added init_position.ml
Program which put the robot into the initial position.
enter the commit message for your changes. Lines starting
-----------------------------------------------------------------------
Changes:
diff --git a/PC_Mainboard/clients/common/config.ml b/PC_Mainboard/clients/common/config.ml
index ac92ae7..67926dd 100644
--- a/PC_Mainboard/clients/common/config.ml
+++ b/PC_Mainboard/clients/common/config.ml
@@ -9,3 +9,4 @@
let back_sensors = [3; 6; 7; 10]
let front_sensors = [0; 1; 2; 4; 5; 8; 9; 11; 12; 13; 14; 15]
+let initial_position = 200
diff --git a/PC_Mainboard/clients/common/config.mli b/PC_Mainboard/clients/common/config.mli
index ee9d807..47c3f27 100644
--- a/PC_Mainboard/clients/common/config.mli
+++ b/PC_Mainboard/clients/common/config.mli
@@ -14,3 +14,6 @@ val front_sensors : int list
val back_sensors : int list
(** List of back sensors *)
+
+val initial_position : int
+ (** Position to borders at the beginning of the match *)
diff --git a/PC_Mainboard/clients/common/util.ml b/PC_Mainboard/clients/common/util.ml
index 3edd854..b369bdc 100644
--- a/PC_Mainboard/clients/common/util.ml
+++ b/PC_Mainboard/clients/common/util.ml
@@ -11,7 +11,7 @@ let front_colide sensors =
if Array.length sensors <> 16 then invalid_arg "Until.front_colide";
let rec loop = function
| 16 -> false
- | n -> (sensors.(n) && List.mem n Config.front_sensors) || loop (n - 1)
+ | n -> (sensors.(n) && List.mem n Config.front_sensors) || loop (n + 1)
in
loop 0
@@ -19,6 +19,6 @@ let back_colide sensors =
if Array.length sensors <> 16 then invalid_arg "Until.back_colide";
let rec loop = function
| 16 -> false
- | n -> (sensors.(n) && List.mem n Config.back_sensors) || loop (n - 1)
+ | n -> (sensors.(n) && List.mem n Config.back_sensors) || loop (n + 1)
in
loop 0
diff --git a/PC_Mainboard/clients/myocamlbuild.ml b/PC_Mainboard/clients/myocamlbuild.ml
index 54d6a50..5da00b7 100644
--- a/PC_Mainboard/clients/myocamlbuild.ml
+++ b/PC_Mainboard/clients/myocamlbuild.ml
@@ -101,6 +101,7 @@ let _ =
"remote/forward_dbus.native";
"tools/joy_control.native";
"security/hard_stop.native";
+ "tools/init_position.native";
];
(* +---------------------------------------------------------+
diff --git a/PC_Mainboard/clients/tools/init_position.ml b/PC_Mainboard/clients/tools/init_position.ml
new file mode 100644
index 0000000..5ce1172
--- /dev/null
+++ b/PC_Mainboard/clients/tools/init_position.ml
@@ -0,0 +1,36 @@
+(*
+ * init_position.ml
+ * ----------------
+ * Copyright : (c) 2010, Jeremie Dimino <je...@di...>
+ * Licence : BSD3
+ *
+ * This file is a part of [kro]bot.
+ *)
+
+(* Put the robot into its initial state *)
+
+open Lwt
+
+lwt () =
+ lwt krobot = Krobot.create () in
+ let colide = React.S.changes (React.S.map Util.back_colide (Krobot.logic_sensors krobot)) in
+
+ Log#notice "moving backward";
+ lwt () = Krobot.move krobot ~dist:(-1000) ~speed:100 ~acc:100 in
+ Log#notice "waiting for colision";
+ lwt _ = Lwt_event.next colide in
+ Log#notice "backward colisiton dectected";
+
+ Log#notice "going to initial position on first axis";
+ lwt () = Krobot.move krobot ~dist:Config.initial_position ~speed:400 ~acc:800 in
+
+ Log#notice "turning";
+ lwt () = Krobot.turn krobot ~angle:90 ~speed:400 ~acc:800 in
+ Log#notice "moving backward";
+ lwt () = Krobot.move krobot ~dist:(-1000) ~speed:100 ~acc:50 in
+ Log#notice "waiting for colision";
+ lwt _ = Lwt_event.next colide in
+ Log#notice "backward colisiton dectected";
+
+ Log#notice "going to initial position on second axis";
+ Krobot.move krobot ~dist:Config.initial_position ~speed:400 ~acc:800
hooks/post-receive
--
krobot
|