From: Jérémie D. <Ba...@us...> - 2011-04-19 12:27:07
|
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 3f167129823c37347beb03b6774740ae5b7689c2 (commit) from 3c5104a9beb21ba05f513b15c7798075364ca875 (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 3f167129823c37347beb03b6774740ae5b7689c2 Author: Jérémie Dimino <je...@di...> Date: Tue Apr 19 14:25:03 2011 +0200 [info] drop D-Bus in flavor of a simple home made network protocol ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_oasis b/info/control2011/_oasis index c14f942..89543d8 100644 --- a/info/control2011/_oasis +++ b/info/control2011/_oasis @@ -31,18 +31,17 @@ Flag gtk Library krobot FindlibName: krobot - BuildDepends: lwt.unix, lwt.syntax, obus, krobot.interfaces + BuildDepends: lwt.unix, lwt.syntax, lwt.react XMETADescription: The [Kro]bot library - XMETARequires: lwt.unix, obus, krobot.interfaces + XMETARequires: lwt.unix, lwt.react Path: src/lib Install: true Modules: Krobot_can, Krobot_bus, Krobot_message, - Krobot_service, Krobot_geom, - Krobot_planner + Krobot_config CSources: krobot_message_stubs.c @@ -57,19 +56,6 @@ Library "krobot-can" Modules: Krobot_can_bus CSources: can_stubs.c -Library "krobot-interfaces" - FindlibName: interfaces - FindlibParent: krobot - BuildDepends: obus - XMETADescription: [Kro]bot D-Bus interfaces - XMETARequires: obus - Path: src/interfaces - Install: true - Modules: - Krobot_interface_can, - Krobot_interface_service, - Krobot_interface_planner - # +-------------------------------------------------------------------+ # | The driver | # +-------------------------------------------------------------------+ @@ -80,12 +66,18 @@ Executable "krobot-driver" CompiledObject: best MainIs: krobot_driver.ml BuildDepends: krobot.can, lwt.syntax - DataFiles: bus.conf # +-------------------------------------------------------------------+ # | Tools | # +-------------------------------------------------------------------+ +Executable "krobot-hub" + Path: src/tools + Install: true + CompiledObject: best + MainIs: krobot_hub.ml + BuildDepends: lwt.unix, lwt.syntax + Executable "krobot-dump" Path: src/tools Install: true @@ -102,7 +94,8 @@ Executable "krobot-dump-encoders" Executable "krobot-record" Path: src/tools - Install: true + Install: false + Build: false CompiledObject: best MainIs: krobot_record.ml BuildDepends: krobot, lwt.syntax @@ -114,20 +107,6 @@ Executable "krobot-replay" MainIs: krobot_replay.ml BuildDepends: krobot, lwt.syntax -Executable "krobot-remote" - Path: src/tools - Install: true - CompiledObject: best - MainIs: krobot_remote.ml - BuildDepends: krobot, lwt.syntax - -Executable "krobot-local" - Path: src/tools - Install: true - CompiledObject: best - MainIs: krobot_local.ml - BuildDepends: krobot, lwt.syntax - Executable "krobot-plot" Path: src/tools Build$: flag(gtk) @@ -166,17 +145,12 @@ Executable "krobot-hil-simulator" MainIs: krobot_hil_simulator.ml BuildDepends: krobot, lwt.syntax -# +-------------------------------------------------------------------+ -# | Services | -# +-------------------------------------------------------------------+ - -Executable "krobot-service-planner" - Path: src/services +Executable "krobot-planner" + Path: src/tools Install: true CompiledObject: best - MainIs: krobot_service_planner.ml + MainIs: krobot_planner.ml BuildDepends: krobot, lwt.syntax - DataFiles: fr.krobot.Service.Planner.service ($datadir/$pkg_name/services) # +-------------------------------------------------------------------+ # | Examples | diff --git a/info/control2011/_tags b/info/control2011/_tags index 650cedb..cadd635 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,160 +2,122 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 28c051595fc8936deb8eca602b892268) -# Library krobot-interfaces -"src/interfaces": include -"src/interfaces/krobot-interfaces.cmxs": use_krobot-interfaces -<src/interfaces/*.ml{,i}>: pkg_obus +# DO NOT EDIT (digest: 1679d4e007e0054354522251924e527a) # Library krobot "src/lib": include "src/lib/krobot.cmxs": use_krobot <src/lib/krobot.{cma,cmxa}>: use_libkrobot -<src/lib/*.ml{,i}>: use_krobot-interfaces -<src/lib/*.ml{,i}>: pkg_obus <src/lib/*.ml{,i}>: pkg_lwt.unix <src/lib/*.ml{,i}>: pkg_lwt.syntax -"src/lib/krobot_message_stubs.c": use_krobot-interfaces -"src/lib/krobot_message_stubs.c": pkg_obus +<src/lib/*.ml{,i}>: pkg_lwt.react "src/lib/krobot_message_stubs.c": pkg_lwt.unix "src/lib/krobot_message_stubs.c": pkg_lwt.syntax +"src/lib/krobot_message_stubs.c": pkg_lwt.react # Library krobot-can "src/can": include "src/can/krobot-can.cmxs": use_krobot-can <src/can/krobot-can.{cma,cmxa}>: use_libkrobot-can <src/can/*.ml{,i}>: use_krobot -<src/can/*.ml{,i}>: use_krobot-interfaces -<src/can/*.ml{,i}>: pkg_obus <src/can/*.ml{,i}>: pkg_lwt.unix <src/can/*.ml{,i}>: pkg_lwt.syntax +<src/can/*.ml{,i}>: pkg_lwt.react "src/can/can_stubs.c": use_krobot -"src/can/can_stubs.c": use_krobot-interfaces -"src/can/can_stubs.c": pkg_obus "src/can/can_stubs.c": pkg_lwt.unix "src/can/can_stubs.c": pkg_lwt.syntax +"src/can/can_stubs.c": pkg_lwt.react # Executable krobot-dump <src/tools/krobot_dump.{native,byte}>: use_krobot -<src/tools/krobot_dump.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_dump.{native,byte}>: pkg_obus <src/tools/krobot_dump.{native,byte}>: pkg_lwt.unix <src/tools/krobot_dump.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.react # Executable krobot-dump-encoders <src/tools/krobot_dump_encoders.{native,byte}>: use_krobot -<src/tools/krobot_dump_encoders.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_obus <src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.unix <src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.react # Executable krobot-driver <src/driver/krobot_driver.{native,byte}>: use_krobot-can <src/driver/krobot_driver.{native,byte}>: use_krobot -<src/driver/krobot_driver.{native,byte}>: use_krobot-interfaces -<src/driver/krobot_driver.{native,byte}>: pkg_obus <src/driver/krobot_driver.{native,byte}>: pkg_lwt.unix <src/driver/krobot_driver.{native,byte}>: pkg_lwt.syntax +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.react <src/driver/*.ml{,i}>: use_krobot-can <src/driver/*.ml{,i}>: use_krobot -<src/driver/*.ml{,i}>: use_krobot-interfaces -<src/driver/*.ml{,i}>: pkg_obus <src/driver/*.ml{,i}>: pkg_lwt.unix <src/driver/*.ml{,i}>: pkg_lwt.syntax +<src/driver/*.ml{,i}>: pkg_lwt.react # 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_obus <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.unix <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_viewer.{native,byte}>: pkg_lwt.react <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.glib <src/tools/krobot_viewer.{native,byte}>: pkg_lablgtk2.glade <src/tools/krobot_viewer.{native,byte}>: pkg_cairo.lablgtk2 <src/tools/*.ml{,i}>: pkg_lablgtk2.glade # Executable krobot-hil-simulator <src/tools/krobot_hil_simulator.{native,byte}>: use_krobot -<src/tools/krobot_hil_simulator.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_hil_simulator.{native,byte}>: pkg_obus <src/tools/krobot_hil_simulator.{native,byte}>: pkg_lwt.unix <src/tools/krobot_hil_simulator.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_hil_simulator.{native,byte}>: pkg_lwt.react +# Executable krobot-hub +<src/tools/krobot_hub.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_hub.{native,byte}>: pkg_lwt.syntax # Executable send-can <examples/send_can.{native,byte}>: use_krobot-can <examples/send_can.{native,byte}>: use_krobot -<examples/send_can.{native,byte}>: use_krobot-interfaces -<examples/send_can.{native,byte}>: pkg_obus <examples/send_can.{native,byte}>: pkg_lwt.unix <examples/send_can.{native,byte}>: pkg_lwt.syntax +<examples/send_can.{native,byte}>: pkg_lwt.react # Executable krobot-plot-battery <src/tools/krobot_plot_battery.{native,byte}>: use_krobot -<src/tools/krobot_plot_battery.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_plot_battery.{native,byte}>: pkg_obus <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.unix <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.react <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.glib <src/tools/krobot_plot_battery.{native,byte}>: pkg_cairo.lablgtk2 -# Executable krobot-service-planner -<src/services/krobot_service_planner.{native,byte}>: use_krobot -<src/services/krobot_service_planner.{native,byte}>: use_krobot-interfaces -<src/services/krobot_service_planner.{native,byte}>: pkg_obus -<src/services/krobot_service_planner.{native,byte}>: pkg_lwt.unix -<src/services/krobot_service_planner.{native,byte}>: pkg_lwt.syntax -<src/services/*.ml{,i}>: use_krobot -<src/services/*.ml{,i}>: use_krobot-interfaces -<src/services/*.ml{,i}>: pkg_obus -<src/services/*.ml{,i}>: pkg_lwt.unix -<src/services/*.ml{,i}>: pkg_lwt.syntax -# Executable krobot-remote -<src/tools/krobot_remote.{native,byte}>: use_krobot -<src/tools/krobot_remote.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_remote.{native,byte}>: pkg_obus -<src/tools/krobot_remote.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_remote.{native,byte}>: pkg_lwt.syntax # Executable krobot-replay <src/tools/krobot_replay.{native,byte}>: use_krobot -<src/tools/krobot_replay.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_replay.{native,byte}>: pkg_obus <src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix <src/tools/krobot_replay.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.react # Executable dump-can <examples/dump_can.{native,byte}>: use_krobot-can <examples/dump_can.{native,byte}>: use_krobot -<examples/dump_can.{native,byte}>: use_krobot-interfaces -<examples/dump_can.{native,byte}>: pkg_obus <examples/dump_can.{native,byte}>: pkg_lwt.unix <examples/dump_can.{native,byte}>: pkg_lwt.syntax +<examples/dump_can.{native,byte}>: pkg_lwt.react <examples/*.ml{,i}>: use_krobot-can <examples/*.ml{,i}>: use_krobot -<examples/*.ml{,i}>: use_krobot-interfaces -<examples/*.ml{,i}>: pkg_obus <examples/*.ml{,i}>: pkg_lwt.unix <examples/*.ml{,i}>: pkg_lwt.syntax -# Executable krobot-local -<src/tools/krobot_local.{native,byte}>: use_krobot -<src/tools/krobot_local.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_local.{native,byte}>: pkg_obus -<src/tools/krobot_local.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_local.{native,byte}>: pkg_lwt.syntax +<examples/*.ml{,i}>: pkg_lwt.react +# Executable krobot-planner +<src/tools/krobot_planner.{native,byte}>: use_krobot +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.react # Executable krobot-record <src/tools/krobot_record.{native,byte}>: use_krobot -<src/tools/krobot_record.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_record.{native,byte}>: pkg_obus <src/tools/krobot_record.{native,byte}>: pkg_lwt.unix <src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_record.{native,byte}>: pkg_lwt.react # Executable krobot-plot <src/tools/krobot_plot.{native,byte}>: use_krobot -<src/tools/krobot_plot.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_plot.{native,byte}>: pkg_obus <src/tools/krobot_plot.{native,byte}>: pkg_lwt.unix <src/tools/krobot_plot.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_plot.{native,byte}>: pkg_lwt.react <src/tools/krobot_plot.{native,byte}>: pkg_lwt.glib <src/tools/krobot_plot.{native,byte}>: pkg_cairo.lablgtk2 <src/tools/*.ml{,i}>: pkg_lwt.glib <src/tools/*.ml{,i}>: pkg_cairo.lablgtk2 # Executable krobot-simulator <src/tools/krobot_simulator.{native,byte}>: use_krobot -<src/tools/krobot_simulator.{native,byte}>: use_krobot-interfaces -<src/tools/krobot_simulator.{native,byte}>: pkg_obus <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix <src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react <src/tools/*.ml{,i}>: use_krobot -<src/tools/*.ml{,i}>: use_krobot-interfaces -<src/tools/*.ml{,i}>: pkg_obus <src/tools/*.ml{,i}>: pkg_lwt.unix <src/tools/*.ml{,i}>: pkg_lwt.syntax +<src/tools/*.ml{,i}>: pkg_lwt.react # OASIS_STOP diff --git a/info/control2011/krobot-api.odocl b/info/control2011/krobot-api.odocl index c450da7..1e10a3e 100644 --- a/info/control2011/krobot-api.odocl +++ b/info/control2011/krobot-api.odocl @@ -1,10 +1,9 @@ # OASIS_START -# DO NOT EDIT (digest: 38c17322394dfbb39f5f25c95efe932e) +# DO NOT EDIT (digest: 802a60f0417652c8e0b1a85294fd57f0) src/lib/Krobot_can src/lib/Krobot_bus src/lib/Krobot_message -src/lib/Krobot_service src/lib/Krobot_geom -src/lib/Krobot_planner +src/lib/Krobot_config src/can/Krobot_can_bus # OASIS_STOP diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 20d8e84..73d0550 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 1ca7268f789f49955feedef89f6b4ca9) *) +(* DO NOT EDIT (digest: 6313720c4a9fa3712417ffee35de107d) *) module OASISGettext = struct # 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" @@ -452,11 +452,7 @@ open Ocamlbuild_plugin;; let package_default = { MyOCamlbuildBase.lib_ocaml = - [ - ("src/interfaces/krobot-interfaces", ["src/interfaces"]); - ("src/lib/krobot", ["src/lib"]); - ("src/can/krobot-can", ["src/can"]) - ]; + [("src/lib/krobot", ["src/lib"]); ("src/can/krobot-can", ["src/can"])]; lib_c = [("krobot", "src/lib", []); ("krobot-can", "src/can", [])]; flags = []; } diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 5b8befa..ecae0d6 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: b04695e11f7527ee760b637f6ae5beb4) *) +(* DO NOT EDIT (digest: 59697e01816cd0990967d00e7a4e65f9) *) (* Regenerated by OASIS v0.2.0 Visit http://oasis.forge.ocamlcore.org for more information and @@ -5058,40 +5058,6 @@ let setup_t = [ Library ({ - cs_name = "krobot-interfaces"; - cs_data = PropList.Data.create (); - cs_plugin_data = []; - }, - { - bs_build = [(OASISExpr.EBool true, true)]; - bs_install = [(OASISExpr.EBool true, true)]; - bs_path = "src/interfaces"; - bs_compiled_object = Best; - bs_build_depends = [FindlibPackage ("obus", None)]; - bs_build_tools = [ExternalTool "ocamlbuild"]; - bs_c_sources = []; - bs_data_files = []; - bs_ccopt = [(OASISExpr.EBool true, [])]; - bs_cclib = [(OASISExpr.EBool true, [])]; - bs_dlllib = [(OASISExpr.EBool true, [])]; - bs_dllpath = [(OASISExpr.EBool true, [])]; - bs_byteopt = [(OASISExpr.EBool true, [])]; - bs_nativeopt = [(OASISExpr.EBool true, [])]; - }, - { - lib_modules = - [ - "Krobot_interface_can"; - "Krobot_interface_service"; - "Krobot_interface_planner" - ]; - lib_internal_modules = []; - lib_findlib_parent = Some "krobot"; - lib_findlib_name = Some "interfaces"; - lib_findlib_containers = []; - }); - Library - ({ cs_name = "krobot"; cs_data = PropList.Data.create (); cs_plugin_data = []; @@ -5105,8 +5071,7 @@ let setup_t = [ FindlibPackage ("lwt.unix", None); FindlibPackage ("lwt.syntax", None); - FindlibPackage ("obus", None); - InternalLibrary "krobot-interfaces" + FindlibPackage ("lwt.react", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"]; bs_c_sources = ["krobot_message_stubs.c"]; @@ -5124,9 +5089,8 @@ let setup_t = "Krobot_can"; "Krobot_bus"; "Krobot_message"; - "Krobot_service"; "Krobot_geom"; - "Krobot_planner" + "Krobot_config" ]; lib_internal_modules = []; lib_findlib_parent = None; @@ -5283,7 +5247,7 @@ let setup_t = ]; bs_build_tools = [ExternalTool "ocamlbuild"]; bs_c_sources = []; - bs_data_files = [("bus.conf", None)]; + bs_data_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; @@ -5362,6 +5326,33 @@ let setup_t = }); Executable ({ + cs_name = "krobot-hub"; + cs_data = PropList.Data.create (); + cs_plugin_data = []; + }, + { + bs_build = [(OASISExpr.EBool true, true)]; + bs_install = [(OASISExpr.EBool true, true)]; + bs_path = "src/tools"; + bs_compiled_object = Best; + bs_build_depends = + [ + FindlibPackage ("lwt.unix", None); + FindlibPackage ("lwt.syntax", None) + ]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])]; + }, + {exec_custom = false; exec_main_is = "krobot_hub.ml"; }); + Executable + ({ cs_name = "send-can"; cs_data = PropList.Data.create (); cs_plugin_data = []; @@ -5439,67 +5430,6 @@ let setup_t = }); Executable ({ - cs_name = "krobot-service-planner"; - cs_data = PropList.Data.create (); - cs_plugin_data = []; - }, - { - bs_build = [(OASISExpr.EBool true, true)]; - bs_install = [(OASISExpr.EBool true, true)]; - bs_path = "src/services"; - bs_compiled_object = Best; - bs_build_depends = - [ - InternalLibrary "krobot"; - FindlibPackage ("lwt.syntax", None) - ]; - bs_build_tools = [ExternalTool "ocamlbuild"]; - bs_c_sources = []; - bs_data_files = - [ - ("fr.krobot.Service.Planner.service", - Some "$datadir/$pkg_name/services") - ]; - bs_ccopt = [(OASISExpr.EBool true, [])]; - bs_cclib = [(OASISExpr.EBool true, [])]; - bs_dlllib = [(OASISExpr.EBool true, [])]; - bs_dllpath = [(OASISExpr.EBool true, [])]; - bs_byteopt = [(OASISExpr.EBool true, [])]; - bs_nativeopt = [(OASISExpr.EBool true, [])]; - }, - { - exec_custom = false; - exec_main_is = "krobot_service_planner.ml"; - }); - Executable - ({ - cs_name = "krobot-remote"; - cs_data = PropList.Data.create (); - cs_plugin_data = []; - }, - { - bs_build = [(OASISExpr.EBool true, true)]; - bs_install = [(OASISExpr.EBool true, true)]; - bs_path = "src/tools"; - bs_compiled_object = Best; - bs_build_depends = - [ - InternalLibrary "krobot"; - FindlibPackage ("lwt.syntax", None) - ]; - bs_build_tools = [ExternalTool "ocamlbuild"]; - bs_c_sources = []; - bs_data_files = []; - bs_ccopt = [(OASISExpr.EBool true, [])]; - bs_cclib = [(OASISExpr.EBool true, [])]; - bs_dlllib = [(OASISExpr.EBool true, [])]; - bs_dllpath = [(OASISExpr.EBool true, [])]; - bs_byteopt = [(OASISExpr.EBool true, [])]; - bs_nativeopt = [(OASISExpr.EBool true, [])]; - }, - {exec_custom = false; exec_main_is = "krobot_remote.ml"; }); - Executable - ({ cs_name = "krobot-replay"; cs_data = PropList.Data.create (); cs_plugin_data = []; @@ -5554,7 +5484,7 @@ let setup_t = {exec_custom = false; exec_main_is = "dump_can.ml"; }); Executable ({ - cs_name = "krobot-local"; + cs_name = "krobot-planner"; cs_data = PropList.Data.create (); cs_plugin_data = []; }, @@ -5578,7 +5508,8 @@ let setup_t = bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])]; }, - {exec_custom = false; exec_main_is = "krobot_local.ml"; }); + {exec_custom = false; exec_main_is = "krobot_planner.ml"; + }); Executable ({ cs_name = "krobot-record"; @@ -5586,8 +5517,8 @@ let setup_t = cs_plugin_data = []; }, { - bs_build = [(OASISExpr.EBool true, true)]; - bs_install = [(OASISExpr.EBool true, true)]; + bs_build = [(OASISExpr.EBool true, false)]; + bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools"; bs_compiled_object = Best; bs_build_depends = diff --git a/info/control2011/src/driver/bus.conf.ab b/info/control2011/src/driver/bus.conf.ab deleted file mode 100644 index ae988d4..0000000 --- a/info/control2011/src/driver/bus.conf.ab +++ /dev/null @@ -1,34 +0,0 @@ -<!-- Configuration of the D-Bus daemon used by programs of the robot --> - -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Krobot_configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <keep_umask/> - - <!-- Krobot D-Bus daemon default address --> - <listen>unix:abstract=krobot</listen> - - <!-- Directory for .service files --> - <servicedir>$(datadir)/krobot/services</servicedir> - - <!-- Allow everything --> - <policy context="default"> - <allow send_destination="*" eavesdrop="true"/> - <allow eavesdrop="true"/> - <allow own="*"/> - </policy> - - <!-- Raise limits --> - <limit name="max_incoming_bytes">1000000000</limit> - <limit name="max_outgoing_bytes">1000000000</limit> - <limit name="max_message_size">1000000000</limit> - <limit name="service_start_timeout">120000</limit> - <limit name="auth_timeout">240000</limit> - <limit name="max_completed_connections">100000</limit> - <limit name="max_incomplete_connections">10000</limit> - <limit name="max_connections_per_user">100000</limit> - <limit name="max_pending_service_starts">10000</limit> - <limit name="max_names_per_connection">50000</limit> - <limit name="max_match_rules_per_connection">50000</limit> - <limit name="max_replies_per_connection">50000</limit> -</busconfig> diff --git a/info/control2011/src/driver/krobot_driver.ml b/info/control2011/src/driver/krobot_driver.ml index 2d6141a..47004f1 100644 --- a/info/control2011/src/driver/krobot_driver.ml +++ b/info/control2011/src/driver/krobot_driver.ml @@ -11,6 +11,7 @@ open Lwt open Lwt_react +open Krobot_bus (* +-----------------------------------------------------------------+ | Command-line arguments | @@ -46,33 +47,56 @@ lwt () = | _ -> Arg.usage options usage; exit 2 in + (* Open the krobot bus. *) lwt bus = Krobot_bus.get () in - lwt () = Krobot_service.init bus ~kill:!kill ~fork:!fork "Driver" in + + (* Fork if not prevented. *) + if !fork then Lwt_daemon.daemonize (); + + (* Kill any running planner. *) + lwt () = Krobot_bus.send bus (Unix.gettimeofday (), Krobot_bus.Kill "driver") in + + (* The CAN bus, when it is available. *) + let can_opt = ref None in + + (* Handle messages. *) + E.keep + (E.map_s + (fun (ts, msg) -> + match msg with + | Kill "driver" -> + exit 0 + + | CAN frame -> begin + match !can_opt with + | Some can -> + Krobot_can_bus.send can (ts, frame) + | None -> + return () + end + + | _ -> + return ()) + (Krobot_bus.recv bus)); while_lwt true do try_lwt (* Open the CAN bus. *) lwt can = Krobot_can_bus.open_can device in - - let active, set_active = S.create true in - - (* D-Bus --> CAN *) - let ev = E.map_s (Krobot_can_bus.send can) (E.when_ active (Krobot_can.recv bus)) in + can_opt := Some can; try_lwt - (* CAN --> D-Bus *) while_lwt true do - Krobot_can_bus.recv can >>= Krobot_can.send bus + lwt (ts, frame) = Krobot_can_bus.recv can in + Krobot_bus.send bus (ts, CAN frame) done with exn -> - lwt () = Krobot_can_bus.close can in (* Make sure no more messages are sent on the CAN bus. *) - set_active false; - (* This is just here to keep a reference to [ev]. *) - E.stop ev; + can_opt := None; + lwt () = Krobot_can_bus.close can in raise_lwt exn with exn -> - lwt () = Lwt_log.error ~exn "failure" in + ignore (Lwt_log.error ~exn "failure"); if !once then exit 0 else diff --git a/info/control2011/src/interfaces/krobot-interfaces.mllib b/info/control2011/src/interfaces/krobot-interfaces.mllib deleted file mode 100644 index 612c59f..0000000 --- a/info/control2011/src/interfaces/krobot-interfaces.mllib +++ /dev/null @@ -1,6 +0,0 @@ -# OASIS_START -# DO NOT EDIT (digest: 0fb519fe846821801a9941698a640eef) -Krobot_interface_can -Krobot_interface_service -Krobot_interface_planner -# OASIS_STOP diff --git a/info/control2011/src/interfaces/krobot_interface_can.obus b/info/control2011/src/interfaces/krobot_interface_can.obus deleted file mode 100644 index 842d90c..0000000 --- a/info/control2011/src/interfaces/krobot_interface_can.obus +++ /dev/null @@ -1,22 +0,0 @@ -(* - * krobot_interface_can.obus - * ------------------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(** Interface for CAN messages *) -interface fr.krobot.CAN { - (** Signal for CAN frames: - - - when the driver receing a frame from the CAN socket, it send - this signal over D-Bus - - when the driver receive this signal it send it over the CAN - socket - *) - signal message : ( - frame : (double * uint32 * uint32 * boolean * uint32 * byte array) - ) -} diff --git a/info/control2011/src/interfaces/krobot_interface_planner.obus b/info/control2011/src/interfaces/krobot_interface_planner.obus deleted file mode 100644 index ac8f5d7..0000000 --- a/info/control2011/src/interfaces/krobot_interface_planner.obus +++ /dev/null @@ -1,39 +0,0 @@ -(* - * krobot_interface_planner.obus - * ----------------------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(** Interface for the planner. *) - -interface fr.krobot.Planner { - property_r origin : ((double * double) * (double * double)) - (** The origin of the trajectory, with the initial vector. *) - - property_rw vertices : (double * double) array - (** Property holding the current list of vertices for the planned - trajectory. *) - - method add_vertice : (vertice : (double * double)) -> () - (** Add a new vertice after all current ones to [vertices]. *) - - method simplify : (tolerance : double) -> () - (** Simplify the trajectory using the given tolerance. *) - - (** Move the robot according to the current trajectory. *) - method go : ( - rotation_speed : double, - rotation_acceleration : double, - moving_speed : double, - moving_acceleration : double - ) -> () - - method stop : () -> () - (** Stop the current trajectory. *) - - property_r moving : boolean - (** Is the robot currently following a trajectory ? *) -} diff --git a/info/control2011/src/interfaces/krobot_interface_service.obus b/info/control2011/src/interfaces/krobot_interface_service.obus deleted file mode 100644 index 6f5e940..0000000 --- a/info/control2011/src/interfaces/krobot_interface_service.obus +++ /dev/null @@ -1,20 +0,0 @@ -(* - * krobot_interface_service.obus - * ----------------------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(** Interface for krobot services. *) -interface fr.krobot.Service { - (** Make the service to exit. *) - method kill : () -> () - with { - org.freedesktop.DBus.Method.NoReply = "true" - } - - signal log : (message : string) - (** Signal emitted when the service emit a log message. *) -} diff --git a/info/control2011/src/lib/META b/info/control2011/src/lib/META index 8cab18d..dfccb8d 100644 --- a/info/control2011/src/lib/META +++ b/info/control2011/src/lib/META @@ -1,8 +1,8 @@ # OASIS_START -# DO NOT EDIT (digest: 6d4fe02a501933ad8464e70af7fcf3b1) +# DO NOT EDIT (digest: 3dcfd084b393896010b17f3aac3a6423) version = "1.0" description = "The [Kro]bot library" -requires = "lwt.unix obus krobot.interfaces" +requires = "lwt.unix lwt.react" archive(byte) = "krobot.cma" archive(native) = "krobot.cmxa" exists_if = "krobot.cma" @@ -14,14 +14,5 @@ package "can" ( archive(native) = "krobot-can.cmxa" exists_if = "krobot-can.cma" ) - -package "interfaces" ( - version = "1.0" - description = "[Kro]bot D-Bus interfaces" - requires = "obus" - archive(byte) = "krobot-interfaces.cma" - archive(native) = "krobot-interfaces.cmxa" - exists_if = "krobot-interfaces.cma" -) # OASIS_STOP diff --git a/info/control2011/src/lib/krobot.mllib b/info/control2011/src/lib/krobot.mllib index 2d6a922..a445537 100644 --- a/info/control2011/src/lib/krobot.mllib +++ b/info/control2011/src/lib/krobot.mllib @@ -1,9 +1,8 @@ # OASIS_START -# DO NOT EDIT (digest: a2debf72e72f6ae38ea62c8b35c3784d) +# DO NOT EDIT (digest: cd69d2910ad86f88b392f7a3935ab5c4) Krobot_can Krobot_bus Krobot_message -Krobot_service Krobot_geom -Krobot_planner +Krobot_config # OASIS_STOP diff --git a/info/control2011/src/lib/krobot_bus.ml b/info/control2011/src/lib/krobot_bus.ml index 057b8dc..a77f60e 100644 --- a/info/control2011/src/lib/krobot_bus.ml +++ b/info/control2011/src/lib/krobot_bus.ml @@ -7,45 +7,165 @@ * This file is a part of [kro]bot. *) -let section = Lwt_log.Section.make "bus" +open Lwt +open Lwt_react +open Krobot_geom -type t = OBus_bus.t +let section = Lwt_log.Section.make "krobot(bus)" +let port = 50000 -external of_bus : OBus_bus.t -> t = "%identity" -external to_bus : t -> OBus_bus.t = "%identity" +(* +-----------------------------------------------------------------+ + | Types | + +-----------------------------------------------------------------+ *) -let default_address = [OBus_address.make "unix" [("abstract", "krobot")]] +type message = + | CAN of Krobot_can.frame + | Log of string + | Send + | Kill of string + | Trajectory_origin of vertice * vector + | Trajectory_vertices of vertice list + | Trajectory_set_vertices of vertice list + | Trajectory_add_vertice of vertice + | Trajectory_simplify of float + | Trajectory_go of float * float * float * float + | Trajectory_stop + | Trajectory_moving of bool -let address = - match try Some(Sys.getenv "DBUS_KROBOT_BUS_ADDRESS") with Not_found -> None with - | Some str -> begin +type t = { + oc : Lwt_io.output_channel; + recv : (float * message) event; +} + +(* +-----------------------------------------------------------------+ + | Message printer | + +-----------------------------------------------------------------+ *) + +open Printf + +let string_of_vertice v = + sprintf "{ x = %f; y = %f }" v.x v.y + +let string_of_vector v = + sprintf "{ vx = %f; vy = %f }" v.vx v.vy + +let string_of_message = function + | CAN frame -> + sprintf + "CAN %s" + (Krobot_can.string_of_frame frame) + | Log str -> + sprintf + "Log %S" + str + | Send -> + "Send" + | Kill name -> + sprintf + "Kill %S" + name + | Trajectory_origin(o, v) -> + sprintf + "Trajectory_origin(%s, %s)" + (string_of_vertice o) + (string_of_vector v) + | Trajectory_vertices l -> + sprintf + "Trajectory_vertices [%s]" + (String.concat "; " (List.map string_of_vertice l)) + | Trajectory_set_vertices l -> + sprintf + "Trajectory_set_vertices [%s]" + (String.concat "; " (List.map string_of_vertice l)) + | Trajectory_add_vertice v -> + sprintf + "Trajectory_add_vertice %s" + (string_of_vertice v) + | Trajectory_simplify tolerance -> + sprintf + "Trajectory_simplify %f" + tolerance + | Trajectory_go(a, b, c, d) -> + sprintf + "Trajectory_go(%f, %f, %f, %f)" + a b c d + | Trajectory_stop -> + "Trajectory_stop" + | Trajectory_moving b -> + sprintf + "Trajectory_moving %B" + b + +(* +-----------------------------------------------------------------+ + | Sending/receiving messages | + +-----------------------------------------------------------------+ *) + +let send bus v = Lwt_io.write_value bus.oc v +let recv bus = bus.recv + +(* +-----------------------------------------------------------------+ + | Dispatching incomming messages | + +-----------------------------------------------------------------+ *) + +let dispatch ic emit = + try_lwt + while_lwt true do + (* Read one message. *) + lwt v = Lwt_io.read_value ic in + + (* Emit it. *) + begin try - OBus_address.of_string str - with OBus_address.Parse_failure(str, pos, err) -> - ignore (Lwt_log.error_f "The environment variable DBUS_KROBOT_BUS_ADDRESS contains an invalid D-Bus address: \"%s\", at position %d: %s" str pos err); - default_address - end - | None -> - default_address + emit v + with exn -> + ignore (Lwt_log.error ~section ~exn "message handler failed with") + end; + + return () + done + with exn -> + ignore (Lwt_log.error ~section ~exn "lost connection"); + exit 1 + +(* +-----------------------------------------------------------------+ + | Creation | + +-----------------------------------------------------------------+ *) let bus = lazy( try_lwt - lwt () = Lwt_log.info "openning the D-Bus krobot bus" in - OBus_bus.of_addresses address + (* Open a connection to the local HUB. *) + lwt ic, oc = Lwt_io.open_connection (Unix.ADDR_INET(Unix.inet_addr_loopback, port)) in + + (* The event for incomming message. *) + let recv, emit = E.create () in + + (* Dispatch message forever. *) + ignore (dispatch ic emit); + + (* Create the bus. *) + let bus = { oc; recv } in + + (* Send logs over the bus. *) + let logger = + Lwt_log.make + (fun section level lines -> + let buf = Buffer.create 42 in + List.iter + (fun line -> + Buffer.clear buf; + Lwt_log.render ~buffer:buf ~template:"$(name)[$(section)]: $(message)" ~section ~level ~message:line; + ignore (send bus (Unix.gettimeofday (), Log(Buffer.contents buf)))) + lines; + return ()) + return + in + + Lwt_log.default := Lwt_log.broadcast [!Lwt_log.default; logger]; + + return bus with exn -> - lwt () = Lwt_log.error_f ~section ~exn "failed to connect to the D-Bus krobot bus at address \"%s\"" (OBus_address.to_string address) in + ignore (Lwt_log.error ~section ~exn "failed to connect to the local hub"); exit 1 ) let get () = Lazy.force bus - -(* We put that here because all programs use this module. *) -let () = - Printexc.register_printer - (function - | Unix.Unix_error(error, func, "") -> - Some(Printf.sprintf "%s: %s" func (Unix.error_message error)) - | Unix.Unix_error(error, func, arg) -> - Some(Printf.sprintf "%s(%S): %s" func arg (Unix.error_message error)) - | _ -> - None) diff --git a/info/control2011/src/lib/krobot_bus.mli b/info/control2011/src/lib/krobot_bus.mli index 724c1d1..dccfb9f 100644 --- a/info/control2011/src/lib/krobot_bus.mli +++ b/info/control2011/src/lib/krobot_bus.mli @@ -9,12 +9,54 @@ (** The krobot bus. *) -type t = private OBus_bus.t - (** Type of the krobot bus. *) +open Krobot_geom -external of_bus : OBus_bus.t -> t = "%identity" -external to_bus : t -> OBus_bus.t = "%identity" +type t + (** Type of a krobot bus connected to the local HUB. *) val get : unit -> t Lwt.t (** [get ()] returns the krobot bus. It exits the program on - errors. *) + error. *) + +(** Type of message exchanged over the bus. *) +type message = + | CAN of Krobot_can.frame + (** A CAN frame. *) + | Log of string + (** A log message. *) + | Send + (** Ask for sending parameters. *) + | Kill of string + (** Kill the given service. *) + + (** Trajectory messages. *) + + | Trajectory_origin of vertice * vector + (** The origin of the trajectory with the initial direction + vector. *) + | Trajectory_vertices of vertice list + (** The list of vertices for the planned trajectory. *) + | Trajectory_set_vertices of vertice list + (** Sets the trajectory. *) + | Trajectory_add_vertice of vertice + (** Add a vertice to the trajectory. *) + | Trajectory_simplify of float + (** Simplify the trajectory with the given tolerance. *) + | Trajectory_go of float * float * float * float + (** [Trajectory_go(rotation_speed, rotation_acceleration, + moving_speed, moving_acceleration)]. *) + | Trajectory_stop + (** Stop the current trajectory. *) + | Trajectory_moving of bool + (** Is the robot following a trajectory ? *) + +val string_of_message : message -> string + (** Returns a string representation of the given message. *) + +val send : t -> (float * message) -> unit Lwt.t + (** [send bus (timestamp, message)] sends a message over the krobot + bus. *) + +val recv : t -> (float * message) React.event + (** [recv bus] returns the event which receive messages from the + krobot bus. *) diff --git a/info/control2011/src/lib/krobot_can.ml b/info/control2011/src/lib/krobot_can.ml index c5d9094..feb997f 100644 --- a/info/control2011/src/lib/krobot_can.ml +++ b/info/control2011/src/lib/krobot_can.ml @@ -147,72 +147,3 @@ let put_float32 str ofs v = str.[ofs + 1] <- Char.unsafe_chr (Int32.to_int (Int32.shift_right v 8)); str.[ofs + 2] <- Char.unsafe_chr (Int32.to_int (Int32.shift_right v 16)); str.[ofs + 3] <- Char.unsafe_chr (Int32.to_int (Int32.shift_right v 24)) - -(* +-----------------------------------------------------------------+ - | D-Bus value conversion | - +-----------------------------------------------------------------+ *) - -open OBus_value - -let typ = C.structure (C.seq6 C.basic_double C.basic_uint32 C.basic_uint32 C.basic_boolean C.basic_uint32 C.byte_array) - -let value_of_frame (timestamp, frame) = - C.make_single - typ - (timestamp, - Int32.of_int frame.identifier, - (match frame.kind with - | Data -> 0l - | Error -> 1l), - frame.remote, - (match frame.format with - | F11bits -> 0l - | F29bits -> 1l), - frame.data) - -let frame_of_tuple (timestamp, identifier, kind, remote, format, data) = - let identifier = Int32.to_int identifier in - let kind = - match kind with - | 0l -> Data - | 1l -> Error - | n -> Printf.ksprintf failwith "Krobot_can.frame_of_value: invalid frame kind (%ld)" n - in - let format = - match format with - | 0l -> F11bits - | 1l -> F29bits - | n -> Printf.ksprintf failwith "Krobot_can.frame_of_value: invalid frame format (%ld)" n - in - (timestamp, frame ~identifier ~kind ~remote ~format ~data) - -let frame_of_value v = - frame_of_tuple (C.cast_single typ v) - -(* +-----------------------------------------------------------------+ - | Sending/receiving frames | - +-----------------------------------------------------------------+ *) - -let send bus arg = - OBus_connection.send_message - (Krobot_bus.to_bus bus) - (OBus_message.signal - ~path:["fr"; "krobot"; "CAN"] - ~interface:"fr.krobot.CAN" - ~member:"message" - [value_of_frame arg]) - -let recv bus = - let proxy = OBus_proxy.make (OBus_peer.anonymous (Krobot_bus.to_bus bus)) ["fr"; "krobot"; "CAN"] in - E.fmap - (fun (ctx, frame) -> - (* Filter messages comming from us. *) - if OBus_peer.name (OBus_context.sender ctx) = OBus_bus.name (Krobot_bus.to_bus bus) then - None - else - Some frame) - (E.delay - (OBus_signal.connect - (OBus_signal.with_context - (OBus_signal.map frame_of_tuple - (OBus_signal.make Krobot_interface_can.Fr_krobot_CAN.s_message proxy))))) diff --git a/info/control2011/src/lib/krobot_can.mli b/info/control2011/src/lib/krobot_can.mli index a0f9869..beb6d5a 100644 --- a/info/control2011/src/lib/krobot_can.mli +++ b/info/control2011/src/lib/krobot_can.mli @@ -88,24 +88,3 @@ val put_sint32 : string -> int -> int -> unit val put_uint32 : string -> int -> int -> unit val put_float32 : string -> int -> float -> unit - -(** {6 D-Bus frame conversion} *) - -val value_of_frame : float * frame -> OBus_value.V.single - (** Converts a can frame into a D-Bus structure. *) - -val frame_of_value : OBus_value.V.single -> float * frame - (** Converts a D-Bus structure into a can frame. *) - -val frame_of_tuple : float * int32 * int32 * bool * int32 * string -> float * frame - (** Converts a tuple into a can frame. *) - -(** {6 Sending/receiving frames} *) - -val send : Krobot_bus.t -> (float * frame) -> unit Lwt.t - (** [send bus (timestamp, frame)] sends the given frame over - D-Bus. *) - -val recv : Krobot_bus.t -> (float * frame) React.event - (** [recv bus] returns is the event which occurs whan a CAN frame is - received. *) diff --git a/info/control2011/src/lib/krobot_geom.ml b/info/control2011/src/lib/krobot_geom.ml index 1f8a016..1c84bf3 100644 --- a/info/control2011/src/lib/krobot_geom.ml +++ b/info/control2011/src/lib/krobot_geom.ml @@ -9,6 +9,18 @@ let sqr x = x *. x +let pi = 4. *. atan 1. + +let math_mod_float a b = + let b2 = b /. 2. in + let modf = mod_float a b in + if modf > b2 then + modf -. b + else if modf < -. b2 then + modf +. b + else + modf + (* +-----------------------------------------------------------------+ | Vectors | +-----------------------------------------------------------------+ *) diff --git a/info/control2011/src/lib/krobot_geom.mli b/info/control2011/src/lib/krobot_geom.mli index c611dd6..59bee62 100644 --- a/info/control2011/src/lib/krobot_geom.mli +++ b/info/control2011/src/lib/krobot_geom.mli @@ -11,6 +11,12 @@ (** {6 Basic geometry} *) +val pi : float + (** 3.14... *) + +val math_mod_float : float -> float -> float + (** Same as [mod_float] but always returns a positive number. *) + type vector = { vx : float; vy : float } type vertice = { x : float; y : float } diff --git a/info/control2011/src/lib/krobot_message.ml b/info/control2011/src/lib/krobot_message.ml index c9da849..62aff7a 100644 --- a/info/control2011/src/lib/krobot_message.ml +++ b/info/control2011/src/lib/krobot_message.ml @@ -415,5 +415,15 @@ let decode frame = | Sending/receiving messages | +-----------------------------------------------------------------+ *) -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) +let send bus (timestamp, msg) = + Krobot_bus.send bus (timestamp, Krobot_bus.CAN(encode msg)) + +let recv bus = + E.fmap + (fun (timestamp, message) -> + match message with + | Krobot_bus.CAN frame -> + Some(timestamp, decode frame) + | _ -> + None) + (Krobot_bus.recv bus) diff --git a/info/control2011/src/lib/krobot_message.mli b/info/control2011/src/lib/krobot_message.mli index 991d2b4..557994c 100644 --- a/info/control2011/src/lib/krobot_message.mli +++ b/info/control2011/src/lib/krobot_message.mli @@ -7,7 +7,7 @@ * This file is a part of [kro]bot. *) -(** Krobot messages. *) +(** Krobot CAN messages. *) type direction = Forward | Backward (** Type of directions. *) diff --git a/info/control2011/src/lib/krobot_planner.ml b/info/control2011/src/lib/krobot_planner.ml deleted file mode 100644 index c1fc2d1..0000000 --- a/info/control2011/src/lib/krobot_planner.ml +++ /dev/null @@ -1,44 +0,0 @@ -(* - * krobot_planner.ml - * ----------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -open Lwt -open Lwt_react -open Krobot_geom -open Krobot_interface_planner.Fr_krobot_Planner - -type t = Krobot_bus.t - -let proxy bus = - OBus_proxy.make (OBus_peer.make (Krobot_bus.to_bus bus) "fr.krobot.Service.Planner") ["fr"; "krobot"; "Planner"] - -let origin bus = - OBus_property.map_r - (fun ((x, y), (vx, vy)) -> ({ x; y }, ({ vx; vy }))) - (OBus_property.make p_origin (proxy bus)) - -let vertices bus = - OBus_property.map_rw - (List.map (fun (x, y) -> { x; y })) - (List.map (fun { x; y } -> (x, y))) - (OBus_property.make p_vertices (proxy bus)) - -let add_vertice bus { x; y } = - OBus_method.call m_add_vertice (proxy bus) (x, y) - -let simplify bus tolerance = - OBus_method.call m_simplify (proxy bus) tolerance - -let moving bus = - OBus_property.make p_moving (proxy bus) - -let go bus a b c d = - OBus_method.call m_go (proxy bus) (a, b, c, d) - -let stop bus = - OBus_method.call m_stop (proxy bus) () diff --git a/info/control2011/src/lib/krobot_planner.mli b/info/control2011/src/lib/krobot_planner.mli deleted file mode 100644 index 077956e..0000000 --- a/info/control2011/src/lib/krobot_planner.mli +++ /dev/null @@ -1,33 +0,0 @@ -(* - * krobot_planner.mli - * ------------------ - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -type t = Krobot_bus.t - (** Type of the planner. *) - -val origin : t -> (Krobot_geom.vertice * Krobot_geom.vector, [ `readable ]) OBus_property.t - (** The origin of the trajectory. *) - -val vertices : t -> (Krobot_geom.vertice list, [ `readable | `writable ]) OBus_property.t - (** The property holding the current trajectory. *) - -val add_vertice : t -> Krobot_geom.vertice -> unit Lwt.t - (** Add a vertice at the end of the current trajectory. *) - -val simplify : t -> float -> unit Lwt.t - (** [simplify planner tolerance] simplify the trajectory. *) - -val moving : t -> (bool, [ `readable ]) OBus_property.t - (** Is the robot currently following a trajectory ? *) - -val go : t -> float -> float -> float -> float -> unit Lwt.t - (** [go planner rotation_speed rotation_acceleration moving_speed - moving_acceleration] make the robot to follow the trajectory. *) - -val stop : t -> unit Lwt.t - (** Stop the current trajectory. *) diff --git a/info/control2011/src/lib/krobot_service.ml b/info/control2011/src/lib/krobot_service.ml deleted file mode 100644 index 9593dee..0000000 --- a/info/control2011/src/lib/krobot_service.ml +++ /dev/null @@ -1,145 +0,0 @@ -(* - * krobot_service.ml - * ----------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -include OBus_proxy.Private - -let section = Lwt_log.Section.make "service" - -(* +-----------------------------------------------------------------+ - | Service management | - +-----------------------------------------------------------------+ *) - -open Lwt -open Lwt_react -open Krobot_interface_service.Fr_krobot_Service - -let all bus = - OBus_proxy.make - (OBus_peer.anonymous (Krobot_bus.to_bus bus)) - ["fr"; "krobot"; "Service"] - -let make bus name = - if name = "" then - all bus - else - OBus_proxy.make - (OBus_peer.make - (Krobot_bus.to_bus bus) - (Printf.sprintf "fr.krobot.Service.%s" name)) - ["fr"; "krobot"; "Service"] - -let name service = - let s = OBus_proxy.name service in - let i = String.rindex s '.' in - String.sub s (i + 1) (String.length s - (i + 1)) - -let list bus = - lwt names = OBus_bus.list_names (Krobot_bus.to_bus bus) in - return - (List.map - (fun name -> - OBus_proxy.make - (OBus_peer.make (Krobot_bus.to_bus bus) name) - ["fr"; "krobot"; "Service"]) - (List.sort - String.compare - (List.filter - (fun name -> - String.sub name 0 (String.rindex name '.') = "fr.krobot.Service") - names))) - -let monitor bus = - lwt e = OBus_signal.connect (OBus_bus.name_owner_changed (Krobot_bus.to_bus bus)) in - lwt l = list bus in - return (S.hold l (E.map_s (fun _ -> list bus) e)) - -let kill' bus name = - try_lwt - lwt owner = OBus_bus.get_name_owner bus name in - let proxy = OBus_proxy.make (OBus_peer.make bus owner) ["fr"; "krobot"; "Service"] in - OBus_method.call_no_reply m_kill proxy () - with OBus_bus.Name_has_no_owner _ -> - return () - -let kill service = - kill' (OBus_proxy.connection service) (OBus_proxy.name service) - -let log service = - OBus_signal.make s_log service - -(* +-----------------------------------------------------------------+ - | Creating services | - +-----------------------------------------------------------------+ *) - -open Krobot_interface_service.Fr_krobot_Service - -let init bus ?(fork=true) ?(kill=false) name = - let dbus_name = Printf.sprintf "fr.krobot.Service.%s" name in - - (* Kill other instances. *) - lwt () = - if kill then - lwt () = kill' (Krobot_bus.to_bus bus) dbus_name in - exit 0 - else - return () - in - - (* Exit the program when we lost the name. *) - lwt () = - OBus_signal.connect (OBus_bus.name_lost (Krobot_bus.to_bus bus)) - >|= E.map (fun lost_name -> if dbus_name = lost_name then exit 0) - >|= E.keep - in - - (* Daemonize or not. *) - lwt () = - if fork then begin - lwt () = Lwt_log.notice_f ~section "starting %s in daemon mode" name in - Lwt_daemon.daemonize (); - return () - end else - Lwt_log.notice_f ~section "starting %s in foreground mode" name - in - - (* Create the service object and export it. *) - let obj = OBus_object.make ~interfaces:[make { m_kill = (fun obj () -> exit 0) }] ["fr"; "krobot"; "Service"] in - OBus_object.attach obj (); - OBus_object.export (Krobot_bus.to_bus bus) obj; - - (* Send logs over D-Bus. *) - let dbus_logger = - Lwt_log.make - (fun section level lines -> - let buf = Buffer.create 42 in - let lines = - List.map - (fun line -> - Buffer.clear buf; - Lwt_log.render ~buffer:buf ~template:"$(name)[$(section)]: $(message)" ~section ~level ~message:line; - Buffer.contents buf) - lines - in - OBus_signal.emit s_log obj (String.concat "\n" lines)) - return - in - - Lwt_log.default := Lwt_log.broadcast [!Lwt_log.default; dbus_logger]; - - (* Register the program on the bus. *) - lwt () = - OBus_bus.request_name (Krobot_bus.to_bus bus) ~allow_replacement:true ~replace_existing:true dbus_name >>= function - | `Primary_owner -> - return () - | _ -> - lwt () = Lwt_log.error_f ~section "cannot obtain the name %S on D-Bus" dbus_name in - exit 1 - in - - return () diff --git a/info/control2011/src/lib/krobot_service.mli b/info/control2011/src/lib/krobot_service.mli deleted file mode 100644 index f6a64fb..0000000 --- a/info/control2011/src/lib/krobot_service.mli +++ /dev/null @@ -1,41 +0,0 @@ -(* - * krobot_service.mli - * ------------------ - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -include OBus_proxy.Private - -val make : Krobot_bus.t -> string -> t - (** [make bus name pid] creates a service proxy from its name. *) - -val all : Krobot_bus.t -> t - (** Proxy that represent all running services. You can use it to - receive logs from all services. *) - -val name : t -> string - (** Returns the name of the given service. *) - -val list : Krobot_bus.t -> t list Lwt.t - (** List all available services on the bus. *) - -val monitor : Krobot_bus.t -> t list React.signal Lwt.t - (** Returns the signal holding the sorted list of services on the - bus. *) - -val kill : t -> unit Lwt.t - (** [kill service] kills the given service. It does nothing if the - service is not running. *) - -val log : t -> string OBus_signal.t - (** [log service] is the D-Bus signal which occurs when [service] - emit a log message. *) - -val init : Krobot_bus.t -> ?fork : bool -> ?kill : bool -> string -> unit Lwt.t - (** [init ?fork ?kill name] initialises a D-Bus service using name - [name]. If [fork] is [true] (the default) then the program is - daemonized. If [kill] is [true] any service with name [name] is - killed then the program is exited. It defaults to [false]. *) diff --git a/info/control2011/src/services/fr.krobot.Service.Planner.service.ab b/info/control2011/src/services/fr.krobot.Service.Planner.service.ab deleted file mode 100644 index 13dc4d3..0000000 --- a/info/control2011/src/services/fr.krobot.Service.Planner.service.ab +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=fr.krobot.Service.Planner -Exec=$(bindir)/krobot-service-planner diff --git a/info/control2011/src/services/krobot_service_planner.ml b/info/control2011/src/services/krobot_service_planner.ml deleted file mode 100644 index 431a08d..0000000 --- a/info/control2011/src/services/krobot_service_planner.ml +++ /dev/null @@ -1,343 +0,0 @@ -(* - * krobot_service_planner.ml - * ------------------------- - * Copyright : (c) 2011, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(* The trajectory planner. *) - -open Lwt -open Lwt_react -open Krobot_geom -open Krobot_config -open Krobot_message -open Krobot_interface_planner.Fr_krobot_Planner - -let section = Lwt_log.Section.make "krobot(planner)" - -let pi = 4. *. atan 1. - -let math_mod_float a b = - let b2 = b /. 2. in - let modf = mod_float a b in - if modf > b2 then - modf -. b - else if modf < -. b2 then - modf +. b - else - modf;; - -(* +-----------------------------------------------------------------+ - | Types | - +-----------------------------------------------------------------+ *) - -type planner = { - bus : Krobot_bus.t; - (* The message bus used to communicate with the robot. *) - - obus : planner OBus_object.t; - (* The D-Bus object attached to this planner. *) - - origin : (vertice * vector) signal; - (* If the robot is moving, this is the origin of the current - trajectory with the initial direction vector, otherwise it is the - current position with the current direction vector. *) - - set_origin : (vertice * vector) -> unit; - (* Set the origin of the trajectory. *) - - vertices : vertice list signal; - (* The list of vertices for the trajectory. *) - - set_vertices : vertice list -> unit; - (* Set the list of vertices. *) - - moving : bool signal; - (* Is the robot moving ? *) - - set_moving : bool -> unit; - (* Set the moving status. *) - - mutable motors_moving : bool; - (* Are the motor currently active ? *) - - mutable mover : unit Lwt.t; - (* The thread moving the robot. *) - - mutable position : vertice; - (* The position of the robot on the board. *) - - mutable orientation : float; - (* The orientation of the robot. *) - - mutable event : unit event; - (* Event kept in the planner. *) -} - -(* +-----------------------------------------------------------------+ - | Primitives | - +-----------------------------------------------------------------+ *) - -let add_vertice planner vertice = - ... [truncated message content] |