From: Jérémie D. <Ba...@us...> - 2011-03-30 20:46:04
|
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 e7c92edc9c0d24e0ad519fc88ab61c355109b9cc (commit) via 3762e030dcc2ee5fcc4bcefbbac84dcfcc8381c4 (commit) via 8cbe2604c014064abcab2c9a65b5942b7e4ae3b8 (commit) via 92a5e4be9ce33bfce7a33372d479545465d9815c (commit) from 09a86b1ab86b522c506e66519d27257f77a7d02b (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 e7c92edc9c0d24e0ad519fc88ab61c355109b9cc Author: Jérémie Dimino <je...@di...> Date: Wed Mar 30 22:45:29 2011 +0200 [krobot_viewer] fix the slowing problem commit 3762e030dcc2ee5fcc4bcefbbac84dcfcc8381c4 Author: Jérémie Dimino <je...@di...> Date: Wed Mar 30 22:41:49 2011 +0200 [info] fix frame id for motor_stop and set_odometry commit 8cbe2604c014064abcab2c9a65b5942b7e4ae3b8 Author: Jérémie Dimino <je...@di...> Date: Wed Mar 30 22:08:41 2011 +0200 [krobot_viewer] no threads needed commit 92a5e4be9ce33bfce7a33372d479545465d9815c Author: Jérémie Dimino <je...@di...> Date: Wed Mar 30 21:59:57 2011 +0200 [krobot_viewer] wait longer before passing to the next command ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index 450a1bc..1292204 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -135,7 +135,7 @@ Executable "krobot-viewer" Install$: flag(gtk) CompiledObject: best MainIs: krobot_viewer.ml - BuildDepends: krobot, lwt.syntax, cairo.lablgtk2, lwt.glib, threads, lablgtk2.glade + BuildDepends: krobot, lwt.syntax, cairo.lablgtk2, lwt.glib, lablgtk2.glade Executable "krobot-simulator" Path: src/tools diff --git a/info/control2011/_tags b/info/control2011/_tags index 20baf17..2f57243 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,7 +2,7 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 255c5daac028047b8fd81335cc7a3a1d) +# DO NOT EDIT (digest: 9d40de9cfde679815e27aa44dbe6939f) # Library krobot-interfaces "src/interfaces": include "src/interfaces/krobot-interfaces.cmxs": use_krobot-interfaces @@ -56,7 +56,6 @@ # Executable krobot-viewer <src/tools/krobot_viewer.{native,byte}>: use_krobot <src/tools/krobot_viewer.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_viewer.{native,byte}>: pkg_threads <src/tools/krobot_viewer.{native,byte}>: pkg_obus <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.unix <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.syntax diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 58c15ed..08cc900 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,7 +1,7 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 7b180d572761c507057af7fdf11b0222) *) +(* DO NOT EDIT (digest: 570b31c8f48685aca9662d28e560f425) *) module OASISGettext = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" let ns_ str = str @@ -24,7 +24,7 @@ module OASISGettext = struct end module OASISExpr = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" @@ -115,7 +115,7 @@ end module BaseEnvLight = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) @@ -212,7 +212,7 @@ end module MyOCamlbuildFindlib = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" +# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild @@ -320,7 +320,7 @@ module MyOCamlbuildFindlib = struct end module MyOCamlbuildBase = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall @@ -335,7 +335,7 @@ module MyOCamlbuildBase = struct type name = string type tag = string -# 55 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 55 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 3f22dfe..48d05a0 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,14 +1,14 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: e7a994aa7e43385f1fc743e7a7663a49) *) +(* DO NOT EDIT (digest: 60affd9777295d3612011711e6241ee4) *) (* Regenerated by OASIS v0.2.0 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" let ns_ str = str @@ -31,7 +31,7 @@ module OASISGettext = struct end module OASISContext = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISContext.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISContext.ml" open OASISGettext @@ -90,7 +90,7 @@ module OASISContext = struct end module OASISUtils = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISUtils.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISUtils.ml" module MapString = Map.Make(String) @@ -242,7 +242,7 @@ module OASISUtils = struct end module PropList = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/PropList.ml" +# 21 "/home/dim/sources/oasis/src/oasis/PropList.ml" open OASISGettext @@ -277,7 +277,7 @@ module PropList = struct let clear t = Hashtbl.clear t -# 59 "/home/krobot/ocaml-stuff/oasis/src/oasis/PropList.ml" +# 59 "/home/dim/sources/oasis/src/oasis/PropList.ml" end module Schema = @@ -518,7 +518,7 @@ module PropList = struct end module OASISMessage = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISMessage.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISMessage.ml" open OASISGettext @@ -567,7 +567,7 @@ module OASISMessage = struct end module OASISVersion = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISVersion.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISVersion.ml" open OASISGettext @@ -751,7 +751,7 @@ module OASISVersion = struct end module OASISLicense = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISLicense.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISLicense.ml" (** License for _oasis fields @author Sylvain Le Gall @@ -784,7 +784,7 @@ module OASISLicense = struct end module OASISExpr = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" @@ -874,7 +874,7 @@ module OASISExpr = struct end module OASISTypes = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISTypes.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" @@ -951,7 +951,7 @@ module OASISTypes = struct type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list -# 102 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISTypes.ml" +# 102 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" type 'a conditional = 'a OASISExpr.choices @@ -1105,7 +1105,7 @@ module OASISTypes = struct end module OASISUnixPath = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISUnixPath.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISUnixPath.ml" type unix_filename = string type unix_dirname = string @@ -1184,7 +1184,7 @@ module OASISUnixPath = struct end module OASISSection = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISSection.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISSection.ml" (** Manipulate section @author Sylvain Le Gall @@ -1246,12 +1246,12 @@ module OASISSection = struct end module OASISBuildSection = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISBuildSection.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISBuildSection.ml" end module OASISExecutable = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISExecutable.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISExecutable.ml" open OASISTypes @@ -1282,7 +1282,7 @@ module OASISExecutable = struct end module OASISLibrary = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISLibrary.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISLibrary.ml" open OASISTypes open OASISUtils @@ -1573,33 +1573,33 @@ module OASISLibrary = struct end module OASISFlag = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISFlag.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISFlag.ml" end module OASISPackage = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISPackage.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISSourceRepository.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISSourceRepository.ml" end module OASISTest = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISTest.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISTest.ml" end module OASISDocument = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/oasis/OASISDocument.ml" +# 21 "/home/dim/sources/oasis/src/oasis/OASISDocument.ml" end module BaseEnvLight = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) @@ -1696,7 +1696,7 @@ end module BaseContext = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseContext.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseContext.ml" open OASISContext @@ -1707,7 +1707,7 @@ module BaseContext = struct end module BaseMessage = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseMessage.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseMessage.ml" (** Message to user, overrid for Base @author Sylvain Le Gall @@ -1728,7 +1728,7 @@ module BaseMessage = struct end module BaseFilePath = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseFilePath.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseFilePath.ml" open Filename @@ -1760,7 +1760,7 @@ module BaseFilePath = struct end module BaseEnv = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseEnv.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseEnv.ml" open OASISTypes open OASISGettext @@ -2219,7 +2219,7 @@ module BaseEnv = struct end module BaseExec = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseExec.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseExec.ml" open OASISGettext open OASISUtils @@ -2279,7 +2279,7 @@ module BaseExec = struct end module BaseFileUtil = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseFileUtil.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseFileUtil.ml" open OASISGettext @@ -2457,7 +2457,7 @@ module BaseFileUtil = struct end module BaseArgExt = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseArgExt.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseArgExt.ml" open OASISUtils open OASISGettext @@ -2485,7 +2485,7 @@ module BaseArgExt = struct end module BaseCheck = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseCheck.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseCheck.ml" open BaseEnv open BaseMessage @@ -2611,7 +2611,7 @@ module BaseCheck = struct end module BaseOCamlcConfig = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseOCamlcConfig.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseOCamlcConfig.ml" open BaseEnv @@ -2713,7 +2713,7 @@ module BaseOCamlcConfig = struct end module BaseStandardVar = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseStandardVar.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseStandardVar.ml" open OASISGettext @@ -2973,7 +2973,7 @@ module BaseStandardVar = struct end module BaseFileAB = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseFileAB.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseFileAB.ml" open BaseEnv open OASISGettext @@ -3021,7 +3021,7 @@ module BaseFileAB = struct end module BaseLog = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseLog.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseLog.ml" open OASISUtils @@ -3140,7 +3140,7 @@ module BaseLog = struct end module BaseBuilt = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseBuilt.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseBuilt.ml" open OASISTypes open OASISGettext @@ -3287,7 +3287,7 @@ module BaseBuilt = struct end module BaseCustom = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseCustom.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseCustom.ml" open BaseEnv open BaseMessage @@ -3337,7 +3337,7 @@ module BaseCustom = struct end module BaseDynVar = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseDynVar.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseDynVar.ml" open OASISTypes @@ -3381,7 +3381,7 @@ module BaseDynVar = struct end module BaseTest = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseTest.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseTest.ml" open BaseEnv open BaseMessage @@ -3463,7 +3463,7 @@ module BaseTest = struct end module BaseDoc = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseDoc.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseDoc.ml" open BaseEnv open BaseMessage @@ -3493,7 +3493,7 @@ module BaseDoc = struct end module BaseSetup = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseSetup.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseSetup.ml" open BaseEnv open BaseMessage @@ -3911,7 +3911,7 @@ module BaseSetup = struct end module BaseDev = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/base/BaseDev.ml" +# 21 "/home/dim/sources/oasis/src/base/BaseDev.ml" @@ -3969,7 +3969,7 @@ end module InternalConfigurePlugin = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/internal/InternalConfigurePlugin.ml" +# 21 "/home/dim/sources/oasis/src/plugins/internal/InternalConfigurePlugin.ml" (** Configure using internal scheme @author Sylvain Le Gall @@ -4185,7 +4185,7 @@ module InternalConfigurePlugin = struct end module InternalInstallPlugin = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/internal/InternalInstallPlugin.ml" +# 21 "/home/dim/sources/oasis/src/plugins/internal/InternalInstallPlugin.ml" (** Install using internal scheme @author Sylvain Le Gall @@ -4584,7 +4584,7 @@ end module OCamlbuildCommon = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/OCamlbuildCommon.ml" +# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/OCamlbuildCommon.ml" (** Functions common to OCamlbuild build and doc plugin *) @@ -4684,7 +4684,7 @@ module OCamlbuildCommon = struct end module OCamlbuildPlugin = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" +# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" (** Build using ocamlbuild @author Sylvain Le Gall @@ -4928,7 +4928,7 @@ module OCamlbuildPlugin = struct end module OCamlbuildDocPlugin = struct -# 21 "/home/krobot/ocaml-stuff/oasis/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" +# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall @@ -5307,7 +5307,6 @@ let setup_t = FindlibPackage ("lwt.syntax", None); FindlibPackage ("cairo.lablgtk2", None); FindlibPackage ("lwt.glib", None); - FindlibPackage ("threads", None); FindlibPackage ("lablgtk2.glade", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"]; diff --git a/info/control2011/src/lib/krobot_message.ml b/info/control2011/src/lib/krobot_message.ml index a68a8b3..08e4402 100644 --- a/info/control2011/src/lib/krobot_message.ml +++ b/info/control2011/src/lib/krobot_message.ml @@ -139,17 +139,6 @@ let encode = function ~remote:false ~format:F29bits ~data - | Set_odometry(x, y, theta) -> - let data = String.create 6 in - put_sint16 data 0 (truncate (x *. 1000.)); - put_sint16 data 2 (truncate (y *. 1000.)); - put_sint16 data 4 (truncate (theta /. pi *. 18000.)); - frame - ~identifier:105 - ~kind:Data - ~remote:false - ~format:F29bits - ~data | Motor_move(dist, speed, acc) -> let data = String.create 8 in put_sint32 data 0 (truncate (dist *. 1000.)); @@ -172,13 +161,24 @@ let encode = function ~remote:false ~format:F29bits ~data - | Motor_stop -> + | Set_odometry(x, y, theta) -> + let data = String.create 6 in + put_sint16 data 0 (truncate (x *. 1000.)); + put_sint16 data 2 (truncate (y *. 1000.)); + put_sint16 data 4 (truncate (theta /. pi *. 18000.)); frame ~identifier:203 ~kind:Data ~remote:false ~format:F29bits - ~data:"" + ~data + | Motor_stop -> + frame + ~identifier:204 + ~kind:Data + ~remote:false + ~format:F29bits + ~data:"\x01" | Req_motor_status -> frame ~identifier:103 @@ -223,11 +223,6 @@ let decode frame = (float (get_sint16 frame.data 0) /. 1000., float (get_sint16 frame.data 2) /. 1000., float (get_sint16 frame.data 4) *. pi /. 18000.) - | 105 -> - Set_odometry - (float (get_sint16 frame.data 0) /. 1000., - float (get_sint16 frame.data 2) /. 1000., - float (get_sint16 frame.data 4) *. pi /. 18000.) | 201 -> Motor_move (float (get_sint32 frame.data 0) /. 1000., @@ -239,6 +234,11 @@ let decode frame = float (get_uint16 frame.data 4) *. pi /. 18000., float (get_uint16 frame.data 6) *. pi /. 18000.) | 203 -> + Set_odometry + (float (get_sint16 frame.data 0) /. 1000., + float (get_sint16 frame.data 2) /. 1000., + float (get_sint16 frame.data 4) *. pi /. 18000.) + | 204 -> Motor_stop | _ -> Unknown frame @@ -249,33 +249,3 @@ let decode frame = let send bus (timestamp, msg) = Krobot_can.send bus (timestamp, encode msg) let recv bus = E.map (fun (timestamp, frame) -> (timestamp, decode frame)) (Krobot_can.recv bus) - -(* +-----------------------------------------------------------------+ - | Calls | - +-----------------------------------------------------------------+ *) - -let wait_timeout = 0.1 - -let send_and_recv bus req f = - let t = - E.next - (E.fmap - (fun (ts, frame) -> - match f frame with - | Some x -> Some(`Value(ts, x)) - | None -> None) - (recv bus)) - in - let rec loop () = - lwt () = send bus (Unix.gettimeofday (), req) in - match_lwt choose [t; Lwt_unix.sleep wait_timeout >|= fun () -> `Timeout] with - | `Value x -> return x - | `Timeout -> loop () - in - loop () - -let motor_status bus = - send_and_recv bus Req_motor_status - (function - | Motor_status status -> Some status - | _ -> None) diff --git a/info/control2011/src/lib/krobot_message.mli b/info/control2011/src/lib/krobot_message.mli index d1cb523..298572d 100644 --- a/info/control2011/src/lib/krobot_message.mli +++ b/info/control2011/src/lib/krobot_message.mli @@ -66,9 +66,3 @@ val send : Krobot_bus.t -> (float * t) -> unit Lwt.t val recv : Krobot_bus.t -> (float * t) React.event (** [recv bus] is the event which receive messages. *) - -(** {6 Calls} *) - -(** The following functions send a request and wait for the result. *) - -val motor_status : Krobot_bus.t -> (float * bool) Lwt.t diff --git a/info/control2011/src/tools/krobot_viewer.ml b/info/control2011/src/tools/krobot_viewer.ml index 2665d0f..a3d7a79 100644 --- a/info/control2011/src/tools/krobot_viewer.ml +++ b/info/control2011/src/tools/krobot_viewer.ml @@ -192,6 +192,7 @@ module Board = struct mutable state : state; mutable points : (float * float) list; mutable event : unit event; + mutable moving : bool; } type color = @@ -451,9 +452,8 @@ module Board = struct queue_draw board let rec wait_done board = - lwt () = Lwt_unix.sleep 0.05 in - lwt ts, moving = Krobot_message.motor_status board.bus in - if moving then + lwt () = Lwt_unix.sleep 0.2 in + if board.moving then wait_done board else return () @@ -498,6 +498,7 @@ module Board = struct state = { x = 0.2; y = 1.9; theta = -0.5 *. pi }; points = []; event = E.never; + moving = false; } in (* Move the robot on the board when we receive odometry informations. *) @@ -513,8 +514,10 @@ module Board = struct queue_draw board end | Motor_status true -> + board.moving <- true; board.ui#entry_moving#set_text "yes" | Motor_status false -> + board.moving <- false; board.ui#entry_moving#set_text "no" | _ -> ()) @@ -611,8 +614,11 @@ lwt () = ); false)); - (* Ask for the status of the motor in order to display the correct - status initially. *) - lwt () = Krobot_message.send bus (Unix.gettimeofday (), Req_motor_status) in - - waiter + pick [ + waiter; + (* Sends motor status request continously. *) + while_lwt true do + lwt () = Krobot_message.send bus (Unix.gettimeofday (), Req_motor_status) in + Lwt_unix.sleep 0.2 + done; + ] hooks/post-receive -- krobot |