From: Jérémie D. <Ba...@us...> - 2010-05-09 16:39:17
|
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 52b5193323033b0809ef32a3a4dcd1c5eeda496f (commit) from 32305d14f1b6e3b39f5641e3a84fe452666eb6c0 (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 52b5193323033b0809ef32a3a4dcd1c5eeda496f Author: Jérémie Dimino <je...@di...> Date: Sun May 9 18:38:45 2010 +0200 add a program to record value measured by the infrared sensors ----------------------------------------------------------------------- Changes: diff --git a/info/control/Makefile b/info/control/Makefile index 55734c8..d0e971f 100644 --- a/info/control/Makefile +++ b/info/control/Makefile @@ -42,6 +42,8 @@ install: install -m 0755 _build/driver/driver.best $(PREFIX)/bin/krobot-driver install -m 0755 _build/clients/ax12_control.best $(PREFIX)/bin/krobot-ax12 install -m 0755 _build/clients/check.best $(PREFIX)/bin/krobot-check + install -m 0755 _build/clients/check.best $(PREFIX)/bin/krobot-check + install -m 0755 _build/clients/record_infrared.best $(PREFIX)/bin/krobot-record-infrared .PHONY: uninstall uninstall: diff --git a/info/control/clients/record_infrared.ml b/info/control/clients/record_infrared.ml new file mode 100644 index 0000000..f850fe5 --- /dev/null +++ b/info/control/clients/record_infrared.ml @@ -0,0 +1,31 @@ +(* + * record_infrared.ml + * ------------------ + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* Record measures of the infrared sensors at each centimerters *) + +open Lwt +open Lwt_io + +let step = 10 + +lwt () = + lwt () = printl "type Ctrl+C to stop" in + lwt krobot = Krobot.create () in + lwt infrareds = OBus_property.monitor (Krobot.Infrared.states krobot) in + let oc = Lwt_io.open_file ~mode:Lwt_io.output "infrareds-record" in + let rec loop dist = + lwt () = Lwt_unix.sleep 1.0 in + let i1, i2 = React.S.value infrareds in + lwt () = printlf "at distance %d mm: i1 = %d, i2 = %d" dist i1 i2 in + lwt () = fprintlf oc "%d %d %d" dist i1 i2 in + lwt () = Lwt_io.flush oc in + lwt _ = Krobot.Motors.move krobot ~distance:(-step) ~velocity:200 ~acceleration:400 in + loop (dist + step) + in + loop 0 diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index f9dce15..e436a62 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -75,6 +75,7 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, (have_lwt_unix && have_obus && have_sdl, "clients/joy_control.best"); (have_lwt_unix && have_obus && have_lwt_text, "clients/ax12_control.best"); (have_lwt_unix && have_obus && have_lwt_text, "clients/check.best"); + (have_lwt_unix && have_obus, "clients/record_infrared.best"); (* Services *) (have_lwt_unix && have_obus, "services/hard_stop.best"); hooks/post-receive -- krobot |