You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(50) |
Feb
(137) |
Mar
(84) |
Apr
(36) |
May
(100) |
Jun
(5) |
Jul
|
Aug
(4) |
Sep
(13) |
Oct
(1) |
Nov
(4) |
Dec
(22) |
2011 |
Jan
(4) |
Feb
(9) |
Mar
(113) |
Apr
(76) |
May
(31) |
Jun
(19) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
(6) |
May
(19) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(22) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jérémie D. <Ba...@us...> - 2010-09-24 10:03:11
|
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 a07b7353292c7416204a1abddec4814f74878402 (commit) from 2c6fe2eeecbd2a22a664a350f450a4d21d7061c0 (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 a07b7353292c7416204a1abddec4814f74878402 Author: Jérémie Dimino <je...@di...> Date: Fri Sep 24 12:02:34 2010 +0200 Use Lwt_term.render_update in the controller ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index 1eb1ac8..0c11d6a 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -155,6 +155,8 @@ type state = { | Drawing | +-----------------------------------------------------------------+ *) +let current_points = ref [||] + (* Draw the whole screen *) let draw state = let size = state.size in @@ -386,7 +388,9 @@ let draw state = words 0) end; - Lwt_term.render (Zone.points screen) + lwt () = Lwt_term.render_update !current_points (Zone.points screen) in + current_points := Zone.points screen; + return () (* +-----------------------------------------------------------------+ | Entry point | hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-24 08:22:58
|
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 2c6fe2eeecbd2a22a664a350f450a4d21d7061c0 (commit) from 99be88ec8b0e8c5e9be486dd2672d69776a618f9 (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 2c6fe2eeecbd2a22a664a350f450a4d21d7061c0 Author: Jérémie Dimino <je...@di...> Date: Fri Sep 24 10:22:11 2010 +0200 Generate Python classes from obus IDL files ----------------------------------------------------------------------- Changes: diff --git a/info/control/_tags b/info/control/_tags index 061642a..ec2b74b 100644 --- a/info/control/_tags +++ b/info/control/_tags @@ -15,3 +15,6 @@ # SDL is used to access the sixaxis controller <clients/krobot_joystick.*>: package(sdl) + +# The python generator needs to read IDL files +<python/generate.*>: package(obus.idl) diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index e2e5ecf..d049907 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -96,6 +96,9 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, (true, "services/krobot_service_turret.best"); (true, "services/stoppers/krobot_range_finders_stop.best"); (true, "services/stoppers/krobot_infrareds_stop.best"); + + (* Python *) + (true, "python/generate.best"); ] (* +-----------------------------------------------------------------+ diff --git a/info/control/python/example.py b/info/control/python/example.py index f1542f4..444231d 100644 --- a/info/control/python/example.py +++ b/info/control/python/example.py @@ -7,7 +7,11 @@ import krobot, time -claws = krobot.claws() +# +-------------------------------------------------------------------+ +# | Move the claws | +# +-------------------------------------------------------------------+ + +claws = krobot.Claws() claws.enable() claws.open() @@ -21,3 +25,15 @@ claws.close() time.sleep(0.5) claws.disable() + +# +-------------------------------------------------------------------+ +# | Move the claws | +# +-------------------------------------------------------------------+ + +motors = krobot.Motors() + +motors.move(distance=0.1, velocity=0.4, acceleration=0.8) +motors.move(distance=-0.1, velocity=0.4, acceleration=0.8) + +motors.move(distance=0.1, velocity=0.4, acceleration=0.8) +motors.move(distance=-0.1, velocity=0.4, acceleration=0.8) diff --git a/info/control/python/generate.ml b/info/control/python/generate.ml new file mode 100644 index 0000000..868136e --- /dev/null +++ b/info/control/python/generate.ml @@ -0,0 +1,85 @@ +(* + * generate.ml + * ----------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +open Printf +open OBus_introspect_ext +open OBus_value + +let gen_symbol (name, symbol) = + match symbol with + | Sym_enum(typ, values) + | Sym_flag(typ, values) -> + List.iter + (fun (value, key) -> + match value with + | V.Int32 x | V.Uint32 x -> + printf "%s_%s = %ld\n" (String.uppercase name) (String.uppercase key) x + | _ -> + ()) + values; + print_newline () + +let arg_name (name, typ) = + match name with + | Some name -> name + | None -> assert false + +let gen_member iface = function + | Method(name, args, _, _) -> + printf " def %s(%s):\n" name (String.concat ", " ("self" :: List.map arg_name args)); + printf " return self.proxy.%s(%s)\n\n" name (String.concat ", " (List.map arg_name args)) + | Property(name, _, access, _) -> + if access = Read || access = Read_write then begin + printf " def %s(self):\n" name; + printf " return self.proxy.Get('%s', '%s')\n\n" iface name + end; + if access = Write || access = Read_write then begin + printf " def set_%s(self, value):\n" name; + printf " return self.proxy.Set('%s', '%s', value)\n\n" iface name + end + | _ -> + () + +let gen_class (name, members, symbols, annotations) = + match Text.rev_split ~sep:"." ~max:2 name with + | ["fr.krobot.Service"; short_name] -> + print_newline (); + List.iter gen_symbol symbols; + printf "\ +class %s: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object(\"fr.krobot.Service.%s\", \"/fr/krobot/Services/%s\") + +" short_name short_name short_name; + List.iter (gen_member name) members + | _ -> + () + +let () = + let sources = List.tl (Array.to_list Sys.argv) in + let interfaces = List.concat (List.map OBus_idl.parse_file sources) in + + printf "\ +# File autogenerated by generate.ml, DO NOT EDIT! + +import dbus + +bus = None + +def get_bus(): + global bus + if bus == None: + bus = dbus.bus.BusConnection(\"unix:abstract=krobot\") + return bus + +"; + + List.iter gen_class interfaces diff --git a/info/control/python/krobot.py b/info/control/python/krobot.py index 7390e13..d5e8e62 100644 --- a/info/control/python/krobot.py +++ b/info/control/python/krobot.py @@ -1,9 +1,4 @@ -# krobot.py -# --------- -# Copyright : (c) 2010, Jeremie Dimino <je...@di...> -# Licence : BSD3 -# -# This file is a part of [kro]bot. +# File autogenerated by generate.ml, DO NOT EDIT! import dbus @@ -15,24 +10,150 @@ def get_bus(): bus = dbus.bus.BusConnection("unix:abstract=krobot") return bus -# +-------------------------------------------------------------------+ -# | Proxies for high-level services | -# +-------------------------------------------------------------------+ -def claws(): - return (get_bus ()).get_object("fr.krobot.Service.Claws", "/fr/krobot/Services/Claws") +class Claws: + proxy = None -def gate(): - return (get_bus ()).get_object("fr.krobot.Service.Gate", "/fr/krobot/Services/Gate") + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Claws", "/fr/krobot/Services/Claws") -def grip(): - return (get_bus ()).get_object("fr.krobot.Service.Grip", "/fr/krobot/Services/Grip") + def enable(self): + return self.proxy.enable() -def motors(): - return (get_bus ()).get_object("fr.krobot.Service.Motors", "/fr/krobot/Services/Motors") + def disable(self): + return self.proxy.disable() -def sensors(): - return (get_bus ()).get_object("fr.krobot.Service.Sensors", "/fr/krobot/Services/Sensors") + def open(self): + return self.proxy.open() + + def close(self): + return self.proxy.close() + + def take(self): + return self.proxy.take() + + +class Gate: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Gate", "/fr/krobot/Services/Gate") + + def enable(self): + return self.proxy.enable() + + def disable(self): + return self.proxy.disable() + + def close(self): + return self.proxy.close() + + def open(self): + return self.proxy.open() + + def hold_closed(self): + return self.proxy.hold_closed() + + def stop(self): + return self.proxy.stop() + + +class Grip: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Grip", "/fr/krobot/Services/Grip") + + def up(self): + return self.proxy.up() + + def down(self): + return self.proxy.down() + + def open(self): + return self.proxy.open() + + def close(self): + return self.proxy.close() + + def release(self): + return self.proxy.release() + + +MOVE_RESULT_SUCCESS = 0 +MOVE_RESULT_STOPPED = 1 +MOVE_RESULT_INHIBITED = 2 +MOVE_RESULT_REPLACED = 3 + +STOP_MODE_OFF = 0 +STOP_MODE_ABRUPT = 1 +STOP_MODE_SMOOTH = 2 + +class Motors: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Motors", "/fr/krobot/Services/Motors") + + def turn(self, angle, velocity, acceleration): + return self.proxy.turn(angle, velocity, acceleration) + + def move(self, distance, velocity, acceleration): + return self.proxy.move(distance, velocity, acceleration) + + def stop(self, mode): + return self.proxy.stop(mode) + + def set_velocities(self, velocity_r, acceleration_r, velocity_l, acceleration_l, duration): + return self.proxy.set_velocities(velocity_r, acceleration_r, velocity_l, acceleration_l, duration) + + def inhibited_forward(self): + return self.proxy.Get('fr.krobot.Service.Motors', 'inhibited_forward') + + def inhibited_backward(self): + return self.proxy.Get('fr.krobot.Service.Motors', 'inhibited_backward') + + def inhibit_forward(self, duration): + return self.proxy.inhibit_forward(duration) + + def inhibit_backward(self, duration): + return self.proxy.inhibit_backward(duration) + + +COLOR_BLUE = 0 +COLOR_YELLOW = 1 + +class Sensors: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Sensors", "/fr/krobot/Services/Sensors") + + def color(self): + return self.proxy.Get('fr.krobot.Service.Sensors', 'color') + + def infrareds(self): + return self.proxy.Get('fr.krobot.Service.Sensors', 'infrareds') + + def logic_sensors(self): + return self.proxy.Get('fr.krobot.Service.Sensors', 'logic_sensors') + + def range_finders(self): + return self.proxy.Get('fr.krobot.Service.Sensors', 'range_finders') + + +class Turret: + proxy = None + + def __init__(self): + self.proxy = (get_bus ()).get_object("fr.krobot.Service.Turret", "/fr/krobot/Services/Turret") + + def goto(self, angle): + return self.proxy.goto(angle) + + def scan(self): + return self.proxy.scan() + + def find(self): + return self.proxy.find() -def turret(): - return (get_bus ()).get_object("fr.krobot.Service.Turret", "/fr/krobot/Services/Turret") hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-22 20:46:28
|
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 99be88ec8b0e8c5e9be486dd2672d69776a618f9 (commit) via 1c247fc9e3659b2a86ba89cf57107a4989b145a8 (commit) from de87ae207bcdfe4e72f359dd4630fcb69790d426 (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 99be88ec8b0e8c5e9be486dd2672d69776a618f9 Author: Jérémie Dimino <je...@di...> Date: Wed Sep 22 22:45:26 2010 +0200 Add a python example commit 1c247fc9e3659b2a86ba89cf57107a4989b145a8 Author: [Kro]bot <kr...@wa...> Date: Wed Sep 8 22:26:11 2010 +0200 Reduce the speed of the grip ----------------------------------------------------------------------- Changes: diff --git a/info/control/python/example.py b/info/control/python/example.py new file mode 100644 index 0000000..f1542f4 --- /dev/null +++ b/info/control/python/example.py @@ -0,0 +1,23 @@ +# example.py +# ---------- +# Copyright : (c) 2010, Jeremie Dimino <je...@di...> +# Licence : BSD3 +# +# This file is a part of [kro]bot. + +import krobot, time + +claws = krobot.claws() +claws.enable() + +claws.open() +time.sleep(0.5) +claws.close() +time.sleep(0.5) + +claws.open() +time.sleep(0.5) +claws.close() +time.sleep(0.5) + +claws.disable() diff --git a/info/control/python/krobot.py b/info/control/python/krobot.py new file mode 100644 index 0000000..7390e13 --- /dev/null +++ b/info/control/python/krobot.py @@ -0,0 +1,38 @@ +# krobot.py +# --------- +# Copyright : (c) 2010, Jeremie Dimino <je...@di...> +# Licence : BSD3 +# +# This file is a part of [kro]bot. + +import dbus + +bus = None + +def get_bus(): + global bus + if bus == None: + bus = dbus.bus.BusConnection("unix:abstract=krobot") + return bus + +# +-------------------------------------------------------------------+ +# | Proxies for high-level services | +# +-------------------------------------------------------------------+ + +def claws(): + return (get_bus ()).get_object("fr.krobot.Service.Claws", "/fr/krobot/Services/Claws") + +def gate(): + return (get_bus ()).get_object("fr.krobot.Service.Gate", "/fr/krobot/Services/Gate") + +def grip(): + return (get_bus ()).get_object("fr.krobot.Service.Grip", "/fr/krobot/Services/Grip") + +def motors(): + return (get_bus ()).get_object("fr.krobot.Service.Motors", "/fr/krobot/Services/Motors") + +def sensors(): + return (get_bus ()).get_object("fr.krobot.Service.Sensors", "/fr/krobot/Services/Sensors") + +def turret(): + return (get_bus ()).get_object("fr.krobot.Service.Turret", "/fr/krobot/Services/Turret") diff --git a/info/control/services/krobot_service_grip.ml b/info/control/services/krobot_service_grip.ml index eb0bb94..a62f320 100644 --- a/info/control/services/krobot_service_grip.ml +++ b/info/control/services/krobot_service_grip.ml @@ -75,9 +75,9 @@ let up obj = return true let down obj = - lwt () = set_rx64 obj.krobot 536 0 - and () = set_ax12 obj.krobot [(2, 510, 0); - (3, 390, 0)] + lwt () = set_rx64 obj.krobot 530 200 + and () = set_ax12 obj.krobot [(2, 510, 200); + (3, 390, 200)] in return () hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-08 20:25:39
|
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 de87ae207bcdfe4e72f359dd4630fcb69790d426 (commit) from ab410705520c72cc1b28254e0ae858a1af8839d3 (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 de87ae207bcdfe4e72f359dd4630fcb69790d426 Author: Jérémie Dimino <je...@di...> Date: Wed Sep 8 22:25:12 2010 +0200 Typos in object-pathes ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index b1f4ae3..1eb1ac8 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -448,8 +448,14 @@ lwt () = (React.S.const dummy) (Lwt_event.map_s (function - | "" -> return (React.S.const dummy) - | _ -> make ()) + | "" -> + return (React.S.const dummy) + | _ -> + try_lwt + make () + with exn -> + lwt () = Lwt_log.error_f ~exn "signal maker failed with" in + raise_lwt exn) (Lwt_signal.delay (OBus_resolver.make bus name))) in let state = diff --git a/info/control/lib-krobot/krobot_claws.ml b/info/control/lib-krobot/krobot_claws.ml index 5256dc4..a21c011 100644 --- a/info/control/lib-krobot/krobot_claws.ml +++ b/info/control/lib-krobot/krobot_claws.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_claws.Fr_krobot_Service_Claws -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Claws") ["fr"; "Krobot"; "Services"; "Claws"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Claws") ["fr"; "krobot"; "Services"; "Claws"] let enable krobot = OBus_method.call m_enable (proxy krobot) () diff --git a/info/control/lib-krobot/krobot_gate.ml b/info/control/lib-krobot/krobot_gate.ml index 286e278..417f0fa 100644 --- a/info/control/lib-krobot/krobot_gate.ml +++ b/info/control/lib-krobot/krobot_gate.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_gate.Fr_krobot_Service_Gate -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Gate") ["fr"; "Krobot"; "Services"; "Gate"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Gate") ["fr"; "krobot"; "Services"; "Gate"] let enable krobot = OBus_method.call m_enable (proxy krobot) () diff --git a/info/control/lib-krobot/krobot_grip.ml b/info/control/lib-krobot/krobot_grip.ml index 5bcae4d..8e7d2cc 100644 --- a/info/control/lib-krobot/krobot_grip.ml +++ b/info/control/lib-krobot/krobot_grip.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_grip.Fr_krobot_Service_Grip -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Grip") ["fr"; "Krobot"; "Services"; "Grip"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Grip") ["fr"; "krobot"; "Services"; "Grip"] let up krobot = OBus_method.call m_up (proxy krobot) () diff --git a/info/control/lib-krobot/krobot_sensors.ml b/info/control/lib-krobot/krobot_sensors.ml index fa80380..14a5053 100644 --- a/info/control/lib-krobot/krobot_sensors.ml +++ b/info/control/lib-krobot/krobot_sensors.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_sensors.Fr_krobot_Service_Sensors -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Sensors") ["fr"; "Krobot"; "Services"; "Sensors"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Sensors") ["fr"; "krobot"; "Services"; "Sensors"] type color = type_color diff --git a/info/control/lib-krobot/krobot_turret.ml b/info/control/lib-krobot/krobot_turret.ml index c60c85f..ff4f508 100644 --- a/info/control/lib-krobot/krobot_turret.ml +++ b/info/control/lib-krobot/krobot_turret.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_turret.Fr_krobot_Service_Turret -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.Krobot.Service.Turret") ["fr"; "Krobot"; "Services"; "Turret"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.Krobot.Service.Turret") ["fr"; "krobot"; "Services"; "Turret"] let goto krobot ~angle = OBus_method.call m_goto (proxy krobot) angle hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-08 18:57:40
|
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 ab410705520c72cc1b28254e0ae858a1af8839d3 (commit) from 999478d366d2e38489e800e8618e02af94446408 (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 ab410705520c72cc1b28254e0ae858a1af8839d3 Author: Jérémie Dimino <je...@di...> Date: Wed Sep 8 20:45:06 2010 +0200 Do not fail when receiving an unknown joystick button ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_joystick.ml b/info/control/clients/krobot_joystick.ml index 953cf5e..a661deb 100644 --- a/info/control/clients/krobot_joystick.ml +++ b/info/control/clients/krobot_joystick.ml @@ -60,24 +60,24 @@ let axis_min = -32768.0 let axis_max = 32767.0 let button_of_num = function - | 14 -> ButtonCross - | 15 -> ButtonSquare - | 12 -> ButtonTriangle - | 13 -> ButtonCircle - | 6 -> ButtonDown - | 7 -> ButtonLeft - | 4 -> ButtonUp - | 5 -> ButtonRight - | 0 -> ButtonSelect - | 3 -> ButtonStart - | 11 -> ButtonR1 - | 9 -> ButtonR2 - | 10 -> ButtonL1 - | 8 -> ButtonL2 - | 16 -> ButtonPS3 - | 1 -> ButtonLAxis - | 2 -> ButtonRAxis - | n -> Printf.ksprintf failwith "unknown button %d" n + | 14 -> Some ButtonCross + | 15 -> Some ButtonSquare + | 12 -> Some ButtonTriangle + | 13 -> Some ButtonCircle + | 6 -> Some ButtonDown + | 7 -> Some ButtonLeft + | 4 -> Some ButtonUp + | 5 -> Some ButtonRight + | 0 -> Some ButtonSelect + | 3 -> Some ButtonStart + | 11 -> Some ButtonR1 + | 9 -> Some ButtonR2 + | 10 -> Some ButtonL1 + | 8 -> Some ButtonL2 + | 16 -> Some ButtonPS3 + | 1 -> Some ButtonLAxis + | 2 -> Some ButtonRAxis + | n -> None (* +-----------------------------------------------------------------+ | SDL events (executed in a child process) | @@ -112,10 +112,20 @@ let child_loop pipe joy = else () end - | JOYBUTTONUP { jbe_button = button } -> - send (JoyButtonPressed(button_of_num button)) - | JOYBUTTONDOWN { jbe_button = button } -> - send (JoyButtonReleased(button_of_num button)) + | JOYBUTTONUP { jbe_button = button } -> begin + match button_of_num button with + | Some button -> + send (JoyButtonReleased button) + | None -> + () + end + | JOYBUTTONDOWN { jbe_button = button } -> begin + match button_of_num button with + | Some button -> + send (JoyButtonPressed button) + | None -> + () + end | _ -> () done hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-04 15:07: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 999478d366d2e38489e800e8618e02af94446408 (commit) from cbb92d1243b6cca2969cc09d5f70dff20a0fc994 (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 999478d366d2e38489e800e8618e02af94446408 Author: Jérémie Dimino <je...@di...> Date: Sat Sep 4 17:05:29 2010 +0200 Fix iterator bounds in Krobot_wire.array ----------------------------------------------------------------------- Changes: diff --git a/info/control/driver/krobot_wire.ml b/info/control/driver/krobot_wire.ml index 8b2a7c1..fa7ec67 100644 --- a/info/control/driver/krobot_wire.ml +++ b/info/control/driver/krobot_wire.ml @@ -104,7 +104,7 @@ let array count conv = { ); write = ( fun buffer value -> - for i = 1 to count do + for i = 0 to count - 1 do conv.write buffer value.(i) done ); hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-04 14:49:03
|
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 cbb92d1243b6cca2969cc09d5f70dff20a0fc994 (commit) from 15e6376929d2d3fc5486b81fa4e0b162260d740c (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 cbb92d1243b6cca2969cc09d5f70dff20a0fc994 Author: Jérémie Dimino <je...@di...> Date: Sat Sep 4 16:48:39 2010 +0200 replace fail by raise_lwt ----------------------------------------------------------------------- Changes: diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 972e046..7c7cf68 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -363,7 +363,7 @@ struct Krobot_dynamixel_over_serial.ping card id let action card ~id = - fail (Failure "not implemented") + raise_lwt (Failure "not implemented") let reset card ~id = Krobot_dynamixel_over_serial.reset card id @@ -390,14 +390,14 @@ struct Krobot_dynamixel_over_serial.write card id (Int32.to_int (cast_writable_register address)) data let reg_set card ~id ~address ~value = - fail (Failure "not implemented") + raise_lwt (Failure "not implemented") let goto card ~id ~position ~speed ~mode = lwt () = set card ~id ~address:`Moving_speed ~value:speed in set card ~id ~address:`Goal_position ~value:position let config card ~id = - fail (Failure "not implemented") + raise_lwt (Failure "not implemented") let get_position card ~id = get card ~id ~address:`Present_position diff --git a/info/control/driver/krobot_dynamixel_over_serial.ml b/info/control/driver/krobot_dynamixel_over_serial.ml index 60debcd..cb1cee5 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.ml +++ b/info/control/driver/krobot_dynamixel_over_serial.ml @@ -267,7 +267,7 @@ let get_card wrapper = match wrapper.state with | Opened card -> return card | Closed exn -> - fail exn + raise_lwt exn (* +-----------------------------------------------------------------+ | Aborting | @@ -345,7 +345,7 @@ let with_emit_mode f card = let r = Serial.tiocmbic fd 0x004 in if r <> 0 then Printf.ksprintf - (fun s -> fail (Failure s)) + (fun s -> raise_lwt (Failure s)) "TIOCMBIC(TIOCM_RTS) failed with code %d" r else @@ -432,16 +432,16 @@ let call wrapper id instr data = match r with | `WriteError (a, b) -> Printf.ksprintf - (fun s -> fail (Error s)) + (fun s -> raise_lwt (Error s)) "%d byte(s) written instead of %d" a b | `Error s -> - fail (Error s) + raise_lwt (Error s) | `Some status -> if status.s_errors = [] then return status.s_data else - fail (Error(error_message status.s_errors))) + raise_lwt (Error(error_message status.s_errors))) let () = Printexc.register_printer (function @@ -461,7 +461,7 @@ type t = { } let unavailable card = - fail + raise_lwt (Krobot_error.Device.Unavailable (Printf.sprintf "the %s card is currently not available" diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index aeb43ee..4b60b6d 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -168,7 +168,7 @@ let abort card exn = let send card buffer = match card.handle with | None -> - fail + raise_lwt (Krobot_error.Device.Unavailable (Printf.sprintf "the %s card is currently not available" @@ -183,7 +183,7 @@ let send card buffer = card.name len) in abort card exn; - fail exn + raise_lwt exn end else return () @@ -203,10 +203,10 @@ let call_no_reply card ~command ~i_types args = return ()) with | Canceled -> - fail Canceled + raise_lwt Canceled | exn -> abort card exn; - fail exn + raise_lwt exn (* Send a command and wait for the reply: *) let call card ?(timeout=1.0) ~command ~i_types ~o_types args = @@ -229,10 +229,10 @@ let call card ?(timeout=1.0) ~command ~i_types ~o_types args = return (Krobot_wire.read o_types buffer)) with | Canceled -> - fail Canceled + raise_lwt Canceled | exn -> abort card exn; - fail exn + raise_lwt exn (* +-----------------------------------------------------------------+ | Logging | @@ -361,7 +361,7 @@ let rec loop card = lwt () = if len <> 64 then lwt () = Lwt_log.warning_f ~section "read on %s card returned %d instead of 64, reopening" card.name len in - fail Reopen_card + raise_lwt Reopen_card else return () in diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index ebbfa3c..8a580b6 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -41,7 +41,7 @@ let set_ax12 krobot position speed = let goto obj ~angle = let angle = principal angle in if angle < -.(pi /. 2.0) || angle > pi /. 2.0 then - fail (OBus_error.Invalid_args "the angle for the turret must be between -pi/2 and pi/2") + raise_lwt (OBus_error.Invalid_args "the angle for the turret must be between -pi/2 and pi/2") else set_ax12 obj.krobot (position_of_angle angle) 0 @@ -88,7 +88,7 @@ let scan obj = loop [] let find obj = - fail (Failure "not implemented") + raise_lwt (Failure "not implemented") let interface = make { diff --git a/info/control/usb-tools/bootloader.ml b/info/control/usb-tools/bootloader.ml index 7151d00..f2c2034 100644 --- a/info/control/usb-tools/bootloader.ml +++ b/info/control/usb-tools/bootloader.ml @@ -40,7 +40,7 @@ let string_of_error = function exception Error of error -let failwith e = fail (Error e) +let failwith e = raise_lwt (Error e) let close k = if k.is_open then begin hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-09-01 14:19:28
|
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 15e6376929d2d3fc5486b81fa4e0b162260d740c (commit) from 43ec9adb255bda2ccdfc479b24517c5da6ebfb09 (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 15e6376929d2d3fc5486b81fa4e0b162260d740c Author: Olivier BICHLER <oli...@cr...> Date: Wed Sep 1 16:18:55 2010 +0200 Added optional pull-ups on encoder inputs and changed the connexions so that a single row connector can be used ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX index fe0eb0e..64c01d7 100644 Binary files a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX and b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL index 9dd066e..7a69e2c 100644 Binary files a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL and b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN index d0de043..0277553 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN and b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK index 57145e1..5688433 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK and b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj index 1e884fe..97a7ebf 100644 --- a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj +++ b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj @@ -29,6 +29,7 @@ (FALSE) (FALSE) (FALSE) + (FALSE) ( "FALSE")) (Folder "Outputs" (File "..\pcb\controller_motors.mnl" @@ -119,6 +120,9 @@ (Path "Design Resources") (Path "Design Resources" "C:\krobot\elec\boards\Controller_Motor_STM32\Schematic\controller_motors.dsn") + (Path "Design Resources" + "C:\krobot\elec\boards\Controller_Motor_STM32\Schematic\controller_motors.dsn" + "SCHEMATIC1") (Path "Design Resources" "Library") (Path "Outputs") (Select "Design Resources" diff --git a/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf b/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf index fb24bb1..877a710 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf and b/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf differ hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-09-01 09:38:06
|
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 43ec9adb255bda2ccdfc479b24517c5da6ebfb09 (commit) from acc3b80f004831a686722c15d0a7729e0e85eb87 (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 43ec9adb255bda2ccdfc479b24517c5da6ebfb09 Author: Olivier BICHLER <oli...@cr...> Date: Wed Sep 1 11:37:32 2010 +0200 Minor changes ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX index c4c89f8..fe0eb0e 100644 Binary files a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX and b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS-1_0.MAX differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL index 25b6cb6..9dd066e 100644 Binary files a/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL and b/elec/boards/Controller_Motor_STM32/PCB/CONTROLLER_MOTORS.MNL differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN index 3048061..d0de043 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN and b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS.DSN differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK index 63be970..57145e1 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK and b/elec/boards/Controller_Motor_STM32/Schematic/CONTROLLER_MOTORS_0.DBK differ diff --git a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj index 1c9b3ec..1e884fe 100644 --- a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj +++ b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj @@ -12,7 +12,7 @@ (CompileFileAddedOrDeleted "x") (Netlist_TAB "3") (LAYOUT_Netlist_File - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\PCB\CONTROLLER_MOTORS.MNL") + "C:\krobot\elec\boards\Controller_Motor_STM32\PCB\CONTROLLER_MOTORS.MNL") (LAYOUT_PCB_Footprint "{PCB Footprint}") (FALSE) (LAYOUT_Units "0") @@ -28,6 +28,7 @@ (Board_sim_option "VHDL_flow") (FALSE) (FALSE) + (FALSE) ( "FALSE")) (Folder "Outputs" (File "..\pcb\controller_motors.mnl" @@ -117,15 +118,11 @@ (FileView (Path "Design Resources") (Path "Design Resources" - "C:\krobot\elec\boards\Controller_Motors\Schematic\controller_motors.dsn") - (Path "Design Resources" - "C:\krobot\elec\boards\Controller_Motors\Schematic\controller_motors.dsn" - "SCHEMATIC1") + "C:\krobot\elec\boards\Controller_Motor_STM32\Schematic\controller_motors.dsn") (Path "Design Resources" "Library") (Path "Outputs") (Select "Design Resources" - "C:\krobot\elec\boards\Controller_Motors\Schematic\controller_motors.dsn" - "SCHEMATIC1" "Microcontroller")) + "C:\krobot\elec\boards\Controller_Motor_STM32\Schematic\controller_motors.dsn")) (HierarchyView) (Doc (Type "COrCapturePMDoc") @@ -135,56 +132,56 @@ (Doc (Type "COrSchematicDoc") (Frame - (Placement "44 0 1 -1 -1 -1 -1 318 1884 0 1068") + (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") (Scroll "0 0") (Zoom "136") (Occurrence "/")) (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\SCHEMATIC\CONTROLLER_MOTORS.DSN") + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") - (Page "Communication")) + (Page "Power Supply")) (Doc (Type "COrSchematicDoc") (Frame - (Placement "44 0 1 -1 -1 -1 -1 318 1884 0 1068") + (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") (Scroll "0 0") (Zoom "136") (Occurrence "/")) (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\SCHEMATIC\CONTROLLER_MOTORS.DSN") + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") - (Page "Driver Interface")) + (Page "Microcontroller")) (Doc (Type "COrSchematicDoc") (Frame - (Placement "44 0 1 -1 -1 -1 -1 318 1884 0 1068") + (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") (Scroll "0 0") (Zoom "136") (Occurrence "/")) (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\SCHEMATIC\CONTROLLER_MOTORS.DSN") + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") (Page "Encoder Interface")) (Doc (Type "COrSchematicDoc") (Frame - (Placement "44 0 1 -1 -1 -8 -30 318 1884 0 1068") + (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") (Scroll "0 0") - (Zoom "141") + (Zoom "136") (Occurrence "/")) (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\SCHEMATIC\CONTROLLER_MOTORS.DSN") + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") - (Page "Microcontroller")) + (Page "Driver Interface")) (Doc (Type "COrSchematicDoc") (Frame - (Placement "44 0 1 -1 -1 -1 -1 318 1884 0 1068") + (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") (Scroll "0 0") (Zoom "136") (Occurrence "/")) (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTORS\SCHEMATIC\CONTROLLER_MOTORS.DSN") + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") - (Page "Power Supply"))) + (Page "Communication"))) (MPSSessionName "Olivier")) diff --git a/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf b/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf index 0047939..fb24bb1 100644 Binary files a/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf and b/elec/boards/Controller_Motor_STM32/Schematic/PDF/Controller_Motors.pdf differ diff --git a/elec/lib/OrCAD/KROBOT.LLB b/elec/lib/OrCAD/KROBOT.LLB index 2bb7c82..57cbb94 100644 Binary files a/elec/lib/OrCAD/KROBOT.LLB and b/elec/lib/OrCAD/KROBOT.LLB differ hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-08-31 21:08:11
|
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 acc3b80f004831a686722c15d0a7729e0e85eb87 (commit) via 0aa796444550e77c08d57621f4735b927df20fba (commit) from 84a5cf0e3ce26a9fcd902b0082706fc4d0f2731b (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 acc3b80f004831a686722c15d0a7729e0e85eb87 Author: Olivier BICHLER <oli...@cr...> Date: Tue Aug 31 23:07:11 2010 +0200 Added Motor Controller STM32 board (to be reviewed) commit 0aa796444550e77c08d57621f4735b927df20fba Author: Olivier BICHLER <oli...@cr...> Date: Tue Aug 31 23:05:10 2010 +0200 Rename Controller_Motor to Controller_Motor_LM629 ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor/Assembly/MOTOR_CONTROLLER.BOM b/elec/boards/Controller_Motor/Assembly/MOTOR_CONTROLLER.BOM deleted file mode 100644 index 5f3efa0..0000000 --- a/elec/boards/Controller_Motor/Assembly/MOTOR_CONTROLLER.BOM +++ /dev/null @@ -1,41 +0,0 @@ -Carte d'asservissement - Alimentation Revised: Thursday, January 01, 2009 - Revision: 1.0 - - - - - - - -Bill Of Materials January 3,2009 13:06:26 Page1 - -Item Quantity Reference Part -______________________________________________ - -1 2 C2,C4 22p -2 6 C6,C15,C18,C24,C25,C26 100n -3 1 C17 0.33u -4 1 C21 220n -5 1 D9 LED alim 5V -6 1 D16 D1N4001 -7 1 D18 D1N5817 -8 1 D23 LED1 -9 1 D24 LED2 -10 2 J4,J6 Codeur moteur -11 1 J7 Courant mot. 1 -12 1 J8 Com. moteur 1 -13 2 J9,J13 Bus I2C -14 1 J10 Con. USB -15 1 J11 Courant mot. 2 -16 1 J14 Com. moteur 2 -17 1 J26 Bornier alim. 12 V -18 1 J32 Con. PROG -19 3 R22,R23,R29 680 -20 5 R38,R39,R42,R43,R44 10k -21 1 SW6 RESET -22 1 U8 LM7805C/TO220 -23 1 U9 PIC18F4550-PDIP -24 2 U12,U14 LM629N-8 -25 1 U19 OSC 8 MHz (max) -26 1 U24 74HCT367 -27 1 X2 8 MHz diff --git a/elec/boards/Controller_Motor/Firmware/.gitignore b/elec/boards/Controller_Motor/Firmware/.gitignore deleted file mode 100644 index b81d6fd..0000000 --- a/elec/boards/Controller_Motor/Firmware/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ - -*.err \ No newline at end of file diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/18f4550.lkr b/elec/boards/Controller_Motor/Firmware/Bootloader/18f4550.lkr deleted file mode 100644 index d1673d9..0000000 --- a/elec/boards/Controller_Motor/Firmware/Bootloader/18f4550.lkr +++ /dev/null @@ -1,31 +0,0 @@ -// $Id: 18f4550.lkr,v 1.1.2.2 2004/04/28 00:41:31 curtiss Exp $ -// File: 18f4550.lkr -// Sample linker script for the PIC18F4550 processor - -LIBPATH . - -FILES c018i.o -FILES clib.lib -FILES p18f4550.lib - -CODEPAGE NAME=vectors START=0x0 END=0x29 PROTECTED -CODEPAGE NAME=page START=0x2A END=0x7FFF -CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED -CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED -CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED -CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED - -ACCESSBANK NAME=accessram START=0x0 END=0x5F -DATABANK NAME=gpr0 START=0x60 END=0xFF -DATABANK NAME=gpr1 START=0x100 END=0x1FF -DATABANK NAME=gpr2 START=0x200 END=0x2FF -DATABANK NAME=gpr3 START=0x300 END=0x3FF -DATABANK NAME=usb4 START=0x400 END=0x4FF PROTECTED -DATABANK NAME=usb5 START=0x500 END=0x5FF PROTECTED -DATABANK NAME=usb6 START=0x600 END=0x6FF PROTECTED -DATABANK NAME=usb7 START=0x700 END=0x7FF PROTECTED -ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED - -SECTION NAME=CONFIG ROM=config - -STACK SIZE=0x100 RAM=gpr3 diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/CleanUp.bat b/elec/boards/Controller_Motor/Firmware/Bootloader/CleanUp.bat deleted file mode 100644 index cd0752b..0000000 --- a/elec/boards/Controller_Motor/Firmware/Bootloader/CleanUp.bat +++ /dev/null @@ -1,85 +0,0 @@ -@echo off -REM Remove files generated by compiler in this directory -REM and all subdirectories. - -echo Removing *.$$$ files... -del *.$$$ /f /q /s -echo. - -echo Removing *.bkx files... -del *.bkx /f /q /s -echo. - -echo Removing *.cce files... -del *.cce /f /q /s -echo. - -echo Removing *.cod files... -del *.cod /f /q /s -echo. - -echo Removing *.cof files... -del *.cof /f /q /s -echo. - -echo Removing *.err files... -del *.err /f /q /s -echo. - -echo Removing *.hex files... -del *.hex /f /q /s -echo. - -echo Removing *.i files... -del *.i /f /q /s -echo. - -echo Removing *.lde files... -del *.lde /f /q /s -echo. - -echo Removing *.lst files... -del *.lst /f /q /s -echo. - -echo Removing *.obj files... -del *.obj /f /q /s -echo. - -echo Removing *.o files... -del *.o /f /q /s -echo. - -echo Removing *.rlf files... -del *.rlf /f /q /s -echo. - -echo Removing *.sym files... -del *.sym /f /q /s -echo. - -echo Removing *.sdb files... -del *.sdb /f /q /s -echo. - -echo Removing *.map files... -del *.map /f /q /s -echo. - -echo Removing *.mptags files... -del *.mptags /f /q /s -echo. - -echo Removing *.tagsrc files... -del *.tagsrc /f /q /s -echo. - -echo Removing *.mcs files... -del *.mcs /f /q /s -echo. - -echo Removing *.wat files... -del *.wat /f /q /s -echo. - -echo Done. \ No newline at end of file diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcp b/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcp deleted file mode 100644 index 7646e3c..0000000 --- a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcp +++ /dev/null @@ -1,133 +0,0 @@ -[HEADER] -magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13} -file_version=1.0 -[PATH_INFO] -BuildDirPolicy=BuildDirIsSourceDir -dir_src= -dir_bin=output -dir_tmp=output -dir_sin= -dir_inc=C:\MCC18\h -dir_lib=C:\MCC18\lib -dir_lkr=C:\MCC18\lkr -[CAT_FILTERS] -filter_src=*.asm;*.c -filter_inc=*.h;*.inc -filter_obj=*.o -filter_lib=*.lib -filter_lkr=*.lkr -[CAT_SUBFOLDERS] -subfolder_src= -subfolder_inc= -subfolder_obj= -subfolder_lib= -subfolder_lkr= -[FILE_SUBFOLDERS] -file_000=. -file_001=. -file_002=. -file_003=. -file_004=. -file_005=. -file_006=. -file_007=. -file_008=. -file_009=. -file_010=. -file_011=. -file_012=. -file_013=. -file_014=. -file_015=. -file_016=. -file_017=. -file_018=. -file_019=. -file_020=. -file_021=. -[GENERATED_FILES] -file_000=no -file_001=no -file_002=no -file_003=no -file_004=no -file_005=no -file_006=no -file_007=no -file_008=no -file_009=no -file_010=no -file_011=no -file_012=no -file_013=no -file_014=no -file_015=no -file_016=no -file_017=no -file_018=no -file_019=no -file_020=no -file_021=no -[OTHER_FILES] -file_000=no -file_001=no -file_002=no -file_003=no -file_004=no -file_005=no -file_006=no -file_007=no -file_008=no -file_009=no -file_010=no -file_011=no -file_012=no -file_013=no -file_014=no -file_015=no -file_016=no -file_017=no -file_018=no -file_019=no -file_020=no -file_021=no -[FILE_INFO] -file_000=main.c -file_001=boot.c -file_002=usb9.c -file_003=usbctrltrf.c -file_004=usbdrv.c -file_005=usbdsc.c -file_006=usbmmap.c -file_007=eeprom.c -file_008=io_cfg.h -file_009=boot.h -file_010=typedefs.h -file_011=usb.h -file_012=usb9.h -file_013=usbcfg.h -file_014=usbctrltrf.h -file_015=usbdefs_ep0_buff.h -file_016=usbdefs_std_dsc.h -file_017=usbdrv.h -file_018=usbdsc.h -file_019=usbmmap.h -file_020=eeprom.h -file_021=18f4550.lkr -[SUITE_INFO] -suite_guid={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -suite_state= -[TOOL_SETTINGS] -TS{DD2213A8-6310-47B1-8376-9430CDFC013F}= -TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(BINDIR_)$(TARGETBASE).cof" -TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}=-scs -TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}= -[INSTRUMENTED_TRACE] -enable=0 -transport=0 -format=0 -[CUSTOM_BUILD] -Pre-Build= -Pre-BuildEnabled=1 -Post-Build= -Post-BuildEnabled=1 diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcs b/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcs deleted file mode 100644 index dbd24cb..0000000 --- a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcs +++ /dev/null @@ -1,149 +0,0 @@ -[Header] -MagicCookie={0b13fe8c-dfe0-40eb-8900-6712719559a7} -Version=1.0 -[File000] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\main.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File001] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\boot.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File002] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\usb9.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File003] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\usbctrltrf.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File004] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\usbdrv.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File005] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\usbdsc.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File006] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\usbmmap.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File007] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\eeprom.o -Folder=Intermediary -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={E56A1C86-9D32-4DF6-8C34-FE0388B1B644} -LanguageToolLocation=C:\MCC18\bin\mcc18.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=-scs -TraceCmdString= -DebugOptions= -[File008] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\MCHPUSB.cof -Folder=Output -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={96C98149-AA1B-4CF9-B967-FAE79CAB663C} -LanguageToolLocation=C:\MCC18\bin\mplink.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(BINDIR_)$(TARGETBASE).cof" -TraceCmdString= -DebugOptions= -[File009] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\MCHPUSB.hex -Folder=Output -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={96C98149-AA1B-4CF9-B967-FAE79CAB663C} -LanguageToolLocation=C:\MCC18\bin\mplink.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(BINDIR_)$(TARGETBASE).cof" -TraceCmdString= -DebugOptions= -[File010] -Location=C:\krobot\USB_Module\Motor_controller\Firmware\Bootloader\output\MCHPUSB.map -Folder=Output -DeviceName=PIC18F4550 -LanguageToolSuiteID={5B7D72DD-9861-47BD-9F60-2BE967BF8416} -LanguageToolID={96C98149-AA1B-4CF9-B967-FAE79CAB663C} -LanguageToolLocation=C:\MCC18\bin\mplink.exe -PPAD=$(BINDIR)|output||$(TMPDIR)|output||$(AINDIR)||$(INCDIR)|C:\MCC18\h||$(LIBDIR)|C:\MCC18\lib||$(LKRDIR)|C:\MCC18\lkr|| -SOLK=<src>|main.c|boot.c|usb9.c|usbctrltrf.c|usbdrv.c|usbdsc.c|usbmmap.c|eeprom.c||<obj>||<lib>||<lkr>|18f4550.lkr|| -SuiteArgsString= -ToolArgsString=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(BINDIR_)$(TARGETBASE).cof" -TraceCmdString= -DebugOptions= -[TOOL_LOC_STAMPS] -tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=C:\MCC18\bin\mplink.exe -tool_loc{E56A1C86-9D32-4DF6-8C34-FE0388B1B644}=C:\MCC18\bin\mcc18.exe diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcw b/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcw deleted file mode 100644 index cfdc535..0000000 Binary files a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mcw and /dev/null differ diff --git a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mptags b/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mptags deleted file mode 100644 index 16cfbdc..0000000 --- a/elec/boards/Controller_Motor/Firmware/Bootloader/MCHPUSB.mptags +++ /dev/null @@ -1,547 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhi...@us.../ -!_TAG_PROGRAM_NAME Exuberant Ctags // -!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ -!_TAG_PROGRAM_VERSION 5.5.4 // -!_TAG_REVISION_NAME MCHPTags // -!_TAG_REVISION_VERSION 6.0.1 // -ADDRESS_STATE::5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 63;" d line:63 -ADR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 175;" p line:175 file: signature:((int)counter) << 6 -ADR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 194;" m line:194 struct:_BOOT_DATA_PACKET::<anonymous> -ADR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 124;" m line:124 struct:_BDT::<anonymous> -ADRH C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 118;" m line:118 struct:_BDT::<anonymous> -ADRL C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 117;" m line:117 struct:_BDT::<anonymous> -ADR_PENDING_STATE::4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 62;" d line:62 -ATTACHED_STATE::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 59;" d line:59 -BC8 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 85;" m line:85 struct:_BD_STAT::<anonymous> -BC8 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 95;" m line:95 struct:_BD_STAT::<anonymous> -BC9 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 86;" m line:86 struct:_BD_STAT::<anonymous> -BC9 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 96;" m line:96 struct:_BD_STAT::<anonymous> -BDT C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 126;" t line:126 -BD_STAT C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 109;" t line:109 -BOOL C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 150;" t line:150 -BOOT_BD_IN::ep1Bi C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 71;" d line:71 -BOOT_BD_OUT::ep1Bo C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 70;" d line:70 -BOOT_DATA_PACKET C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 203;" t line:203 -BOOT_EP_SIZE::64 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 72;" d line:72 -BOOT_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 38;" d line:38 -BOOT_INTF_ID::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 68;" d line:68 -BOOT_UEP::UEP1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 69;" d line:69 -BSTALL C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 87;" m line:87 struct:_BD_STAT::<anonymous> -BYTE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 58;" t line:58 -BlinkUSBStatus C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 337;" f line:337 signature:(void) -BlinkUSBStatus C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 59;" p line:59 file: signature:(void) -BootInitEP C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 87;" f line:87 signature:(void) -BootInitEP C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 208;" p line:208 signature:(void) -BootService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 223;" f line:223 signature:(void) -BootService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 209;" p line:209 signature:(void) -Byte0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 103;" m line:103 struct:_DWORD::<anonymous> -Byte0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 70;" m line:70 struct:_WORD::<anonymous> -Byte1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 104;" m line:104 struct:_DWORD::<anonymous> -Byte1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 71;" m line:71 struct:_WORD::<anonymous> -Byte2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 105;" m line:105 struct:_DWORD::<anonymous> -Byte3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 106;" m line:106 struct:_DWORD::<anonymous> -CFG01::romstruct C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdsc.h 54;" d line:54 -CLASS::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 59;" d line:59 -CLR_FEATURE::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 49;" d line:49 -CMD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 183;" m line:183 struct:_BOOT_DATA_PACKET::<anonymous> -CONFIGURED_STATE::6 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 64;" d line:64 -CTRL_TRF_DATA C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 207;" t line:207 -CTRL_TRF_RX::2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 47;" d line:47 -CTRL_TRF_SETUP C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 166;" t line:166 -CTRL_TRF_TX::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 46;" d line:46 -Cnt C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 116;" m line:116 struct:_BDT::<anonymous> -CtrlTrfData C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.c 269;" v line:269 -DATA_SIZE::(BOOT_EP_SIZE-OVER_HEAD) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 164;" d line:164 -DEFAULT_STATE::3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 61;" d line:61 -DETACHED_STATE::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 58;" d line:58 -DEVICE_REMOTE_WAKEUP::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 61;" d line:61 -DEV_TO_HOST::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 56;" d line:56 -DSC_CFG::0x02 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 50;" d line:50 -DSC_DEV::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 49;" d line:49 -DSC_EP::0x05 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 53;" d line:53 -DSC_INTF::0x04 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 52;" d line:52 -DSC_STR::0x03 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 51;" d line:51 -DTS C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 91;" m line:91 struct:_BD_STAT::<anonymous> -DTSEN C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 88;" m line:88 struct:_BD_STAT::<anonymous> -DWORD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 117;" t line:117 -DataDir C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 88;" m line:88 struct:_CTRL_TRF_SETUP::<anonymous> -EECON1_RD::EECON1bits.RD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 61;" d line:61 -EECON1_WR::EECON1bits.WR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 62;" d line:62 -ENDPOINT_HALT::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 62;" d line:62 -EP00_IN::((0x00<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 83;" d line:83 -EP00_OUT::((0x00<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 82;" d line:82 -EP01_IN::((0x01<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 85;" d line:85 -EP01_OUT::((0x01<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 84;" d line:84 -EP02_IN::((0x02<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 87;" d line:87 -EP02_OUT::((0x02<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 86;" d line:86 -EP03_IN::((0x03<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 89;" d line:89 -EP03_OUT::((0x03<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 88;" d line:88 -EP04_IN::((0x04<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 91;" d line:91 -EP04_OUT::((0x04<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 90;" d line:90 -EP05_IN::((0x05<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 93;" d line:93 -EP05_OUT::((0x05<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 92;" d line:92 -EP06_IN::((0x06<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 95;" d line:95 -EP06_OUT::((0x06<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 94;" d line:94 -EP07_IN::((0x07<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 97;" d line:97 -EP07_OUT::((0x07<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 96;" d line:96 -EP08_IN::((0x08<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 99;" d line:99 -EP08_OUT::((0x08<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 98;" d line:98 -EP09_IN::((0x09<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 101;" d line:101 -EP09_OUT::((0x09<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 100;" d line:100 -EP0_BUFF_SIZE::8 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 38;" d line:38 -EP10_IN::((0x0A<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 103;" d line:103 -EP10_OUT::((0x0A<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 102;" d line:102 -EP11_IN::((0x0B<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 105;" d line:105 -EP11_OUT::((0x0B<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 104;" d line:104 -EP12_IN::((0x0C<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 107;" d line:107 -EP12_OUT::((0x0C<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 106;" d line:106 -EP13_IN::((0x0D<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 109;" d line:109 -EP13_OUT::((0x0D<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 108;" d line:108 -EP14_IN::((0x0E<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 111;" d line:111 -EP14_OUT::((0x0E<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 110;" d line:110 -EP15_IN::((0x0F<<3)|(IN<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 113;" d line:113 -EP15_OUT::((0x0F<<3)|(OUT<<2)) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 112;" d line:112 -EPDir C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 159;" m line:159 struct:_CTRL_TRF_SETUP::<anonymous> -EPNum C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 157;" m line:157 struct:_CTRL_TRF_SETUP::<anonymous> -EP_CTRL::0x06 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 60;" d line:60 -EP_IN::0x0A C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 62;" d line:62 -EP_OUT::0x0C C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 61;" d line:61 -EP_OUT_IN::0x0E C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 63;" d line:63 -ERASE_FLASH C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 176;" e line:176 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -EraseProgMem C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 166;" f line:166 signature:(void) -FAIL::FALSE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 153;" d line:153 -FALSE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 150;" e line:150 enum:_BOOL -GET_CFG::8 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 54;" d line:54 -GET_DSC::6 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 52;" d line:52 -GET_INTF::10 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 56;" d line:56 -GET_STATUS::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 48;" d line:48 -HITECH_C18 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 47;" d line:47 -HOST_TO_DEV::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 55;" d line:55 -HSHK_EN::0x10 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 64;" d line:64 -HighB C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 76;" m line:76 struct:_WORD::<anonymous> -IN::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 77;" d line:77 -INCDIS C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 89;" m line:89 struct:_BD_STAT::<anonymous> -INPUT_PIN::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\io_cfg.h 54;" d line:54 -IN_TOKEN::0b00001001 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 52;" d line:52 -IO_CFG_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\io_cfg.h 48;" d line:48 -KEN C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 90;" m line:90 struct:_BD_STAT::<anonymous> -LOWER_LSB::(a)((a).v[0]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 118;" d line:118 -LOWER_MSB::(a)((a).v[1]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 119;" d line:119 -LSB::(a)((a).v[0]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 83;" d line:83 -LowB C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 75;" m line:75 struct:_WORD::<anonymous> -MAJOR_VERSION::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 99;" d line:99 -MAX_EP_NUMBER::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 74;" d line:74 -MAX_NUM_INT::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 39;" d line:39 -MCHP_C18 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 49;" d line:49 -MINOR_VERSION::0x14 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 98;" d line:98 -MODE_PP::_PPBM0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 42;" d line:42 -MSB::(a)((a).v[1]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 84;" d line:84 -MUID_NULL::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 59;" d line:59 -MUID_USB9::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 60;" d line:60 -OK::TRUE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 152;" d line:152 -OUT::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 76;" d line:76 -OUTPUT_PIN::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\io_cfg.h 55;" d line:55 -OUT_TOKEN::0b00000001 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 51;" d line:51 -OVER_HEAD::5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 163;" d line:163 -PIC_EP_DIR_MASK::0b00000100 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 80;" d line:80 -PIC_EP_NUM_MASK::0b01111000 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 79;" d line:79 -PID C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 106;" m line:106 struct:_BD_STAT::<anonymous> -PID0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 97;" m line:97 struct:_BD_STAT::<anonymous> -PID1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 98;" m line:98 struct:_BD_STAT::<anonymous> -PID2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 99;" m line:99 struct:_BD_STAT::<anonymous> -PID3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 100;" m line:100 struct:_BD_STAT::<anonymous> -POINTER C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 148;" t line:148 -POWERED_STATE::2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 60;" d line:60 -RCPT_DEV::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 62;" d line:62 -RCPT_EP::2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 64;" d line:64 -RCPT_INTF::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 63;" d line:63 -RCPT_OTH::3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 65;" d line:65 -READ_CONFIG C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 179;" e line:179 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -READ_EEDATA C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 177;" e line:177 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -READ_FLASH C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 174;" e line:174 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -READ_VERSION C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 173;" e line:173 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -RESET C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 182;" e line:182 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -RM_HIGH_INTERRUPT_VECTOR::0x000808 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 91;" d line:91 -RM_LOW_INTERRUPT_VECTOR::0x000818 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 92;" d line:92 -RM_RESET_VECTOR::0x000800 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 90;" d line:90 -ReadEE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 183;" f line:183 signature:(void) -ReadEEPROM C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\eeprom.c 24;" f line:24 signature:(unsigned char addr) -ReadEEPROM C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\eeprom.h 1;" p line:1 signature:(unsigned char addr) -ReadProgMem C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 128;" f line:128 signature:(void) -ReadVersion C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 122;" f line:122 signature:(void) -Recipient C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 86;" m line:86 struct:_CTRL_TRF_SETUP::<anonymous> -RemoteWakeup C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 76;" m line:76 struct:_USB_DEVICE_STATUS::<anonymous> -RequestType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 87;" m line:87 struct:_CTRL_TRF_SETUP::<anonymous> -SENDING_RESP::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 103;" d line:103 -SETUP_TOKEN::0b00001101 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 50;" d line:50 -SET_ADR::5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 51;" d line:51 -SET_CFG::9 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 55;" d line:55 -SET_DSC::7 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 53;" d line:53 -SET_FEATURE::3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 50;" d line:50 -SET_INTF::11 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 57;" d line:57 -STANDARD::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 58;" d line:58 -SYNCH_FRAME::12 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 58;" d line:58 -SetupPkt C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.c 268;" v line:268 -StartWrite C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 112;" f line:112 signature:(void) -Stat C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 115;" m line:115 struct:_BDT::<anonymous> -TRUE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 150;" e line:150 enum:_BOOL -TYPEDEFS_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 38;" d line:38 -UCFG_VAL::_PUEN|_TRINT|_FS|MODE_PP C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 43;" d line:43 -UOWN C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 102;" m line:102 struct:_BD_STAT::<anonymous> -UOWN C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 92;" m line:92 struct:_BD_STAT::<anonymous> -UPDATE_LED C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 181;" e line:181 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -UPPER_LSB::(a)((a).v[2]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 120;" d line:120 -UPPER_MSB::(a)((a).v[3]) C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 121;" d line:121 -USB9_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 37;" d line:37 -USBCFG_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbcfg.h 35;" d line:35 -USBCTRLTRF_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 37;" d line:37 -USBCheckBusStatus C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 88;" f line:88 signature:(void) -USBCheckBusStatus C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 197;" p line:197 signature:(void) -USBCheckStdRequest C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 79;" f line:79 signature:(void) -USBCheckStdRequest C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.h 92;" p line:92 signature:(void) -USBCtrlEPService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 104;" f line:104 signature:(void) -USBCtrlEPService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 75;" p line:75 signature:(void) -USBCtrlEPServiceComplete C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 397;" f line:397 signature:(void) -USBCtrlEPServiceComplete C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 78;" p line:78 signature:(void) -USBCtrlTrfInHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 247;" f line:247 signature:(void) -USBCtrlTrfInHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 80;" p line:80 file: signature:(void) -USBCtrlTrfOutHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 202;" f line:202 signature:(void) -USBCtrlTrfOutHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 79;" p line:79 file: signature:(void) -USBCtrlTrfRxService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 346;" f line:346 signature:(void) -USBCtrlTrfRxService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 77;" p line:77 signature:(void) -USBCtrlTrfSetupHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 159;" f line:159 signature:(void) -USBCtrlTrfSetupHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 78;" p line:78 file: signature:(void) -USBCtrlTrfTxService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 286;" f line:286 signature:(void) -USBCtrlTrfTxService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 76;" p line:76 signature:(void) -USBDEFS_EP0_BUFF_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 41;" d line:41 -USBDEFS_STD_DSC_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 41;" d line:41 -USBDRV_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 39;" d line:39 -USBDSC_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdsc.h 40;" d line:40 -USBDriverService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 122;" f line:122 signature:(void) -USBDriverService C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 198;" p line:198 signature:(void) -USBErrorHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 68;" p line:68 file: signature:(void) -USBMMAP_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 38;" d line:38 -USBModuleDisable C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 60;" p line:60 file: signature:(void) -USBModuleEnable C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 59;" p line:59 file: signature:(void) -USBPrepareForNextSetupTrf C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.c 512;" f line:512 signature:(void) -USBPrepareForNextSetupTrf C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 79;" p line:79 signature:(void) -USBProtocolResetHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 258;" f line:258 signature:(void) -USBProtocolResetHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 65;" p line:65 file: signature:(void) -USBRemoteWakeup C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 199;" p line:199 signature:(void) -USBSoftDetach C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 200;" p line:200 signature:(void) -USBStallHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 67;" p line:67 file: signature:(void) -USBStdFeatureReqHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 59;" p line:59 file: signature:(void) -USBStdGetDscHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 56;" p line:56 file: signature:(void) -USBStdGetStatusHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 58;" p line:58 file: signature:(void) -USBStdSetCfgHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 210;" f line:210 signature:(void) -USBStdSetCfgHandler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb9.c 57;" p line:57 file: signature:(void) -USBSuspend C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 62;" p line:62 file: signature:(void) -USBWakeFromSuspend C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 63;" p line:63 file: signature:(void) -USB_CFG_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 139;" t line:139 -USB_DEVICE_STATUS C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 79;" t line:79 -USB_DEV_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 129;" t line:129 -USB_EP_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 158;" t line:158 -USB_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usb.h 37;" d line:37 -USB_INTF_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 149;" t line:149 -USB_SOF_Handler C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.c 66;" p line:66 file: signature:(void) -VENDOR::0x02 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 60;" d line:60 -WAIT_FOR_CMD::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 102;" d line:102 -WAIT_SETUP::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbctrltrf.h 45;" d line:45 -WORD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 82;" t line:82 -WRITE_CONFIG C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 180;" e line:180 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -WRITE_EEDATA C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 178;" e line:178 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -WRITE_FLASH C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 175;" e line:175 enum:_BOOT_DATA_PACKET::<anonymous>::<anonymous> -W_Index C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 81;" m line:81 struct:_CTRL_TRF_SETUP::<anonymous> -W_Length C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 82;" m line:82 struct:_CTRL_TRF_SETUP::<anonymous> -W_Value C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 80;" m line:80 struct:_CTRL_TRF_SETUP::<anonymous> -Word0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 110;" m line:110 struct:_DWORD::<anonymous> -Word1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 111;" m line:111 struct:_DWORD::<anonymous> -WriteConfig C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 209;" f line:209 signature:(void) -WriteEE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 195;" f line:195 signature:(void) -WriteEEPROM C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\eeprom.c 6;" f line:6 signature:(unsigned char addr, unsigned char data) -WriteEEPROM C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\eeprom.h 2;" p line:2 signature:(unsigned char addr, unsigned char data) -WriteProgMem C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.c 141;" f line:141 signature:(void) -_AD::0x02<<2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 108;" d line:108 -_AS::0x01<<2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 107;" d line:107 -_BDT C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 111;" u line:111 -_BD_STAT C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 81;" u line:81 -_BOOL C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 150;" g line:150 -_BOOT_DATA_PACKET C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 166;" u line:166 -_BSTALL::0x04 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 47;" d line:47 -_BULK::0x02 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 102;" d line:102 -_BYTE C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 44;" u line:44 -_CTRL::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 100;" d line:100 -_CTRL_TRF_DATA C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 179;" u line:179 -_CTRL_TRF_SETUP C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 59;" u line:59 -_DAT0::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 51;" d line:51 -_DAT1::0x40 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 52;" d line:52 -_DE::0x00<<4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 112;" d line:112 -_DEFAULT::0x01<<7 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 95;" d line:95 -_DTSEN::0x08 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 48;" d line:48 -_DTSMASK::0x40 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 53;" d line:53 -_DWORD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 86;" u line:86 -_EP01_IN::0x81 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 64;" d line:64 -_EP01_OUT::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 63;" d line:63 -_EP02_IN::0x82 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 66;" d line:66 -_EP02_OUT::0x02 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 65;" d line:65 -_EP03_IN::0x83 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 68;" d line:68 -_EP03_OUT::0x03 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 67;" d line:67 -_EP04_IN::0x84 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 70;" d line:70 -_EP04_OUT::0x04 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 69;" d line:69 -_EP05_IN::0x85 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 72;" d line:72 -_EP05_OUT::0x05 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 71;" d line:71 -_EP06_IN::0x86 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 74;" d line:74 -_EP06_OUT::0x06 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 73;" d line:73 -_EP07_IN::0x87 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 76;" d line:76 -_EP07_OUT::0x07 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 75;" d line:75 -_EP08_IN::0x88 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 78;" d line:78 -_EP08_OUT::0x08 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 77;" d line:77 -_EP09_IN::0x89 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 80;" d line:80 -_EP09_OUT::0x09 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 79;" d line:79 -_EP10_IN::0x8A C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 82;" d line:82 -_EP10_OUT::0x0A C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 81;" d line:81 -_EP11_IN::0x8B C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 84;" d line:84 -_EP11_OUT::0x0B C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 83;" d line:83 -_EP12_IN::0x8C C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 86;" d line:86 -_EP12_OUT::0x0C C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 85;" d line:85 -_EP13_IN::0x8D C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 88;" d line:88 -_EP13_OUT::0x0D C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 87;" d line:87 -_EP14_IN::0x8E C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 90;" d line:90 -_EP14_OUT::0x0E C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 89;" d line:89 -_EP15_IN::0x8F C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 92;" d line:92 -_EP15_OUT::0x0F C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 91;" d line:91 -_FE::0x01<<4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 113;" d line:113 -_FS::0x04 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 52;" d line:52 -_IE::0x02<<4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 114;" d line:114 -_INCDIS::0x10 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 49;" d line:49 -_INT::0x03 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 103;" d line:103 -_ISO::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 101;" d line:101 -_KEN::0x20 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 50;" d line:50 -_LS::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 51;" d line:51 -_NS::0x00<<2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 106;" d line:106 -_OEMON::0x40 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 56;" d line:56 -_POINTER C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 125;" u line:125 -_PPBM0::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 48;" d line:48 -_PPBM1::0x01 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 49;" d line:49 -_PPBM2::0x02 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 50;" d line:50 -_PUEN::0x10 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 55;" d line:55 -_RAM::0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 67;" d line:67 -_ROM::1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 68;" d line:68 -_RWU::0x01<<5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 97;" d line:97 -_SELF::0x01<<6 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 96;" d line:96 -_SY::0x03<<2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 109;" d line:109 -_TREXT::0x08 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 54;" d line:54 -_TRINT::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 53;" d line:53 -_UCPU::0x00 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 55;" d line:55 -_USB_CFG_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 134;" s line:134 -_USB_DEVICE_STATUS C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 71;" u line:71 -_USB_DEV_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 122;" s line:122 -_USB_EP_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 154;" s line:154 -_USB_INTF_DSC C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 144;" s line:144 -_USIE::0x80 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 54;" d line:54 -_UTEYE::0x80 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdrv.h 57;" d line:57 -_WORD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 60;" u line:60 -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\boot.h 168;" m line:168 union:_BOOT_DATA_PACKET -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 46;" m line:46 union:_BYTE -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 184;" m line:184 struct:_CTRL_TRF_DATA::<anonymous> -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 64;" m line:64 struct:_CTRL_TRF_SETUP::<anonymous> -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 73;" m line:73 union:_USB_DEVICE_STATUS -_byte C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbmmap.h 83;" m line:83 union:_BD_STAT -_byte0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 190;" m line:190 struct:_CTRL_TRF_DATA::<anonymous> -_byte1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 191;" m line:191 struct:_CTRL_TRF_DATA::<anonymous> -_byte2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 192;" m line:192 struct:_CTRL_TRF_DATA::<anonymous> -_byte3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 193;" m line:193 struct:_CTRL_TRF_DATA::<anonymous> -_byte4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 194;" m line:194 struct:_CTRL_TRF_DATA::<anonymous> -_byte5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 195;" m line:195 struct:_CTRL_TRF_DATA::<anonymous> -_byte6 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 196;" m line:196 struct:_CTRL_TRF_DATA::<anonymous> -_byte7 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 197;" m line:197 struct:_CTRL_TRF_DATA::<anonymous> -_dword C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 88;" m line:88 union:_DWORD -_high_ISR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\main.c 114;" f line:114 signature:(void) -_low_ISR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\main.c 120;" f line:120 signature:(void) -_word C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 133;" m line:133 union:_POINTER -_word C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 62;" m line:62 union:_WORD -_word0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 201;" m line:201 struct:_CTRL_TRF_DATA::<anonymous> -_word1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 202;" m line:202 struct:_CTRL_TRF_DATA::<anonymous> -_word2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 203;" m line:203 struct:_CTRL_TRF_DATA::<anonymous> -_word3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 204;" m line:204 struct:_CTRL_TRF_DATA::<anonymous> -b0 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 49;" m line:49 struct:_BYTE::<anonymous> -b1 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 50;" m line:50 struct:_BYTE::<anonymous> -b2 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 51;" m line:51 struct:_BYTE::<anonymous> -b3 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 52;" m line:52 struct:_BYTE::<anonymous> -b4 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 53;" m line:53 struct:_BYTE::<anonymous> -b5 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 54;" m line:54 struct:_BYTE::<anonymous> -b6 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 55;" m line:55 struct:_BYTE::<anonymous> -b7 C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\typedefs.h 56;" m line:56 struct:_BYTE::<anonymous> -bAltID C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 133;" m line:133 struct:_CTRL_TRF_SETUP::<anonymous> -bAltID_H C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 134;" m line:134 struct:_CTRL_TRF_SETUP::<anonymous> -bAltSetting C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 147;" m line:147 struct:_USB_INTF_DSC -bCfgRSD C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 123;" m line:123 struct:_CTRL_TRF_SETUP::<anonymous> -bCfgValue C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 122;" m line:122 struct:_CTRL_TRF_SETUP::<anonymous> -bCfgValue C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 137;" m line:137 struct:_USB_CFG_DSC -bDevADR C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 111;" m line:111 struct:_CTRL_TRF_SETUP::<anonymous> -bDevADRH C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 112;" m line:112 struct:_CTRL_TRF_SETUP::<anonymous> -bDevCls C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 125;" m line:125 struct:_USB_DEV_DSC -bDevProtocol C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 125;" m line:125 struct:_USB_DEV_DSC -bDevSubCls C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 125;" m line:125 struct:_USB_DEV_DSC -bDscIndex C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 101;" m line:101 struct:_CTRL_TRF_SETUP::<anonymous> -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_ep0_buff.h 102;" m line:102 struct:_CTRL_TRF_SETUP::<anonymous> -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 124;" m line:124 struct:_USB_DEV_DSC -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 136;" m line:136 struct:_USB_CFG_DSC -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 146;" m line:146 struct:_USB_INTF_DSC -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootloader\usbdefs_std_dsc.h 156;" m line:156 struct:_USB_EP_DSC -bDscType C:\krobot\USB_Module\Motor_Controller\Firmware\Bootl... [truncated message content] |
From: Jérémie D. <Ba...@us...> - 2010-08-29 19:12:39
|
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 84a5cf0e3ce26a9fcd902b0082706fc4d0f2731b (commit) from a1ad97965ab1c58c2299050e2e689100f54ae67d (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 84a5cf0e3ce26a9fcd902b0082706fc4d0f2731b Author: Jérémie Dimino <je...@di...> Date: Sun Aug 29 21:11:35 2010 +0200 Update the build process with new ocaml 3.12 features ----------------------------------------------------------------------- Changes: diff --git a/info/control/_tags b/info/control/_tags index d17f39b..061642a 100644 --- a/info/control/_tags +++ b/info/control/_tags @@ -1,17 +1,17 @@ # -*- conf -*- # Uses the lwt syntax extension for all files: -<**/*.ml>: syntax_camlp4o, pkg_lwt.syntax, pkg_lwt.syntax.log +<**/*.ml>: syntax(camlp4o), package(lwt.syntax), package(lwt.syntax.log) # Use the obus syntax extension for all files: -<**/*.ml>: pkg_obus.syntax +<**/*.ml>: package(obus.syntax) # Libraries used by all part of the robot: -<**/*>: pkg_obus, pkg_lwt.text +<**/*> and not <**/*.cm{a,xa,xs}>: package(obus), package(lwt.text) # Only the driver and card tools have access to the hardware. The rest # should be compilable even without ocaml-usb and ocaml-serial. -<{driver,usb-tools}/**/*>: thread, pkg_usb, pkg_serial +<{driver,usb-tools}/**/*>: package(threads), package(usb), package(serial) # SDL is used to access the sixaxis controller -<clients/krobot_joystick.*>: pkg_sdl +<clients/krobot_joystick.*>: package(sdl) diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index 2c1a19f..e2e5ecf 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -99,45 +99,6 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, ] (* +-----------------------------------------------------------------+ - | Ocamlfind | - +-----------------------------------------------------------------+ *) - -(* Put here packages you may use in this project: *) -let packages = [ - "type-conv"; - "type-conv.syntax"; - "camlp4"; - "camlp4.extend"; - "camlp4.lib"; - "camlp4.macro"; - "camlp4.quotations.o"; - "camlp4.quotations.r"; - "lwt"; - "lwt.unix"; - "lwt.syntax"; - "lwt.syntax.log"; - "lwt.text"; - "text"; - "text.pcre"; - "str"; - "xmlm"; - "react"; - "usb"; - "obus"; - "obus.syntax"; - "bitstring"; - "bitstring.syntax"; - "sdl"; - "serial"; -] - -(* List of available syntaxes :*) -let syntaxes = [ - "camlp4o"; - "camlp4r"; -] - -(* +-----------------------------------------------------------------+ | Utils | +-----------------------------------------------------------------+ *) @@ -153,17 +114,8 @@ let flag_all_stages tag f = let _ = dispatch begin function | Before_options -> - - Options.make_links := false; - - (* override default commands by ocamlfind ones *) - let ocamlfind x = S[A"ocamlfind"; A x] in - Options.ocamlc := ocamlfind "ocamlc"; - Options.ocamlopt := ocamlfind "ocamlopt"; - Options.ocamldep := ocamlfind "ocamldep"; - (* FIXME: sometimes ocamldoc say that elements are not found - even if they are present: *) - Options.ocamldoc := S[A"ocamlfind"; A"ocamldoc"; A"-hide-warnings"] + Options.use_ocamlfind := true; + Options.make_links := false | After_rules -> @@ -226,23 +178,10 @@ let _ = virtual_rule "all" targets; (* +---------------------------------------------------------+ - | Ocamlfind stuff | + | Hacks | +---------------------------------------------------------+ *) - (* When one link an OCaml binary, one should use -linkpkg *) - flag ["ocaml"; "link"; "program"] & A"-linkpkg"; - - (* For each ocamlfind package one inject the -package option - when compiling, computing dependencies, generating - documentation and linking. *) - List.iter - (fun package -> flag_all_stages ("pkg_" ^ package) (S[A"-package"; A package])) - packages; - - (* Like -package but for extensions syntax. Morover -syntax is - useless when linking. *) - List.iter - (fun syntax -> flag_all_stages_except_link ("syntax_" ^ syntax) (S[A"-syntax"; A syntax])) - syntaxes; + flag ["ocaml"; "package(threads)"; "compile"] & S[A "-thread"]; + flag ["ocaml"; "package(threads)"; "link"] & S[A "-thread"] | _ -> () end hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-08-29 14:43:33
|
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 a1ad97965ab1c58c2299050e2e689100f54ae67d (commit) from 39396770f86343a37b6a3ca7e0f2b36d1db963f4 (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 a1ad97965ab1c58c2299050e2e689100f54ae67d Author: Jérémie Dimino <je...@di...> Date: Sun Aug 29 16:42:47 2010 +0200 Update DBus code ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index 1ee8ea6..b1f4ae3 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -440,7 +440,7 @@ lwt () = in (* Service monitoring *) - Lwt_event.always_notify_p (fun _ -> check_services bus) (OBus_signal.event (OBus_bus.name_owner_changed bus)); + lwt () = Lwt_event.always_notify_p (fun _ -> check_services bus) =|< OBus_signal.connect (OBus_bus.name_owner_changed bus) in (* State of robot *) let monitor name dummy make = @@ -448,9 +448,9 @@ lwt () = (React.S.const dummy) (Lwt_event.map_s (function - | Some _ -> make () - | None -> return (React.S.const dummy)) - (Lwt_signal.delay (OBus_resolver.make bus name >|= OBus_resolver.owner))) + | "" -> return (React.S.const dummy) + | _ -> make ()) + (Lwt_signal.delay (OBus_resolver.make bus name))) in let state = React.S.l4 @@ -511,12 +511,11 @@ lwt () = (* Display log comming from daemons *) let daemons = OBus_proxy.make (OBus_peer.anonymous bus) ["fr"; "krobot"; "Daemon"] in - Lwt_event.always_notify - (fun msg -> log_add_lines (List.map (fun line -> [text line]) (Text.split ~sep:"\n" msg))) - (OBus_signal.event - (OBus_signal.connect - Krobot_dbus_daemon.Fr_krobot_Daemon.s_log - daemons)); + lwt () = + Lwt_event.always_notify + (fun msg -> log_add_lines (List.map (fun line -> [text line]) (Text.split ~sep:"\n" msg))) + =|< OBus_signal.connect (OBus_signal.make Krobot_dbus_daemon.Fr_krobot_Daemon.s_log daemons) + in lwt history = Lwt_read_line.load_history history_file_name in set_engine_state (Engine.init history); diff --git a/info/control/clients/krobot_script.ml b/info/control/clients/krobot_script.ml index ab8b352..1a6a614 100644 --- a/info/control/clients/krobot_script.ml +++ b/info/control/clients/krobot_script.ml @@ -160,16 +160,16 @@ let monitor_names interpreter (name, old_owner, new_owner) = interpreter.itp_set_commands (String_map.fold (fun cmd_name command acc -> - if OBus_proxy.name command.cmd_proxy = Some name then + if OBus_proxy.name command.cmd_proxy = name then acc else String_map.add cmd_name command acc) (React.S.value interpreter.itp_commands) String_map.empty); match new_owner with - | None -> + | "" -> return () - | Some _ -> + | _ -> add_service interpreter name (* +-----------------------------------------------------------------+ @@ -187,13 +187,8 @@ let make krobot = itp_set_commands = set_commands; itp_monitor_names = React.E.never; } in - interpreter.itp_monitor_names <- ( - React.E.map - (monitor_names interpreter) - (OBus_signal.event - (OBus_bus.name_owner_changed - (Krobot.to_bus krobot))) - ); + lwt event = OBus_signal.connect (OBus_bus.name_owner_changed (Krobot.to_bus krobot)) in + interpreter.itp_monitor_names <- React.E.map (monitor_names interpreter) event; lwt names = OBus_bus.list_names (Krobot.to_bus krobot) in lwt () = Lwt_list.iter_p (add_service interpreter) names in return interpreter diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index a5be299..fe63a99 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -18,7 +18,7 @@ let shutdown peer = OBus_method.call m_shutdown (OBus_proxy.make peer path) () let log peer = - OBus_signal.connect s_log (OBus_proxy.make peer path) + OBus_signal.make s_log (OBus_proxy.make peer path) module Server = struct @@ -32,19 +32,17 @@ struct let log daemon message = OBus_signal.emit s_log daemon.obus message - let shutdown daemon context = + let shutdown daemon = if daemon.quit then begin - lwt () = daemon.quit_waiter in - OBus_method.return context () + daemon.quit_waiter end else begin daemon.quit <- true; lwt () = Lwt_log.info ~section "shutdown method invoked" in - lwt _ = OBus_method.return context () in wakeup daemon.quit_wakener (); exit 0 end - let interface = make { m_shutdown = (fun context obj () -> shutdown obj context) } + let interface = make { m_shutdown = (fun context obj () -> shutdown (OBus_object.get obj)) } end let start ~desc ~name init = @@ -83,9 +81,11 @@ let start ~desc ~name init = in (* Exit the program when we lost the name *) - Lwt_event.always_notify - (fun lost_name -> if name = lost_name then exit 0) - (OBus_signal.event (OBus_bus.name_lost bus)); + lwt () = + Lwt_event.always_notify + (fun lost_name -> if name = lost_name then exit 0) + =|< OBus_signal.connect (OBus_bus.name_lost bus) + in lwt () = if Lazy.force no_fork then diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index c819ecf..972e046 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -51,14 +51,12 @@ struct make { m_set_state = ( fun ctx obj state -> - lwt result = set_state obj ~state in - OBus_method.return ctx result + set_state (OBus_object.get obj) ~state ); m_set_velocity = ( fun ctx obj (velocity, duration) -> let velocity = Int32.to_int velocity in - lwt result = set_velocity obj velocity duration in - OBus_method.return ctx result + set_velocity (OBus_object.get obj) velocity duration ); } @@ -106,14 +104,12 @@ struct fun ctx obj (enable, disable) -> let enable = List.map Int32.to_int enable in let disable = List.map Int32.to_int disable in - lwt result = set_config obj enable disable in - OBus_method.return ctx result + set_config (OBus_object.get obj) enable disable ); m_set_state = ( fun ctx obj states -> let states = List.map (fun (k, v) -> (Int32.to_int k, Int32.to_int v)) states in - lwt result = set_state obj states in - OBus_method.return ctx result + set_state (OBus_object.get obj) states ); } @@ -141,9 +137,7 @@ struct make { m_get_measure = ( fun ctx obj () -> - let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_measure obj in - OBus_method.return ctx result + get_measure (OBus_object.get obj) >|= Int32.of_int ); } @@ -298,44 +292,37 @@ struct m_ping = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = ping obj id in - OBus_method.return ctx result + ping (OBus_object.get obj) id ); m_action = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = action obj id in - OBus_method.return ctx result + action (OBus_object.get obj) id ); m_reset = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = reset obj id in - OBus_method.return ctx result + reset (OBus_object.get obj) id ); m_get = ( fun ctx obj (id, address) -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in let address = make_readable_register address in - lwt result = get obj id address in - OBus_method.return ctx result + get (OBus_object.get obj) id address >|= Int32.of_int ); m_set = ( fun ctx obj (id, address, value) -> let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = set obj id address value in - OBus_method.return ctx result + set (OBus_object.get obj) id address value ); m_reg_set = ( fun ctx obj (id, address, value) -> let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = reg_set obj id address value in - OBus_method.return ctx result + reg_set (OBus_object.get obj) id address value ); m_goto = ( fun ctx obj (id, position, speed, mode) -> @@ -343,28 +330,22 @@ struct let position = Int32.to_int position in let speed = Int32.to_int speed in let mode = make_exec_mode mode in - lwt result = goto obj id position speed mode in - OBus_method.return ctx result + goto (OBus_object.get obj) id position speed mode ); m_config = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = config obj id in - OBus_method.return ctx result + config (OBus_object.get obj) id ); m_get_position = ( fun ctx obj id -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_position obj id in - OBus_method.return ctx result + get_position (OBus_object.get obj) id >|= Int32.of_int ); m_get_speed = ( fun ctx obj id -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_speed obj id in - OBus_method.return ctx result + get_speed (OBus_object.get obj) id >|= Int32.of_int ); } @@ -429,44 +410,37 @@ struct m_ping = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = ping obj ~id in - OBus_method.return ctx result + ping (OBus_object.get obj) ~id ); m_action = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = action obj ~id in - OBus_method.return ctx result + action (OBus_object.get obj) ~id ); m_reset = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = reset obj ~id in - OBus_method.return ctx result + reset (OBus_object.get obj) ~id ); m_get = ( fun ctx obj (id, address) -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in let address = make_readable_register address in - lwt result = get obj ~id ~address in - OBus_method.return ctx result + get (OBus_object.get obj) ~id ~address >|= Int32.of_int ); m_set = ( fun ctx obj (id, address, value) -> let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = set obj ~id ~address ~value in - OBus_method.return ctx result + set (OBus_object.get obj) ~id ~address ~value ); m_reg_set = ( fun ctx obj (id, address, value) -> let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = reg_set obj ~id ~address ~value in - OBus_method.return ctx result + reg_set (OBus_object.get obj) ~id ~address ~value ); m_goto = ( fun ctx obj (id, position, speed, mode) -> @@ -474,28 +448,22 @@ struct let position = Int32.to_int position in let speed = Int32.to_int speed in let mode = make_exec_mode mode in - lwt result = goto obj ~id ~position ~speed ~mode in - OBus_method.return ctx result + goto (OBus_object.get obj) ~id ~position ~speed ~mode ); m_config = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = config obj id in - OBus_method.return ctx result + config (OBus_object.get obj) id ); m_get_position = ( fun ctx obj id -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_position obj ~id in - OBus_method.return ctx result + get_position (OBus_object.get obj) ~id >|= Int32.of_int ); m_get_speed = ( fun ctx obj id -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_speed obj ~id in - OBus_method.return ctx result + get_speed (OBus_object.get obj) ~id >|= Int32.of_int ); } @@ -520,8 +488,8 @@ struct make { m_get = ( fun ctx obj () -> - lwt result = get obj in - OBus_method.return ctx (List.map Int32.of_int (Array.to_list result)) + lwt result = get (OBus_object.get obj) in + return (List.map Int32.of_int (Array.to_list result)) ); } @@ -575,36 +543,30 @@ struct make { m_clear = ( fun ctx obj () -> - lwt result = clear obj () in - OBus_method.return ctx result + clear (OBus_object.get obj) () ); m_set_cursor = ( fun ctx obj state -> - lwt result = set_cursor obj state in - OBus_method.return ctx result + set_cursor (OBus_object.get obj) state ); m_set_backlight = ( fun ctx obj state -> - lwt result = set_backlight obj state in - OBus_method.return ctx result + set_backlight (OBus_object.get obj) state ); m_goto = ( fun ctx obj (line, column) -> let line = Int32.to_int line in let column = Int32.to_int column in - lwt result = goto obj line column in - OBus_method.return ctx result + goto (OBus_object.get obj) line column ); m_write = ( fun ctx obj text -> - lwt result = write obj text in - OBus_method.return ctx result + write (OBus_object.get obj) text ); m_write_line = ( fun ctx obj (line, text) -> let line = Int32.to_int line in - lwt result = write_line obj line text in - OBus_method.return ctx result + write_line (OBus_object.get obj) line text ); } @@ -638,8 +600,7 @@ struct make { m_get_state = ( fun ctx obj () -> - lwt result = get_state obj () in - OBus_method.return ctx result + get_state (OBus_object.get obj) () ); } @@ -773,54 +734,41 @@ struct make { m_move = ( fun ctx obj (distance, velocity, acceleration) -> - lwt result = move obj distance velocity acceleration in - OBus_method.return ctx result + move (OBus_object.get obj) distance velocity acceleration ); m_turn = ( fun ctx obj (angle, velocity, acceleration) -> - lwt result = turn obj angle velocity acceleration in - OBus_method.return ctx result + turn (OBus_object.get obj) angle velocity acceleration ); m_stop = ( fun ctx obj (motor, mode) -> let motor = make_motor motor in let mode = make_stop_mode mode in - lwt result = stop obj motor mode in - OBus_method.return ctx result + stop (OBus_object.get obj) motor mode ); m_set_velocities = ( fun ctx obj (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) -> - lwt result = set_velocities obj velocity_r acceleration_r velocity_l acceleration_l duration in - OBus_method.return ctx result + set_velocities (OBus_object.get obj) velocity_r acceleration_r velocity_l acceleration_l duration ); m_get_current_velocities = ( fun ctx obj () -> - lwt result = get_current_velocities obj in - OBus_method.return ctx result + get_current_velocities (OBus_object.get obj) ); m_get_current_positions = ( fun ctx obj () -> - lwt result = get_current_positions obj in - OBus_method.return ctx result + get_current_positions (OBus_object.get obj) ); m_get_config = ( fun ctx obj () -> - let ctx = - OBus_context.map - (fun (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l) -> - let kp_r = Int32.of_int kp_r in - let ki_r = Int32.of_int ki_r in - let kd_r = Int32.of_int kd_r in - let li_r = Int32.of_int li_r in - let kp_l = Int32.of_int kp_l in - let ki_l = Int32.of_int ki_l in - let kd_l = Int32.of_int kd_l in - let li_l = Int32.of_int li_l in - (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l)) - ctx - in - lwt result = get_config obj in - OBus_method.return ctx result + lwt (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l) = get_config (OBus_object.get obj) in + return (Int32.of_int kp_r, + Int32.of_int ki_r, + Int32.of_int kd_r, + Int32.of_int li_r, + Int32.of_int kp_l, + Int32.of_int ki_l, + Int32.of_int kd_l, + Int32.of_int li_l) ); m_set_config = ( fun ctx obj (motor, kp, ki, kd, li) -> @@ -829,8 +777,7 @@ struct let ki = Int32.to_int ki in let kd = Int32.to_int kd in let li = Int32.to_int li in - lwt result = set_config obj motor kp ki kd li in - OBus_method.return ctx result + set_config (OBus_object.get obj) motor kp ki kd li ); } @@ -884,30 +831,24 @@ struct make { m_set_buzzer_state = ( fun ctx obj state -> - lwt result = set_buzzer_state obj state in - OBus_method.return ctx result + set_buzzer_state (OBus_object.get obj) state ); m_get_cell_voltage = ( fun ctx obj () -> - lwt result = get_cell_voltage obj in - OBus_method.return ctx (List.map Int32.of_int (Array.to_list result)) + lwt result = get_cell_voltage (OBus_object.get obj) in + return (List.map Int32.of_int (Array.to_list result)) ); m_get_current = ( fun ctx obj () -> - let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_current obj in - OBus_method.return ctx result + get_current (OBus_object.get obj) >|= Int32.of_int ); m_get_power_state = ( fun ctx obj () -> - lwt result = get_power_state obj in - OBus_method.return ctx result + get_power_state (OBus_object.get obj) ); m_get_battery_state = ( fun ctx obj () -> - let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_battery_state obj in - OBus_method.return ctx result + get_battery_state (OBus_object.get obj) >|= Int32.of_int ); } @@ -940,15 +881,12 @@ struct m_measure = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = measure obj id in - OBus_method.return ctx result + measure (OBus_object.get obj) id ); m_get = ( fun ctx obj id -> - let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get obj id in - OBus_method.return ctx result + get (OBus_object.get obj) id >|= Int32.of_int ); } @@ -966,8 +904,8 @@ struct let obus = OBus_object.make ~interfaces:[make { - p_name = (fun card -> React.S.const (Device.name card)); - p_state = (fun card -> React.S.map cast_state (Device.state card)); + p_name = (fun obj -> React.S.const (Device.name (OBus_object.get obj))); + p_state = (fun obj -> React.S.map cast_state (Device.state (OBus_object.get obj))); }] ["fr"; "krobot"; "Cards"; Device.name card] in @@ -1022,33 +960,28 @@ struct make { m_get_firmware_build = ( fun ctx obj () -> - lwt result = get_firmware_build obj in - OBus_method.return ctx result + get_firmware_build (OBus_object.get obj) ); m_get_board_info = ( fun ctx obj () -> - lwt result = get_board_info obj in - OBus_method.return ctx result + get_board_info (OBus_object.get obj) ); m_get_ports_state = ( fun ctx obj () -> - lwt result = get_ports_state obj in - OBus_method.return ctx (List.map Int32.of_int (Array.to_list result)) + lwt result = get_ports_state (OBus_object.get obj) in + return (List.map Int32.of_int (Array.to_list result)) ); m_bootloader = ( fun ctx obj () -> - lwt result = bootloader obj in - OBus_method.return ctx result + bootloader (OBus_object.get obj) ); m_reset = ( fun ctx obj () -> - lwt result = reset obj in - OBus_method.return ctx result + reset (OBus_object.get obj) ); m_test = ( fun ctx obj () -> - lwt result = test obj in - OBus_method.return ctx result + test (OBus_object.get obj) ); } end diff --git a/info/control/services/krobot_service_claws.ml b/info/control/services/krobot_service_claws.ml index ca387ee..2a36bc4 100644 --- a/info/control/services/krobot_service_claws.ml +++ b/info/control/services/krobot_service_claws.ml @@ -35,28 +35,23 @@ let interface = make { m_enable = ( fun ctx obj () -> - lwt result = enable obj in - OBus_method.return ctx result + enable (OBus_object.get obj) ); m_disable = ( fun ctx obj () -> - lwt result = disable obj in - OBus_method.return ctx result + disable (OBus_object.get obj) ); m_open = ( fun ctx obj () -> - lwt result = open_ obj in - OBus_method.return ctx result + open_ (OBus_object.get obj) ); m_close = ( fun ctx obj () -> - lwt result = close obj in - OBus_method.return ctx result + close (OBus_object.get obj) ); m_take = ( fun ctx obj () -> - lwt result = take obj in - OBus_method.return ctx result + take (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_gate.ml b/info/control/services/krobot_service_gate.ml index e6053d5..09a4d84 100644 --- a/info/control/services/krobot_service_gate.ml +++ b/info/control/services/krobot_service_gate.ml @@ -38,33 +38,27 @@ let interface = make { m_enable = ( fun ctx obj () -> - lwt result = enable obj in - OBus_method.return ctx result + enable (OBus_object.get obj) ); m_disable = ( fun ctx obj () -> - lwt result = disable obj in - OBus_method.return ctx result + disable (OBus_object.get obj) ); m_close = ( fun ctx obj () -> - lwt result = close obj in - OBus_method.return ctx result + close (OBus_object.get obj) ); m_open = ( fun ctx obj () -> - lwt result = open_ obj in - OBus_method.return ctx result + open_ (OBus_object.get obj) ); m_hold_closed = ( fun ctx obj () -> - lwt result = hold_closed obj in - OBus_method.return ctx result + hold_closed (OBus_object.get obj) ); m_stop = ( fun ctx obj () -> - lwt result = stop obj in - OBus_method.return ctx result + stop (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_grip.ml b/info/control/services/krobot_service_grip.ml index f63fc8a..eb0bb94 100644 --- a/info/control/services/krobot_service_grip.ml +++ b/info/control/services/krobot_service_grip.ml @@ -92,28 +92,23 @@ let interface = make { m_up = ( fun ctx obj () -> - lwt result = up obj in - OBus_method.return ctx result + up (OBus_object.get obj) ); m_down = ( fun ctx obj () -> - lwt result = down obj in - OBus_method.return ctx result + down (OBus_object.get obj) ); m_open = ( fun ctx obj () -> - lwt result = open_ obj in - OBus_method.return ctx result + open_ (OBus_object.get obj) ); m_close = ( fun ctx obj () -> - lwt result = close obj in - OBus_method.return ctx result + close (OBus_object.get obj) ); m_release = ( fun ctx obj () -> - lwt result = release obj in - OBus_method.return ctx result + release (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_motors.ml b/info/control/services/krobot_service_motors.ml index e0a0222..ef28e6b 100644 --- a/info/control/services/krobot_service_motors.ml +++ b/info/control/services/krobot_service_motors.ml @@ -123,51 +123,33 @@ let interface = make { m_turn = ( fun ctx obj (angle, velocity, acceleration) -> - let ctx = - OBus_context.map - (fun (result, accomplished) -> - let result = cast_move_result result in - (result, accomplished)) - ctx - in - lwt result = turn obj angle velocity acceleration in - OBus_method.return ctx (result, 0.0) + lwt result = turn (OBus_object.get obj) angle velocity acceleration in + return (cast_move_result result, 0.0) ); m_move = ( fun ctx obj (distance, velocity, acceleration) -> - let ctx = - OBus_context.map - (fun (result, accomplished) -> - let result = cast_move_result result in - (result, accomplished)) - ctx - in - lwt result = move obj distance velocity acceleration in - OBus_method.return ctx (result, 0.0) + lwt result = move (OBus_object.get obj) distance velocity acceleration in + return (cast_move_result result, 0.0) ); m_stop = ( fun ctx obj mode -> let mode = make_stop_mode mode in - lwt result = stop obj mode in - OBus_method.return ctx result + stop (OBus_object.get obj) mode ); m_set_velocities = ( fun ctx obj (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) -> - lwt result = set_velocities obj velocity_r acceleration_r velocity_l acceleration_l duration in - OBus_method.return ctx result + set_velocities (OBus_object.get obj) velocity_r acceleration_r velocity_l acceleration_l duration ); m_inhibit_forward = ( fun ctx obj duration -> - lwt result = inhibit_forward obj duration in - OBus_method.return ctx result + inhibit_forward (OBus_object.get obj) duration ); m_inhibit_backward = ( fun ctx obj duration -> - lwt result = inhibit_backward obj duration in - OBus_method.return ctx result + inhibit_backward (OBus_object.get obj) duration ); - p_inhibited_forward = (fun obj -> obj.inhibited_forward); - p_inhibited_backward = (fun obj -> obj.inhibited_backward); + p_inhibited_forward = (fun obj -> (OBus_object.get obj).inhibited_forward); + p_inhibited_backward = (fun obj -> (OBus_object.get obj).inhibited_backward); } let init bus = diff --git a/info/control/services/krobot_service_sensors.ml b/info/control/services/krobot_service_sensors.ml index 18b1a5e..a178433 100644 --- a/info/control/services/krobot_service_sensors.ml +++ b/info/control/services/krobot_service_sensors.ml @@ -36,10 +36,10 @@ let poll ?(delay=0.05) f initial = let interface = make { - p_color = (fun obj -> React.S.map cast_color obj.color); - p_infrareds = (fun obj -> React.S.map (List.map Int32.of_int) obj.infrareds); - p_logic_sensors = (fun obj -> obj.logic_sensors); - p_range_finders = (fun obj -> React.S.map (List.map Int32.of_int) obj.range_finders); + p_color = (fun obj -> React.S.map cast_color (OBus_object.get obj).color); + p_infrareds = (fun obj -> React.S.map (List.map Int32.of_int) (OBus_object.get obj).infrareds); + p_logic_sensors = (fun obj -> (OBus_object.get obj).logic_sensors); + p_range_finders = (fun obj -> React.S.map (List.map Int32.of_int) (OBus_object.get obj).range_finders); } let init bus = diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index 48c5bfe..ebbfa3c 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -94,18 +94,15 @@ let interface = make { m_goto = ( fun ctx obj angle -> - lwt result = goto obj angle in - OBus_method.return ctx result + goto (OBus_object.get obj) angle ); m_scan = ( fun ctx obj () -> - lwt result = scan obj in - OBus_method.return ctx result + scan (OBus_object.get obj) ); m_find = ( fun ctx obj () -> - lwt result = find obj in - OBus_method.return ctx result + find (OBus_object.get obj) ); } hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-08-28 16:15:59
|
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 39396770f86343a37b6a3ca7e0f2b36d1db963f4 (commit) from bd87ee79c53b51acc7b339121c77e2e2201ceae0 (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 39396770f86343a37b6a3ca7e0f2b36d1db963f4 Author: Olivier BICHLER <oli...@cr...> Date: Sat Aug 28 18:15:24 2010 +0200 Added new H-Bridge HIP4081 SMD (to be reviewed) ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX new file mode 100644 index 0000000..bd75523 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_Bridge-1_0.mnl b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_Bridge-1_0.mnl new file mode 100644 index 0000000..4a26a53 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_Bridge-1_0.mnl differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE.DSN b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE.DSN new file mode 100644 index 0000000..0724067 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE.DSN differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE_0.DBK b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE_0.DBK new file mode 100644 index 0000000..cfe43fa Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_BRIDGE_0.DBK differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge-PSpiceFiles/.gitignore b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge-PSpiceFiles/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj new file mode 100644 index 0000000..aaf07e0 --- /dev/null +++ b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj @@ -0,0 +1,194 @@ +(ExpressProject "H_Bridge" + (ProjectVersion "19981106") + (ProjectType "Analog or A/D Mixed Mode") + (Folder "Design Resources" + (Folder "Library" + (File "c:\krobot\elec\lib\orcad\krobot.olb" + (Type "Schematic Library"))) + (NoModify) + (File ".\h_bridge.dsn" + (Type "Schematic Design")) + (BuildFileAddedOrDeleted "x") + (CompileFileAddedOrDeleted "x") + (Netlist_TAB "3") + (LAYOUT_Netlist_File + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\PCB\H_Bridge-1_0.mnl") + (LAYOUT_PCB_Footprint "{PCB Footprint}") + (FALSE) + (LAYOUT_Units "0") + (FALSE) + (BOM_Scope "0") + (BOM_Mode "0") + (BOM_Report_File "C:\krobot\USB_Module\H_Bridge\Assembly\H_BRIDGE.BOM") + (BOM_Merge_Include "FALSE") + (BOM_Property_Combine_7.0 "{Item}\t{Quantity}\t{Reference}\t{Value}") + (BOM_Header "Item\tQuantity\tReference\tPart") + (BOM_Include_File "C:\KROBOT\USB_MODULE\H_BRIDGE\SCHEMATIC\H_BRIDGE.INC") + (BOM_Include_File_Combine_7.0 "{Item}\t{Quantity}\t{Reference}\t{Value}") + (BOM_One_Part_Per_Line "FALSE") + (Open_BOM_in_Excel "FALSE") + (BOM_View_Output "FALSE") + (FALSE) + (FALSE) + (ANNOTATE_Scope "0") + (ANNOTATE_Mode "1") + (ANNOTATE_Action "0") + (Annotate_Page_Order "0") + (ANNOTATE_Reset_References_to_1 "FALSE") + (ANNOTATE_No_Page_Number_Change "FALSE") + (ANNOTATE_Property_Combine "{Value}{Source Package}{POWER_GROUP}") + (ANNOTATE_IncludeNonPrimitive "TRUE") + (ANNOTATE_Refdes_Control_Required "FALSE") + (FALSE) + (FALSE) + ( "FALSE")) + (Folder "Outputs" + (File "..\pcb\h_bridge-1_0.mnl" + (Type "LAYOUT Netlist File"))) + (Folder "PSpice Resources" + (Folder "Simulation Profiles") + (Folder "Model Libraries" + (Sort User)) + (Folder "Stimulus Files" + (Sort User)) + (Folder "Include Files" + (Sort User))) + (DefaultLibraryBrowseDirectory "library\PSpice") + (PartMRUSelector + (C + (FullPartName "C.Normal") + (LibraryName "C:\ORCAD\TOOLS\CAPTURE\LIBRARY\PSPICE\ANALOG.OLB") + (DeviceIndex "0")) + (LM2675/SO + (FullPartName "LM2675/SO.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\REGULATOR.OLB") + (DeviceIndex "0")) + (IRLR3103 + (FullPartName "IRLR3103.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\PSPICE\IRF.OLB") + (DeviceIndex "0")) + (IRFS3006 + (FullPartName "IRFS3006.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0")) + (CON8 + (FullPartName "CON8.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CONNECTOR.OLB") + (DeviceIndex "0")) + (CD4011A + (FullPartName "CD4011A.Normal") + (LibraryName + "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\PSPICE\CD4000.OLB") + (DeviceIndex "0")) + (CD40107B + (FullPartName "CD40107B.Normal") + (LibraryName + "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\PSPICE\CD4000.OLB") + (DeviceIndex "0")) + (GND + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0")) + (74HC00 + (FullPartName "74HC00.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\PSPICE\74HC.OLB") + (DeviceIndex "0")) + (JP3 + (FullPartName "JP3.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0")) + (R + (FullPartName "R.Normal") + (LibraryName "C:\ORCAD\TOOLS\CAPTURE\LIBRARY\PSPICE\ANALOG.OLB") + (DeviceIndex "0")) + (HCPL-2232 + (FullPartName "HCPL-2232.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0")) + (OFFPAGELEFT-L + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0")) + (ACSL-6400 + (FullPartName "ACSL-6400.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0")) + (CON7 + (FullPartName "CON7.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CONNECTOR.OLB") + (DeviceIndex "0")) + (CON6 + (FullPartName "CON6.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CONNECTOR.OLB") + (DeviceIndex "0")) + (OFFPAGELEFT-R + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0"))) + (GlobalState + (FileView + (Path "Design Resources") + (Path "Design Resources" + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\Schematic\h_bridge.dsn") + (Path "Design Resources" + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\Schematic\h_bridge.dsn" + "SCHEMATIC1") + (Path "Design Resources" "Library") + (Path "Outputs") + (Select "Design Resources" + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\Schematic\h_bridge.dsn")) + (HierarchyView) + (Doc + (Type "COrCapturePMDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 0 302 0 678")) + (Tab 0)) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 314 1880 1 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\H_BRIDGE_HIP4081_SMD\SCHEMATIC\H_BRIDGE.DSN") + (Schematic "SCHEMATIC1") + (Page "Power Supply")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 315 1881 0 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\H_BRIDGE_HIP4081_SMD\SCHEMATIC\H_BRIDGE.DSN") + (Schematic "SCHEMATIC1") + (Page "Driver")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 315 1881 0 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\H_BRIDGE_HIP4081_SMD\SCHEMATIC\H_BRIDGE.DSN") + (Schematic "SCHEMATIC1") + (Page "Current Meas.")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 316 1882 0 1067") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\H_BRIDGE_HIP4081_SMD\SCHEMATIC\H_BRIDGE.DSN") + (Schematic "SCHEMATIC1") + (Page "H-Bridge")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 314 1880 1 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\H_BRIDGE_HIP4081_SMD\SCHEMATIC\H_BRIDGE.DSN") + (Schematic "SCHEMATIC1") + (Page "Input Logic"))) + (MPSSessionName "Olivier") + (LastUsedLibraryBrowseDirectory "C:\krobot\elec\lib\OrCAD")) diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/PDF/H_Bridge_HIP4081_SMD.pdf b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/PDF/H_Bridge_HIP4081_SMD.pdf new file mode 100644 index 0000000..37683a7 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/PDF/H_Bridge_HIP4081_SMD.pdf differ diff --git a/elec/lib/OrCAD/KROBOT.LLB b/elec/lib/OrCAD/KROBOT.LLB index 03b7368..42d7457 100644 Binary files a/elec/lib/OrCAD/KROBOT.LLB and b/elec/lib/OrCAD/KROBOT.LLB differ diff --git a/elec/lib/OrCAD/KROBOT.OLB b/elec/lib/OrCAD/KROBOT.OLB index 6382894..5c302b0 100644 Binary files a/elec/lib/OrCAD/KROBOT.OLB and b/elec/lib/OrCAD/KROBOT.OLB differ hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-06-17 08:06:00
|
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 bd87ee79c53b51acc7b339121c77e2e2201ceae0 (commit) from caf529810c7b76e8b344ca432740b7c3ad27f289 (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 bd87ee79c53b51acc7b339121c77e2e2201ceae0 Author: Jérémie Dimino <je...@di...> Date: Thu Jun 17 10:05:21 2010 +0200 Better monitoring of properties in the controller ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index 114672f..1ee8ea6 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -448,9 +448,9 @@ lwt () = (React.S.const dummy) (Lwt_event.map_s (function - | true -> make () - | false -> return (React.S.const dummy)) - (React.S.changes (React.S.map (List.mem name) services))) + | Some _ -> make () + | None -> return (React.S.const dummy)) + (Lwt_signal.delay (OBus_resolver.make bus name >|= OBus_resolver.owner))) in let state = React.S.l4 @@ -478,7 +478,7 @@ lwt () = inhibited_backward = inhibited_backward; }) (React.S.l5 (fun a b c d e -> (a, b, c, d, e)) box services logs engine_state size) - (monitor "Driver" (None, None, None, None, None) + (monitor "fr.krobot.Driver" (None, None, None, None, None) (fun () -> let make card = OBus_property.monitor (Krobot_driver.Card.state (card krobot)) in lwt interface = make Krobot_driver.card_interface @@ -489,14 +489,14 @@ lwt () = return (React.S.l5 (fun a b c d e -> (Some a, Some b, Some c, Some d, Some e)) interface sensors motors monitoring rx64))) - (monitor "Service.Sensors" (None, None, None, None) + (monitor "fr.krobot.Service.Sensors" (None, None, None, None) (fun () -> lwt color = OBus_property.monitor (Krobot_sensors.color krobot) and infrareds = OBus_property.monitor (Krobot_sensors.infrareds krobot) and logic_sensors = OBus_property.monitor (Krobot_sensors.logic_sensors krobot) and range_finders = OBus_property.monitor (Krobot_sensors.range_finders krobot) in return (React.S.l4 (fun a b c d -> (Some a, Some b, Some c, Some d)) color infrareds logic_sensors range_finders))) - (monitor "Service.Motors" (None, None) + (monitor "fr.krobot.Service.Motors" (None, None) (fun () -> lwt inhibited_forward = OBus_property.monitor (Krobot_motors.inhibited_forward krobot) and inhibited_backward = OBus_property.monitor (Krobot_motors.inhibited_backward krobot) in @@ -506,13 +506,13 @@ lwt () = (* Initialize the list of running services: *) ignore (check_services bus); - (* Redraw the screen when the state change *) + (* Redraw the screen when the state changes *) Lwt_signal.always_notify_s draw state; (* Display log comming from daemons *) let daemons = OBus_proxy.make (OBus_peer.anonymous bus) ["fr"; "krobot"; "Daemon"] in Lwt_event.always_notify - (fun msg -> log_add_line [text msg]) + (fun msg -> log_add_lines (List.map (fun line -> [text line]) (Text.split ~sep:"\n" msg))) (OBus_signal.event (OBus_signal.connect Krobot_dbus_daemon.Fr_krobot_Daemon.s_log diff --git a/info/control/clients/krobot_write_lcd.ml b/info/control/clients/krobot_write_lcd.ml index 5f7192a..51b3748 100644 --- a/info/control/clients/krobot_write_lcd.ml +++ b/info/control/clients/krobot_write_lcd.ml @@ -27,5 +27,5 @@ lwt () = in return () with exn -> - Lwt_log.error ~exn "failure"; + lwt () = Lwt_log.error ~exn "failure" in exit 0 hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-06-16 19:41: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 caf529810c7b76e8b344ca432740b7c3ad27f289 (commit) via 83844ff53460b678dfee71ae3a58e474d29252f6 (commit) from 31d611ecec3562848c4268b7f3750348a8f57ba5 (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 caf529810c7b76e8b344ca432740b7c3ad27f289 Author: [Kro]bot <kr...@wa...> Date: Wed Jun 16 21:39:56 2010 +0200 Fix trajectory completion waiting commit 83844ff53460b678dfee71ae3a58e474d29252f6 Author: Jérémie Dimino <je...@di...> Date: Wed Jun 16 20:58:03 2010 +0200 Fix a race condition during startup of the controller It did the initial service checking before constructing the render signal, which resulted in bad initialisation of the latter. ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index a006823..114672f 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -440,7 +440,6 @@ lwt () = in (* Service monitoring *) - lwt () = check_services bus in Lwt_event.always_notify_p (fun _ -> check_services bus) (OBus_signal.event (OBus_bus.name_owner_changed bus)); (* State of robot *) @@ -504,6 +503,9 @@ lwt () = return (React.S.l2 (fun a b -> (Some a, Some b)) inhibited_forward inhibited_backward))) in + (* Initialize the list of running services: *) + ignore (check_services bus); + (* Redraw the screen when the state change *) Lwt_signal.always_notify_s draw state; diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 013ad83..c819ecf 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -664,7 +664,7 @@ struct lwt _ = Lwt_event.next (React.E.filter - (fun (cmd, data) -> cmd = PcInterface.traj_completed) + (fun (cmd, data) -> cmd = PcInterface.cmd_traj && Char.code data.[0] = PcInterface.traj_completed) (Krobot_usb.commands card)) in return () diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index 4ac0698..aeb43ee 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -276,6 +276,7 @@ let dispatch card msg = dropped card "response" msg end else begin try + lwt () = Lwt_log.debug_f ~section "command %d received" msg.command in card.send_command (msg.command, msg.data); return () with exn -> hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-06-16 18:44:41
|
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 31d611ecec3562848c4268b7f3750348a8f57ba5 (commit) from abfd81b3f9d917a4943d1393f47364dc66938a6d (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 31d611ecec3562848c4268b7f3750348a8f57ba5 Author: Jérémie Dimino <je...@di...> Date: Wed Jun 16 20:43:10 2010 +0200 Fix a bug in USB card management The aborter was created with [Lwt.task] instead of [Lwt.wait] and thus was cancelled after the first [pick], causing all subsequent USB operations to fail with [Lwt.Canceled]. ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_write_lcd.ml b/info/control/clients/krobot_write_lcd.ml index 0c116e5..5f7192a 100644 --- a/info/control/clients/krobot_write_lcd.ml +++ b/info/control/clients/krobot_write_lcd.ml @@ -27,5 +27,5 @@ lwt () = in return () with exn -> - prerr_endline (Printexc.to_string exn); + Lwt_log.error ~exn "failure"; exit 0 diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index 3eda8f2..4ac0698 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -286,42 +286,46 @@ let dispatch card msg = | Closing the card | +-----------------------------------------------------------------+ *) -let cleanup card = +let cleanup_no_usb exn card = + card.handle <- None; + card.set_state `Down; + let abort_waiter = card.abort_waiter and abort_wakener = card.abort_wakener in + let waiter, wakener = wait () in + card.abort_waiter <- waiter; + card.abort_wakener <- wakener; + if Lwt.state abort_waiter = Sleep then wakeup_exn abort_wakener exn; + for i = 0 to serial_count - 1 do + match card.reply_waiters.(i) with + | Some wakener -> + card.reply_waiters.(i) <- None; + wakeup_exn wakener exn + | None -> + () + done + +let cleanup exn card = match card.handle with | None -> return () | Some handle -> - card.handle <- None; - card.set_state `Down; - let exn = Krobot_error.Device.Error(Printf.sprintf "the %s card has been closed" card.name) in - let abort_waiter = card.abort_waiter and abort_wakener = card.abort_wakener in - let waiter, wakener = wait () in - card.abort_waiter <- waiter; - card.abort_wakener <- wakener; - if Lwt.state abort_waiter = Sleep then wakeup_exn abort_wakener exn; - for i = 0 to serial_count - 1 do - match card.reply_waiters.(i) with - | Some wakener -> - card.reply_waiters.(i) <- None; - wakeup_exn wakener exn - | None -> - () - done; + cleanup_no_usb exn card; try_lwt lwt () = USB.release_interface handle 0 in if card.kernel_driver_active then USB.attach_kernel_driver handle 0; return () + with exn -> + Lwt_log.error_f ~section ~exn "failed to close the %s card" card.name finally USB.close handle; return () let close card = card.closed <- true; - cleanup card + cleanup (Krobot_error.Device.Error(Printf.sprintf "the %s card has been closed" card.name)) card -let safe_cleanup card = +let safe_cleanup exn card = try_lwt - cleanup card + cleanup exn card with exn -> Lwt_log.error_f ~section ~exn "failed to release card %s" card.name @@ -365,13 +369,15 @@ let rec loop card = in read_and_dispatch () with + | _ when card.closed -> + return () | Reopen_card -> - lwt () = safe_cleanup card in + lwt () = safe_cleanup Reopen_card card in lwt () = Lwt_unix.sleep 0.1 in loop card | exn -> lwt () = Lwt_log.error_f ~section ~exn "error on card %s" card.name in - lwt () = safe_cleanup card in + cleanup_no_usb exn card; lwt () = Lwt_unix.sleep 0.1 in loop card @@ -383,7 +389,7 @@ let make ~name ~vendor_id ~product_id () = let state, set_state = React.S.create `Down and errors, send_error = React.E.create () and commands, send_command = React.E.create () - and abort_waiter, abort_wakener = Lwt.task () in + and abort_waiter, abort_wakener = Lwt.wait () in let card = { name = name; vendor_id = vendor_id; hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-06-11 09:35:42
|
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 abfd81b3f9d917a4943d1393f47364dc66938a6d (commit) from fab983add48eac28790d6529e0272dd2dd6b412e (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 abfd81b3f9d917a4943d1393f47364dc66938a6d Author: Jérémie Dimino <je...@di...> Date: Fri Jun 11 11:35:06 2010 +0200 Updates D-Bus error handling ----------------------------------------------------------------------- Changes: diff --git a/info/control/_tags b/info/control/_tags index b468930..d17f39b 100644 --- a/info/control/_tags +++ b/info/control/_tags @@ -3,6 +3,9 @@ # Uses the lwt syntax extension for all files: <**/*.ml>: syntax_camlp4o, pkg_lwt.syntax, pkg_lwt.syntax.log +# Use the obus syntax extension for all files: +<**/*.ml>: pkg_obus.syntax + # Libraries used by all part of the robot: <**/*>: pkg_obus, pkg_lwt.text diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index 9d29b83..a5be299 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -74,7 +74,7 @@ let start ~desc ~name init = lwt owner = OBus_bus.get_name_owner bus name in lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in shutdown (OBus_peer.make bus owner) - with OBus_error.DBus(name, _) when name = OBus_bus.name_has_no_owner -> + with OBus_bus.Name_has_no_owner _ -> return () finally exit 0 diff --git a/info/control/driver/krobot_dynamixel_over_serial.ml b/info/control/driver/krobot_dynamixel_over_serial.ml index 9fcf9ef..60debcd 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.ml +++ b/info/control/driver/krobot_dynamixel_over_serial.ml @@ -461,10 +461,11 @@ type t = { } let unavailable card = - Printf.ksprintf - (OBus_error.fail Krobot_error.Device.unavailable) - "the %s card is currently not available" - card.name + fail + (Krobot_error.Device.Unavailable + (Printf.sprintf + "the %s card is currently not available" + card.name)) let name card = card.name let state card = card.state diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index 06f6b0c..3eda8f2 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -150,7 +150,7 @@ let serial_count = 256 let get_serial card = let rec loop n = if n = serial_count then - OBus_error.raise Krobot_error.Device.error "no more serial available!" + raise (Krobot_error.Device.Error "no more serial available!") else match card.reply_waiters.(n) with | Some _ -> loop (n + 1) | None -> n @@ -168,17 +168,19 @@ let abort card exn = let send card buffer = match card.handle with | None -> - Printf.ksprintf - (OBus_error.fail Krobot_error.Device.unavailable) - "the %s card is currently not available" - card.name + fail + (Krobot_error.Device.Unavailable + (Printf.sprintf + "the %s card is currently not available" + card.name)) | Some handle -> lwt len = pick [card.abort_waiter; USB.interrupt_send ~handle ~timeout:1.0 ~endpoint:1 buffer 0 64] in if len <> 64 then begin let exn = - Printf.ksprintf - (OBus_error.make Krobot_error.Device.error) - "write on %s card returned %d instead of 64, reopening" card.name len + Krobot_error.Device.Error + (Printf.sprintf + "write on %s card returned %d instead of 64, reopening" + card.name len) in abort card exn; fail exn @@ -266,7 +268,7 @@ let dispatch card msg = | Some wakener -> card.reply_waiters.(msg.host_serial) <- None; if msg.error <> 0 then - wakeup_exn wakener (OBus_error.make Krobot_error.Device.error (error_message msg.error)) + wakeup_exn wakener (Krobot_error.Device.Error(error_message msg.error)) else wakeup wakener msg.data; return () @@ -291,7 +293,7 @@ let cleanup card = | Some handle -> card.handle <- None; card.set_state `Down; - let exn = OBus_error.make Krobot_error.Device.error (Printf.sprintf "the %s card has been closed" card.name) in + let exn = Krobot_error.Device.Error(Printf.sprintf "the %s card has been closed" card.name) in let abort_waiter = card.abort_waiter and abort_wakener = card.abort_wakener in let waiter, wakener = wait () in card.abort_waiter <- waiter; diff --git a/info/control/protocol/krobot_error.ml b/info/control/protocol/krobot_error.ml index 2a63790..fde6628 100644 --- a/info/control/protocol/krobot_error.ml +++ b/info/control/protocol/krobot_error.ml @@ -9,9 +9,18 @@ module Device = struct - let error = "fr.krobot.Device.Error.Error" - let closed = "fr.krobot.Device.Error.Closed" - let unavailable = "fr.krobot.Device.Error.Unavailable" - let not_implemented = "fr.krobot.Device.Error.NotImplemented" - let timeout = "fr.krobot.Device.Error.Timeout" + exception Error of string + with obus("fr.krobot.Device.Error.Error") + + exception Closed of string + with obus("fr.krobot.Device.Error.Closed") + + exception Unavailable of string + with obus("fr.krobot.Device.Error.Unavailable") + + exception Not_implemented of string + with obus("fr.krobot.Device.Error.NotImplemented") + + exception Timeout of string + with obus("fr.krobot.Device.Error.Timeout") end diff --git a/info/control/protocol/krobot_error.mli b/info/control/protocol/krobot_error.mli index b980f53..9f691ed 100644 --- a/info/control/protocol/krobot_error.mli +++ b/info/control/protocol/krobot_error.mli @@ -11,20 +11,20 @@ (** Device errors *) module Device : sig - val error : OBus_error.name + exception Error of string (** D-Bus exception raised when a card return an error *) - val closed : OBus_error.name + exception Closed of string (** D-Bus exception raised when trying to use a closed device. *) - val unavailable : OBus_error.name + exception Unavailable of string (** D-Bus exception raised when trying to use a device that is not currently up. *) - val not_implemented : OBus_error.name + exception Not_implemented of string (** D-Bus exception raised when calling a request that is not implemented by the device. *) - val timeout : OBus_error.name + exception Timeout of string (** D-Bus exception raised when a call timeout *) end diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index 3810af6..48c5bfe 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -41,7 +41,7 @@ let set_ax12 krobot position speed = let goto obj ~angle = let angle = principal angle in if angle < -.(pi /. 2.0) || angle > pi /. 2.0 then - OBus_error.fail OBus_error.invalid_args "the angle for the turret must be between -pi/2 and pi/2" + fail (OBus_error.Invalid_args "the angle for the turret must be between -pi/2 and pi/2") else set_ax12 obj.krobot (position_of_angle angle) 0 hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-06-03 07:03: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 fab983add48eac28790d6529e0272dd2dd6b412e (commit) from 3f7546cc93b030436b0fdb9f687334a6654972bb (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 fab983add48eac28790d6529e0272dd2dd6b412e Author: Jérémie Dimino <je...@di...> Date: Thu Jun 3 09:02:30 2010 +0200 Simplify D-Bus errors ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_script.ml b/info/control/clients/krobot_script.ml index 03faf62..ab8b352 100644 --- a/info/control/clients/krobot_script.ml +++ b/info/control/clients/krobot_script.ml @@ -338,7 +338,7 @@ let exec ~interpreter ~logger ~command = in print result cmd.cmd_oargs with - | OBus_error.DBus(_, _, msg) -> + | OBus_error.DBus(_, msg) -> logger [fg lred; textf "%s: %s" name msg] | Arg_error(arg, msg) -> logger [fg lred; textf "%s: invalid argument %s: %s" name arg msg] diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index d0ce66e..9d29b83 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -74,7 +74,7 @@ let start ~desc ~name init = lwt owner = OBus_bus.get_name_owner bus name in lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in shutdown (OBus_peer.make bus owner) - with OBus_error.DBus(OBus_bus.Name_has_no_owner, _, _) -> + with OBus_error.DBus(name, _) when name = OBus_bus.name_has_no_owner -> return () finally exit 0 diff --git a/info/control/driver/krobot_dynamixel_over_serial.ml b/info/control/driver/krobot_dynamixel_over_serial.ml index ef2d158..9fcf9ef 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.ml +++ b/info/control/driver/krobot_dynamixel_over_serial.ml @@ -462,7 +462,7 @@ type t = { let unavailable card = Printf.ksprintf - (OBus_error.fail Krobot_error.Device.Unavailable) + (OBus_error.fail Krobot_error.Device.unavailable) "the %s card is currently not available" card.name diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index 8d0b5e2..06f6b0c 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -150,7 +150,7 @@ let serial_count = 256 let get_serial card = let rec loop n = if n = serial_count then - OBus_error.raise Krobot_error.Device.Error "no more serial available!" + OBus_error.raise Krobot_error.Device.error "no more serial available!" else match card.reply_waiters.(n) with | Some _ -> loop (n + 1) | None -> n @@ -169,7 +169,7 @@ let send card buffer = match card.handle with | None -> Printf.ksprintf - (OBus_error.fail Krobot_error.Device.Unavailable) + (OBus_error.fail Krobot_error.Device.unavailable) "the %s card is currently not available" card.name | Some handle -> @@ -177,7 +177,7 @@ let send card buffer = if len <> 64 then begin let exn = Printf.ksprintf - (OBus_error.make Krobot_error.Device.Error) + (OBus_error.make Krobot_error.Device.error) "write on %s card returned %d instead of 64, reopening" card.name len in abort card exn; @@ -266,7 +266,7 @@ let dispatch card msg = | Some wakener -> card.reply_waiters.(msg.host_serial) <- None; if msg.error <> 0 then - wakeup_exn wakener (OBus_error.make Krobot_error.Device.Error (error_message msg.error)) + wakeup_exn wakener (OBus_error.make Krobot_error.Device.error (error_message msg.error)) else wakeup wakener msg.data; return () @@ -291,7 +291,7 @@ let cleanup card = | Some handle -> card.handle <- None; card.set_state `Down; - let exn = OBus_error.make Krobot_error.Device.Error (Printf.sprintf "the %s card has been closed" card.name) in + let exn = OBus_error.make Krobot_error.Device.error (Printf.sprintf "the %s card has been closed" card.name) in let abort_waiter = card.abort_waiter and abort_wakener = card.abort_wakener in let waiter, wakener = wait () in card.abort_waiter <- waiter; diff --git a/info/control/protocol/krobot_error.ml b/info/control/protocol/krobot_error.ml index 544d913..2a63790 100644 --- a/info/control/protocol/krobot_error.ml +++ b/info/control/protocol/krobot_error.ml @@ -9,16 +9,9 @@ module Device = struct - exception Error - exception Closed - exception Unavailable - exception Not_implemented - exception Timeout - - let () = - OBus_error.register "fr.krobot.Device.Error.Error" Error; - OBus_error.register "fr.krobot.Device.Error.Closed" Closed; - OBus_error.register "fr.krobot.Device.Error.Unavailable" Unavailable; - OBus_error.register "fr.krobot.Device.Error.NotImplemented" Not_implemented; - OBus_error.register "fr.krobot.Device.Error.Timeout" Timeout + let error = "fr.krobot.Device.Error.Error" + let closed = "fr.krobot.Device.Error.Closed" + let unavailable = "fr.krobot.Device.Error.Unavailable" + let not_implemented = "fr.krobot.Device.Error.NotImplemented" + let timeout = "fr.krobot.Device.Error.Timeout" end diff --git a/info/control/protocol/krobot_error.mli b/info/control/protocol/krobot_error.mli index 8c176b4..b980f53 100644 --- a/info/control/protocol/krobot_error.mli +++ b/info/control/protocol/krobot_error.mli @@ -11,20 +11,20 @@ (** Device errors *) module Device : sig - exception Error + val error : OBus_error.name (** D-Bus exception raised when a card return an error *) - exception Closed + val closed : OBus_error.name (** D-Bus exception raised when trying to use a closed device. *) - exception Unavailable + val unavailable : OBus_error.name (** D-Bus exception raised when trying to use a device that is not currently up. *) - exception Not_implemented + val not_implemented : OBus_error.name (** D-Bus exception raised when calling a request that is not implemented by the device. *) - exception Timeout + val timeout : OBus_error.name (** D-Bus exception raised when a call timeout *) end diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index 53c0dc3..3810af6 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -41,7 +41,7 @@ let set_ax12 krobot position speed = let goto obj ~angle = let angle = principal angle in if angle < -.(pi /. 2.0) || angle > pi /. 2.0 then - OBus_error.fail OBus_error.Invalid_args "the angle for the turret must be between -pi/2 and pi/2" + OBus_error.fail OBus_error.invalid_args "the angle for the turret must be between -pi/2 and pi/2" else set_ax12 obj.krobot (position_of_angle angle) 0 hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-31 07:01:26
|
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 3f7546cc93b030436b0fdb9f687334a6654972bb (commit) from 40e92782344cbc39300f42944f7a78a3d623ed37 (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 3f7546cc93b030436b0fdb9f687334a6654972bb Author: Jérémie Dimino <je...@di...> Date: Mon May 31 09:00:16 2010 +0200 Improvements in Krobot_arg. Now registrars return a lazy value that can be forced after parsing command line arguments. ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/commands/krobot_move.ml b/info/control/clients/commands/krobot_move.ml index de01983..ccec16a 100644 --- a/info/control/clients/commands/krobot_move.ml +++ b/info/control/clients/commands/krobot_move.ml @@ -10,25 +10,33 @@ open Lwt lwt () = - Krobot_arg.register [ - "-distance", `Float, "distance to move, in meters"; - "-velocity", `Float, "velocity during the move"; - "-acceleration", `Float, "acceleration during the move"; - ]; + let distance = + Krobot_arg.float_d + ~key:"-distance" + ~doc:"distance to move, in meters" + ~default:0.1 + () + and velocity = + Krobot_arg.float_d + ~key:"-velocity" + ~doc:"velocity during the move" + ~default:0.4 + () + and acceleration = + Krobot_arg.float_d + ~key:"-acceleration" + ~doc:"acceleration during the move" + ~default:0.8 + () + in Krobot_arg.parse (); lwt krobot = Krobot.create () in lwt result, distance = Krobot_motors.move krobot - (match Krobot_arg.float "-distance" with - | Some d -> d - | None -> 0.1) - (match Krobot_arg.float "-velocity" with - | Some v -> v - | None -> 0.4) - (match Krobot_arg.float "-acceleration" with - | Some a -> a - | None -> 0.8) + (Lazy.force distance) + (Lazy.force velocity) + (Lazy.force acceleration) in lwt () = Lwt_io.printlf "%f" distance in match result with diff --git a/info/control/clients/commands/krobot_turn.ml b/info/control/clients/commands/krobot_turn.ml index 35764f7..cbd45c2 100644 --- a/info/control/clients/commands/krobot_turn.ml +++ b/info/control/clients/commands/krobot_turn.ml @@ -10,25 +10,33 @@ open Lwt lwt () = - Krobot_arg.register [ - "-angle", `Float, "angle to move, in radiants"; - "-velocity", `Float, "velocity during the move"; - "-acceleration", `Float, "acceleration during the move"; - ]; + let angle = + Krobot_arg.float_d + ~key:"-angle" + ~doc:"angle to turn, in radiants" + ~default:0.1 + () + and velocity = + Krobot_arg.float_d + ~key:"-velocity" + ~doc:"velocity during the move" + ~default:0.4 + () + and acceleration = + Krobot_arg.float_d + ~key:"-acceleration" + ~doc:"acceleration during the move" + ~default:0.8 + () + in Krobot_arg.parse (); lwt krobot = Krobot.create () in lwt result, distance = Krobot_motors.turn krobot - (match Krobot_arg.float "-angle" with - | Some d -> d - | None -> 0.0) - (match Krobot_arg.float "-velocity" with - | Some v -> v - | None -> 0.4) - (match Krobot_arg.float "-acceleration" with - | Some a -> a - | None -> 0.8) + (Lazy.force angle) + (Lazy.force velocity) + (Lazy.force acceleration) in lwt () = Lwt_io.printlf "%f" distance in match result with diff --git a/info/control/common/krobot_arg.ml b/info/control/common/krobot_arg.ml index 4d1f90c..fe78ba8 100644 --- a/info/control/common/krobot_arg.ml +++ b/info/control/common/krobot_arg.ml @@ -10,122 +10,136 @@ open Lwt open Lwt_term -let progname = Filename.basename Sys.argv.(0) - -type kind = [ `Flag | `Int | `Float | `String | `Keywords of string list ] -type argument = string * kind * string - -type value = - | Empty - | True - | String of string - | Int of int - | Float of float - | Keyword of string - -let std_args = ref [] -let ext_args = ref [(progname, "-help", "", ref Empty, "display this help and exit"); - (progname, "--help", "", ref Empty, "display this help and exit")] - -let register_argument section (name, kind, doc) = - let value = ref Empty in - let std = - (name, - (match kind with - | `Flag -> Arg.Unit(fun () -> value := True) - | `Int -> Arg.Int(fun x -> value := Int x) - | `Float -> Arg.Float(fun x -> value := Float x) - | `String -> Arg.String(fun x -> value := String x) - | `Keywords l -> Arg.Symbol(l, fun x -> value := Keyword x)), - doc) - and ext = - (section, name, - (match kind with - | `Flag -> "" - | `Int -> "<int>" - | `Float -> "<float>" - | `String -> "<string>" - | `Keywords l -> "{" ^ String.concat "|" l ^ "}"), - value, doc) - in - std_args := std :: !std_args; - ext_args := ext :: !ext_args - -let register ?(section=progname) specs = - List.iter (register_argument section) specs - -let get_arg name = - let rec loop = function - | [] -> - Empty - | (section, name', kind, value, doc) :: _ when name = name' -> - !value - | _ :: rest -> - loop rest - in - loop !ext_args - -let flag name = - match get_arg name with - | True -> true - | _ -> false - -let int name = - match get_arg name with - | Int x -> Some x - | _ -> None - -let float name = - match get_arg name with - | Float x -> Some x - | _ -> None - -let string name = - match get_arg name with - | String x -> Some x - | _ -> None - -let keyword name = - match get_arg name with - | Keyword x -> Some x - | _ -> None +(* +-----------------------------------------------------------------+ + | Types | + +-----------------------------------------------------------------+ *) + + +type section = string +type 'a opt = ?section : section -> key : string -> ?doc : string -> unit -> 'a option Lazy.t +type 'a opt_d = ?section : section -> key : string -> ?doc : string -> default : 'a -> unit -> 'a Lazy.t + +type option_info = { + section : section; + key : string; + doc : string; + kind : string; + spec : Arg.spec; +} + +(* +-----------------------------------------------------------------+ + | Registrartion | + +-----------------------------------------------------------------+ *) + +let program_name = Filename.basename Sys.argv.(0) + +let parsed = ref false + (* Whether parsing has already been done *) + +let options = ref [] + (* All registered options *) + +let register value opt = + options := opt :: !options; + lazy( + if !parsed then + !value + else + Printf.ksprintf failwith "Yaop: option '%s' accessed before calling Krobot_arg.parse'" opt.key + ) + +let make kind spec ?(section=program_name) ~key ?(doc="") () = + let value = ref None in + register value { + section = section; + key = key; + doc = doc; + kind = kind; + spec = spec value; + } + +let make_d kind spec ?(section=program_name) ~key ?(doc="") ~default () = + let value = ref default in + register value { + section = section; + key = key; + doc = doc; + kind = kind; + spec = spec value; + } + +let int = make "<integer>" (fun x -> Arg.Int(fun v -> x := Some v)) +let int_d = make_d "<integer>" (fun x -> Arg.Int(fun v -> x := v)) + +let float = make "<float>" (fun x -> Arg.Float(fun v -> x := Some v)) +let float_d = make_d "<float>" (fun x -> Arg.Float(fun v -> x := v)) + +let string = make "<string>" (fun x -> Arg.String(fun v -> x := Some v)) +let string_d = make_d "<string>" (fun x -> Arg.String(fun v -> x := v)) + +let keyword_kind keywords = + "{" ^ String.concat "|" (List.map fst keywords) ^ "}" + +let keyword ~keywords = + make + (keyword_kind keywords) + (fun x -> Arg.Symbol(List.map fst keywords, fun v -> x := Some(List.assoc v keywords))) +let keyword_d ~keywords = + make_d + (keyword_kind keywords) + (fun x -> Arg.Symbol(List.map fst keywords, fun v -> x := List.assoc v keywords)) + +let flag = make "" (fun x -> Arg.Unit(fun () -> x := Some true)) +let flag_d = make_d "" (fun x -> Arg.Unit(fun () -> x := true)) + +let nflag = make "" (fun x -> Arg.Unit(fun () -> x := Some false)) +let nflag_d = make_d "" (fun x -> Arg.Unit(fun () -> x := false)) + +(* +-----------------------------------------------------------------+ + | Default options | + +-----------------------------------------------------------------+ *) + +let display_help = flag_d ~key:"-help" ~doc:"show this help and exit" ~default:false () + +(* +-----------------------------------------------------------------+ + | Help | + +-----------------------------------------------------------------+ *) let usage msg = - ignore - (eprintc [text progname; text ": "; fg lred; text msg; reset; text "\n"; - textf "Type `"; fg lblue; textf "%s -help" progname; reset; text "' for help.\n"]); + Lwt_main.run + (eprintc [text program_name; text ": "; fg lred; text msg; reset; text "\n"; + textf "Type `"; fg lblue; textf "%s -help" program_name; reset; text "' for help.\n"]); exit 2 module String_set = Set.Make(String) let help () = - ignore begin + Lwt_main.run begin lwt () = - printc [bold; fg white; text "Usage: "; reset; textf "%s <options>\n" progname; + printc [bold; fg white; text "Usage: "; reset; textf "%s <options>\n" program_name; fg white; text "options are:\n\n"] in let max_len = List.fold_left - (fun m (section, name, kind, value, doc) -> - max m (String.length name + String.length kind)) - 0 !ext_args + (fun m opt -> + max m (String.length opt.key + String.length opt.kind)) + 0 !options in let sections = List.fold_left - (fun set (section, name, kind, value, doc) -> - String_set.add section set) - String_set.empty !ext_args + (fun set opt -> String_set.add opt.section set) + String_set.empty !options in Lwt_list.iter_s (fun section -> - let args = List.filter (fun (section', name, kind, value, doc) -> section = section') !ext_args in + let args = List.filter (fun opt -> opt.section = section) !options in lwt () = printc [bold; fg white; text "- "; text section; text ":\n"; reset] in lwt () = Lwt_list.iter_s - (fun (section, name, kind, value, doc) -> - printc [text " "; fg lmagenta; text name; text " "; fg yellow; text kind; text " "; reset; - text (Text.repeat (3 + max_len - String.length name - String.length kind) " "); - text doc; text "\n"]) + (fun opt -> + printc [text " "; fg lmagenta; text opt.key; text " "; fg yellow; text opt.kind; text " "; reset; + text (Text.repeat (3 + max_len - String.length opt.key - String.length opt.kind) " "); + text opt.doc; text "\n"]) args in printc [text "\n"]) @@ -133,18 +147,23 @@ let help () = end; exit 0 +(* +-----------------------------------------------------------------+ + | Parsing | + +-----------------------------------------------------------------+ *) + let parse () = let complete = ref false in try - Arg.parse_argv ~current:(ref 0) Sys.argv (("-complete", Arg.Set complete, "") :: !std_args) ignore ""; + Arg.parse_argv + ~current:(ref 0) Sys.argv + (("-complete", Arg.Set complete, "") :: List.map (fun opt -> (opt.key, opt.spec, opt.doc)) !options) + ignore ""; if !complete then begin - print_endline - (String.concat " " - (List.map - (fun (section, name, kind, value, doc) -> name) - !ext_args)); + print_endline (String.concat " " (List.map (fun opt -> opt.key) !options)); exit 0 end; + parsed := true; + if Lazy.force display_help then help (); with | Arg.Help msg -> help () diff --git a/info/control/common/krobot_arg.mli b/info/control/common/krobot_arg.mli index f111acb..2bf7b1f 100644 --- a/info/control/common/krobot_arg.mli +++ b/info/control/common/krobot_arg.mli @@ -15,41 +15,54 @@ (** {6 Argument registration} *) -type kind = [ `Flag | `Int | `Float | `String | `Keywords of string list ] - (** Kind of an argument. [`Flag] means that the option does not - take an argument. Other constructors define the type of - arguments taken by the option. *) +type section = string + (** Type of a section. Section are used to hierarchically organize + options. *) -type argument = string * kind * string - (** Type of an argument description. It is a tuple containing: +(** The following functions register an argument an returns a lazy + value that must be forced after the call to {!parse}. Functions + sufixed by [_d] take a default value. Other functions rerturns an + option. *) - - the name of the option - - the kind of the option - - a short description of the option *) +type 'a opt = ?section : section -> key : string -> ?doc : string -> unit -> 'a option Lazy.t + (** Type of a function which register an option returning without a + default value. -val register : ?section : string -> argument list -> unit - (** [regsiter ?section args] registers the given arguments for - section [section]. If [section] is not specified then arguments - are added to the main section. *) + - [section] is the section of the option. If not provided it + defaults to the program name. + - [key] is the name of the option, such as [-distance], or [-d] + - [doc] is a short description of the option, which is printed + when the user invokes the program with [-help] or [--help] + *) -(** {6 Parsing} *) +type 'a opt_d = ?section : section -> key : string -> ?doc : string -> default : 'a -> unit -> 'a Lazy.t + (** Type of a function which register an option returning with a + default value. *) -val parse : unit -> unit - (** Parses command line arguments. *) +val flag : bool opt +val flag_d : bool opt_d + +val nflag : bool opt +val nflag_d : bool opt_d + +val int : int opt +val int_d : int opt_d -(** {6 Reading parsing results} *) +val float : float opt +val float_d : float opt_d -(** After a call to {!parse} one can read options values by using the - following functions, whom always takes as argument the option name - and returns it associated value: *) +val string : string opt +val string_d : string opt_d -val flag : string -> bool -val int : string -> int option -val float : string -> float option -val string : string -> string option -val keyword : string -> string option +val keyword : keywords : (string * 'a) list -> 'a opt +val keyword_d : keywords : (string * 'a) list -> 'a opt_d + +(** {6 Parsing} *) + +val parse : unit -> unit + (** Parses command line arguments. *) -(** {6 Erros} *) +(** {6 Help} *) val usage : string -> 'a (** [usage message] prints an error message and exit *) diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index 52abae7..d0ce66e 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -48,17 +48,28 @@ struct end let start ~desc ~name init = - Krobot_arg.register ~section:"Daemon" [ - ("-no-fork", `Flag, "do not daemonize"); - ("-kill", `Flag, Printf.sprintf "kill any running %s service and exit" desc); - ]; + let no_fork = + Krobot_arg.flag_d + ~section:"Daemon" + ~key:"-no-fork" + ~doc:"do not daemonize" + ~default:false + () + and kill = + Krobot_arg.flag_d + ~section:"Daemon" + ~key:"-kill" + ~doc:(Printf.sprintf "kill any running %s service and exit" desc) + ~default:false + () + in Krobot_arg.parse (); lwt () = Lwt_log.info ~section "openning the robot bus" in lwt bus = Krobot_dbus.open_bus () in lwt () = - if Krobot_arg.flag "-kill" then begin + if Lazy.force kill then begin try_lwt lwt owner = OBus_bus.get_name_owner bus name in lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in @@ -77,7 +88,7 @@ let start ~desc ~name init = (OBus_signal.event (OBus_bus.name_lost bus)); lwt () = - if Krobot_arg.flag "-no-fork" then + if Lazy.force no_fork then Lwt_log.notice_f ~section "starting %s in foreground mode" desc else begin lwt () = Lwt_log.notice_f ~section "starting %s in daemon mode" desc in diff --git a/info/control/common/krobot_dbus.ml b/info/control/common/krobot_dbus.ml index fef8731..ca61e99 100644 --- a/info/control/common/krobot_dbus.ml +++ b/info/control/common/krobot_dbus.ml @@ -11,11 +11,19 @@ let section = Lwt_log.Section.make "dbus" open Lwt -let () = - Krobot_arg.register ~section:"D-Bus connection" [ - ("-dbus-command", `String, "command to connect to the krobot bus"); - ("-dbus-address", `String, "address to connect to the krobot bus"); - ] +let dbus_command = + Krobot_arg.string + ~section:"D-Bus connection" + ~key:"-dbus-command" + ~doc:"command to connect to the krobot bus" + () + +let dbus_address = + Krobot_arg.string + ~section:"D-Bus connection" + ~key:"-dbus-address" + ~doc:"address to connect to the krobot bus" + () let connect_address str = lwt () = Lwt_log.info_f ~section "connecting to the krobot bus with address %S" str in @@ -36,11 +44,11 @@ let connect_command str = return connection let bus = lazy( - match Krobot_arg.string "-dbus-command" with + match Lazy.force dbus_command with | Some str -> connect_command str | None -> - match Krobot_arg.string "-dbus-address" with + match Lazy.force dbus_address with | Some str -> connect_address str | None -> diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index f512453..53c0dc3 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -115,16 +115,16 @@ let load_data file_name = (fun line -> Scanf.sscanf line "%f %d" (fun position measure -> (position, measure))) (Lwt_io.lines_of_file file_name)) -let () = - Krobot_arg.register [ - "-data", `String, "file containing calibration data for the infrared"; - ] +let data = + Krobot_arg.string_d + ~key:"-data" + ~doc:"file containing calibration data for the infrared" + ~default:"/home/krobot/var/infrareds" + () let init bus = lwt krobot = Krobot.create () in - lwt data = load_data (match Krobot_arg.string "-data" with - | None -> "/home/krobot/var/infrareds" - | Some file_name -> file_name) in + lwt data = load_data (Lazy.force data) in let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Turret"]; krobot = krobot; hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-30 20:02:53
|
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 40e92782344cbc39300f42944f7a78a3d623ed37 (commit) via 06b7be07959c02aefb959e156ce990cf7aa8cfe8 (commit) via a6a6c69f428572fa3a269d034a43a2b96aec09e1 (commit) from cfefd2ab998a6346acad98bae9eb9c046d7442aa (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 40e92782344cbc39300f42944f7a78a3d623ed37 Author: Jérémie Dimino <je...@di...> Date: Sun May 30 22:02:22 2010 +0200 remove classes for devices commit 06b7be07959c02aefb959e156ce990cf7aa8cfe8 Author: Jérémie Dimino <je...@di...> Date: Sun May 30 19:41:43 2010 +0200 add missing timeout for some commands commit a6a6c69f428572fa3a269d034a43a2b96aec09e1 Author: Jérémie Dimino <je...@di...> Date: Sun May 30 19:21:28 2010 +0200 fix USB card openning ----------------------------------------------------------------------- Changes: diff --git a/info/control/driver/krobot_device.ml b/info/control/driver/krobot_device.ml index db66467..93ce958 100644 --- a/info/control/driver/krobot_device.ml +++ b/info/control/driver/krobot_device.ml @@ -7,8 +7,9 @@ * This file is a part of [kro]bot. *) -class type t = object - method name : string - method state : [ `Up | `Down ] React.signal - method close : unit Lwt.t +module type S = sig + type t + val name : t -> string + val state : t -> [ `Up | `Down ] React.signal + val close : t -> unit Lwt.t end diff --git a/info/control/driver/krobot_device.mli b/info/control/driver/krobot_device.mli index 664c87f..13d88c2 100644 --- a/info/control/driver/krobot_device.mli +++ b/info/control/driver/krobot_device.mli @@ -9,21 +9,24 @@ (** Abstract devices *) -(** A device is a component of the robot. The following class abstract - the communication methods used between the real device and the - motherboard of the robot. *) +(** A device is a component of the robot. The following signature + abstract the communication methods used between the real device + and the motherboard of the robot. *) -(** The type of a device of the robot *) -class type t = object - method name : string +(** Signature of a device of the robot *) +module type S = sig + type t + (** Real type for a device *) + + val name : t -> string (** Name of the device. It is used for D-Bus integration and for logs and error messages. *) - method state : [ `Up | `Down ] React.signal + val state : t -> [ `Up | `Down ] React.signal (** Signal holding the current statte of the device. [`Up] means that it is available on the system and is ready to process requests. *) - method close : unit Lwt.t + val close : t -> unit Lwt.t (** Gracefully close the device. *) end diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index e238aa1..013ad83 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -30,15 +30,15 @@ module Analogic_motor = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicMotor - let set_state (card : Krobot_usb.device) ~state = - card#call_no_reply + let set_state card ~state = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_motor ~i_types:(seq2 uint8 uint8) ((if state then PcInterface.motor_enable else PcInterface.motor_disable), PcInterface.motor_both) - let set_velocity (card : Krobot_usb.device) ~velocity ~duration = - card#call_no_reply + let set_velocity card ~velocity ~duration = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_motor ~i_types:(seq5 uint8 uint8 boolean uint8 uint32) (PcInterface.motor_move, @@ -72,15 +72,15 @@ module Analogic_servos = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicServos - let set_config (card : Krobot_usb.device) ~enable ~disable = - card#call_no_reply + let set_config card ~enable ~disable = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_set ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.set_servo_config, List.fold_left (fun acc n -> acc lor (1 lsl n)) 0 enable, List.fold_left (fun acc n -> acc lor (1 lsl n)) 0 disable) - let set_state (card : Krobot_usb.device) ~states = + let set_state card ~states = let get id mask = try (List.assoc id states, mask lor (1 lsl id)) @@ -93,7 +93,7 @@ struct let angle2, mask = get 2 mask in let angle3, mask = get 3 mask in let angle4, mask = get 4 mask in - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_set ~i_types:(seq3 uint8 uint8 (array 5 int8)) (PcInterface.set_servo_state, @@ -127,9 +127,9 @@ module Compass = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Compass - let get_measure (card : Krobot_usb.device) = + let get_measure card = lwt dummy, value = - card#call + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 uint16 uint16) @@ -197,73 +197,73 @@ struct let timeout = 1000 - let ping (card : Krobot_usb.device) ~id = - card#call + let ping card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq3 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_ping, id, timeout) - let action (card : Krobot_usb.device) ~id = - card#call + let action card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq3 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_action, id, timeout) - let reset (card : Krobot_usb.device) ~id = - card#call_no_reply + let reset card ~id = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) (PcInterface.ax12_reset, id) - let get (card : Krobot_usb.device) ~id ~address = + let get card ~id ~address = match address with | #dynamixel_register8 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:uint8 (PcInterface.ax12_read8, id, Int32.to_int (cast_readable_register address), timeout) | #dynamixel_register16 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:uint16 (PcInterface.ax12_read16, id, Int32.to_int (cast_readable_register address), timeout) - let set (card : Krobot_usb.device) ~id ~address ~value = + let set card ~id ~address ~value = match address with | #dynamixel_register8 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint8) ~o_types:unit (PcInterface.ax12_write8, id, Int32.to_int (cast_writable_register address), value) | #dynamixel_register16 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_write16, id, Int32.to_int (cast_writable_register address), value) - let reg_set (card : Krobot_usb.device) ~id ~address ~value = + let reg_set card ~id ~address ~value = match address with | #dynamixel_register8 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint8) ~o_types:unit (PcInterface.ax12_write_reg8, id, Int32.to_int (cast_writable_register address), value) | #dynamixel_register16 -> - card#call + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_write_reg16, id, Int32.to_int (cast_writable_register address), value) - let goto (card : Krobot_usb.device) ~id ~position ~speed ~mode = - card#call + let goto card ~id ~position ~speed ~mode = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq5 uint8 uint8 uint16 uint16 uint8) ~o_types:unit @@ -272,26 +272,26 @@ struct | `Now -> PcInterface.ax12_exec_now | `Action -> PcInterface.ax12_exec_action)) - let config (card : Krobot_usb.device) ~id = - card#call + let config card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) ~o_types:unit (PcInterface.ax12_config, id) - let get_position (card : Krobot_usb.device) ~id = - card#call + let get_position card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 - ~i_types:(seq2 uint8 uint8) + ~i_types:(seq3 uint8 uint8 uint16) ~o_types:uint16 - (PcInterface.ax12_get_pos, id) + (PcInterface.ax12_get_pos, id, timeout) - let get_speed (card : Krobot_usb.device) ~id = - card#call + let get_speed card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_ax12 - ~i_types:(seq2 uint8 uint8) + ~i_types:(seq3 uint8 uint8 uint16) ~o_types:uint16 - (PcInterface.ax12_get_speed, id) + (PcInterface.ax12_get_speed, id, timeout) let interface = make { @@ -378,50 +378,50 @@ module RX64 = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Dynamixel - let ping (card : Krobot_dynamixel_over_serial.device) ~id = - card#ping id + let ping card ~id = + Krobot_dynamixel_over_serial.ping card id - let action (card : Krobot_dynamixel_over_serial.device) ~id = + let action card ~id = fail (Failure "not implemented") - let reset (card : Krobot_dynamixel_over_serial.device) ~id = - card#reset id + let reset card ~id = + Krobot_dynamixel_over_serial.reset card id - let get (card : Krobot_dynamixel_over_serial.device) ~id ~address = + let get card ~id ~address = match address with | #dynamixel_register8 -> - lwt data = card#read id (Int32.to_int (cast_readable_register address)) 1 in + lwt data = Krobot_dynamixel_over_serial.read card id (Int32.to_int (cast_readable_register address)) 1 in return (int_of_char data.[0]) | #dynamixel_register16 -> - lwt data = card#read id (Int32.to_int (cast_readable_register address)) 2 in + lwt data = Krobot_dynamixel_over_serial.read card id (Int32.to_int (cast_readable_register address)) 2 in return (((int_of_char data.[1]) lsl 8) lor (int_of_char data.[0])) - let set (card : Krobot_dynamixel_over_serial.device) ~id ~address ~value = + let set card ~id ~address ~value = match address with | #dynamixel_register8 -> let data = String.create 1 in data.[0] <- char_of_int value; - card#write id (Int32.to_int (cast_writable_register address)) data + Krobot_dynamixel_over_serial.write card id (Int32.to_int (cast_writable_register address)) data | #dynamixel_register16 -> let data = String.create 2 in data.[0] <- char_of_int (value land 0xff); data.[1] <- char_of_int ((value lsr 8) land 0xff); - card#write id (Int32.to_int (cast_writable_register address)) data + Krobot_dynamixel_over_serial.write card id (Int32.to_int (cast_writable_register address)) data - let reg_set (card : Krobot_dynamixel_over_serial.device) ~id ~address ~value = + let reg_set card ~id ~address ~value = fail (Failure "not implemented") - let goto (card : Krobot_dynamixel_over_serial.device) ~id ~position ~speed ~mode = + let goto card ~id ~position ~speed ~mode = lwt () = set card ~id ~address:`Moving_speed ~value:speed in set card ~id ~address:`Goal_position ~value:position - let config (card : Krobot_dynamixel_over_serial.device) ~id = + let config card ~id = fail (Failure "not implemented") - let get_position (card : Krobot_dynamixel_over_serial.device) ~id = + let get_position card ~id = get card ~id ~address:`Present_position - let get_speed (card : Krobot_dynamixel_over_serial.device) ~id = + let get_speed card ~id = get card ~id ~address:`Present_speed let interface = @@ -509,8 +509,8 @@ module Infrareds = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Infrareds - let get (card : Krobot_usb.device) = - card#call + let get card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(array 4 uint32) @@ -525,7 +525,7 @@ struct ); } - let make (card : Krobot_usb.device) = + let make card = let obus = OBus_object.make ~interfaces:[interface] (device_path "Infrareds") in OBus_object.attach obus card; obus @@ -535,38 +535,38 @@ module LCD = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_LCD - let clear (card : Krobot_usb.device) () = - card#call_no_reply + let clear card () = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:uint8 PcInterface.lcd_clear - let set_cursor (card : Krobot_usb.device) ~state = - card#call_no_reply + let set_cursor card ~state = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:uint8 (if state then PcInterface.lcd_cursor_on else PcInterface.lcd_cursor_off) - let set_backlight (card : Krobot_usb.device) ~state = - card#call_no_reply + let set_backlight card ~state = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:uint8 (if state then PcInterface.lcd_backlight_on else PcInterface.lcd_backlight_off) - let goto (card : Krobot_usb.device) ~line ~column = - card#call_no_reply + let goto card ~line ~column = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.lcd_goto_pos, column, line) - let write (card : Krobot_usb.device) ~text = - card#call_no_reply + let write card ~text = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:(seq2 uint8 string) (PcInterface.lcd_write, text) - let write_line (card : Krobot_usb.device) ~line ~text = - card#call_no_reply + let write_line card ~line ~text = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_lcd ~i_types:(seq3 uint8 uint8 string) (PcInterface.lcd_write_line, line, text) @@ -618,9 +618,9 @@ module Logic_sensors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_LogicSensors - let get_state (card : Krobot_usb.device) () = + let get_state card () = lwt bits = - card#call + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint16 @@ -659,23 +659,23 @@ struct let thread = ref (return ()) (* Thread waiting for movement completion or timeout expiration *) - let wait_for_completion (card : Krobot_usb.device) = + let wait_for_completion card = let w = lwt _ = Lwt_event.next (React.E.filter (fun (cmd, data) -> cmd = PcInterface.traj_completed) - card#commands) + (Krobot_usb.commands card)) in return () in thread := w; w - let move (card : Krobot_usb.device) ~distance ~velocity ~acceleration = + let move card ~distance ~velocity ~acceleration = cancel !thread; lwt () = - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq4 uint8 int16 int16 int16) ((if distance >= 0.0 then PcInterface.traj_forward else PcInterface.traj_backward), @@ -683,10 +683,10 @@ struct in wait_for_completion card - let turn (card : Krobot_usb.device) ~angle ~velocity ~acceleration = + let turn card ~angle ~velocity ~acceleration = cancel !thread; lwt () = - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq4 uint8 int16 int16 int16) ((if angle >= 0.0 then PcInterface.traj_tl else PcInterface.traj_tr), @@ -699,9 +699,9 @@ struct | `Left -> PcInterface.motor_left | `Right -> PcInterface.motor_right - let stop (card : Krobot_usb.device) ~motor ~mode = + let stop card ~motor ~mode = cancel !thread; - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.traj_stop, @@ -711,31 +711,31 @@ struct | `Abrupt -> PcInterface.traj_stop_abrupt | `Smooth -> PcInterface.traj_stop_smooth)) - let set_velocities (card : Krobot_usb.device) ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = + let set_velocities card ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = cancel !thread; thread := (Lwt_unix.sleep duration >> stop card `Both `Off); let sign x = if x < 0.0 then -1 else if x > 0.0 then 1 else 0 in lwt () = - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq5 uint8 uint8 int16 int16 int8) (PcInterface.traj_new_velocity, code_of_motor `Right, abs (map_dist velocity_r), map_dist acceleration_r, sign velocity_r) and () = - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq5 uint8 uint8 int16 int16 int8) (PcInterface.traj_new_velocity, code_of_motor `Left, abs (map_dist velocity_l), map_dist acceleration_l, sign velocity_l) in - card#call_no_reply + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq2 uint8 uint8) (PcInterface.traj_start, code_of_motor `Both) - let get_current_velocities (card : Krobot_usb.device) = + let get_current_velocities card = lwt vr, vl = - card#call + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 int32 int32) @@ -744,9 +744,9 @@ struct return (float_of_int vr /. 1000.0, float_of_int vl /. 1000.0) - let get_current_positions (card : Krobot_usb.device) = + let get_current_positions card = lwt pr, pl = - card#call + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 int32 int32) @@ -755,15 +755,15 @@ struct return (float_of_int pr /. 1000.0, float_of_int pl /. 1000.0) - let get_config (card : Krobot_usb.device) = - card#call + let get_config card = + Krobot_usb.call card ~command:PcInterface.cmd_traj ~i_types:uint8 ~o_types:(seq8 uint16 uint16 uint16 uint16 uint16 uint16 uint16 uint16) PcInterface.traj_read_config - let set_config (card : Krobot_usb.device) ~motor kp ~ki ~kd ~li = - card#call_no_reply + let set_config card ~motor kp ~ki ~kd ~li = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj ~i_types:(seq6 uint8 uint8 uint16 uint16 uint16 uint16) (PcInterface.traj_config, code_of_motor motor, @@ -846,35 +846,35 @@ struct type battery_state = type_battery_state - let set_buzzer_state (card : Krobot_usb.device) ~state = - card#call_no_reply + let set_buzzer_state card ~state = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_set ~i_types:(seq2 uint8 boolean) (PcInterface.set_buzzer_state, state) - let get_cell_voltage (card : Krobot_usb.device) = - card#call + let get_cell_voltage card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(array 8 uint16) PcInterface.get_cell_voltage - let get_current (card : Krobot_usb.device) = - card#call + let get_current card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint32 PcInterface.get_current - let get_power_state (card : Krobot_usb.device) = - card#call + let get_power_state card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:boolean PcInterface.get_power_state - let get_battery_state (card : Krobot_usb.device) = - card#call + let get_battery_state card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint8 @@ -921,15 +921,15 @@ module Range_finders = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_RangeFinders - let measure (card : Krobot_usb.device) ~id = - card#call + let measure card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_usrf ~i_types:(seq2 uint8 uint8) ~o_types:unit (PcInterface.usrf_measure, id) - let get (card : Krobot_usb.device) ~id = - card#call + let get card ~id = + Krobot_usb.call card ~command:PcInterface.cmd_usrf ~i_types:(seq2 uint8 uint8) ~o_types:uint16 @@ -958,7 +958,7 @@ struct obus end -module Card = +module Card(Device : Krobot_device.S) = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Card @@ -966,10 +966,10 @@ struct let obus = OBus_object.make ~interfaces:[make { - p_name = (fun card -> React.S.const card#name); - p_state = (fun card -> React.S.map cast_state card#state); + p_name = (fun card -> React.S.const (Device.name card)); + p_state = (fun card -> React.S.map cast_state (Device.state card)); }] - ["fr"; "krobot"; "Cards"; card#name] + ["fr"; "krobot"; "Cards"; Device.name card] in OBus_object.attach obus card; obus @@ -979,41 +979,41 @@ module USB_card = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_USBCard - let get_firmware_build (card : Krobot_usb.device) = - card#call + let get_firmware_build card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:string PcInterface.get_firmware_build - let get_board_info (card : Krobot_usb.device) = - card#call + let get_board_info card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:string PcInterface.get_board_info - let get_ports_state (card : Krobot_usb.device) = - card#call + let get_ports_state card = + Krobot_usb.call card ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(array 5 uint8) PcInterface.get_ports_state - let bootloader (card : Krobot_usb.device) = - card#call_no_reply + let bootloader card = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_bootloader ~i_types:unit () - let reset (card : Krobot_usb.device) = - card#call_no_reply + let reset card = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_reset ~i_types:unit () - let test (card : Krobot_usb.device) = - card#call_no_reply + let test card = + Krobot_usb.call_no_reply card ~command:PcInterface.cmd_test ~i_types:unit () @@ -1060,31 +1060,31 @@ end let init bus = (* Open cards *) let interface = - new Krobot_usb.device + Krobot_usb.make ~name:"Interface" ~vendor_id:PcInterface.usb_vid ~product_id:PcInterface.usb_pid_robot_interface () and monitoring = - new Krobot_usb.device + Krobot_usb.make ~name:"Monitoring" ~vendor_id:PcInterface.usb_vid ~product_id:PcInterface.usb_pid_battery_monitoring () and sensors = - new Krobot_usb.device + Krobot_usb.make ~name:"Sensors" ~vendor_id:PcInterface.usb_vid ~product_id:PcInterface.usb_pid_sensor_interface () and motors = - new Krobot_usb.device + Krobot_usb.make ~name:"Motors" ~vendor_id:PcInterface.usb_vid ~product_id:PcInterface.usb_pid_motor_controller () and rx64 = - new Krobot_dynamixel_over_serial.device + Krobot_dynamixel_over_serial.make ~name:"RX64" ~path:"/dev/ttyS0" ~rate:57600 @@ -1094,19 +1094,13 @@ let init bus = (* Closes all devices on exit *) Lwt_main.at_exit (fun () -> - Lwt_list.iter_p - (fun device -> - try_lwt - device#close - with exn -> - Lwt_log.error_f ~section ~exn "failed to close device %S" device#name) - [ - (interface :> Krobot_device.t); - (monitoring :> Krobot_device.t); - (sensors :> Krobot_device.t); - (motors :> Krobot_device.t); - (rx64 :> Krobot_device.t); - ]); + join [ + Krobot_usb.close interface; + Krobot_usb.close monitoring; + Krobot_usb.close sensors; + Krobot_usb.close motors; + Krobot_dynamixel_over_serial.close rx64; + ]); (* Actions when the interface card come up/down *) Lwt_signal.always_notify_s @@ -1118,7 +1112,7 @@ let init bus = return () | `Down -> return ()) - interface#state; + (Krobot_usb.state interface); (* Actions when the motor card come up/down *) Lwt_signal.always_notify_s @@ -1126,12 +1120,12 @@ let init bus = | `Up -> (* Initializes motors *) lwt () = - motors#call_no_reply + Krobot_usb.call_no_reply motors ~command:PcInterface.cmd_motor ~i_types:(seq2 uint8 uint8) (PcInterface.motor_enable, Motors.code_of_motor `Both) and () = - motors#call_no_reply + Krobot_usb.call_no_reply motors ~command:PcInterface.cmd_traj ~i_types:uint8 PcInterface.traj_init @@ -1139,7 +1133,7 @@ let init bus = return () | `Down -> return ()) - motors#state; + (Krobot_usb.state motors); (* Exports objects on the message bus *) OBus_object.export bus (Analogic_motor.make interface); @@ -1154,11 +1148,13 @@ let init bus = OBus_object.export bus (Range_finders.make sensors); OBus_object.export bus (RX64.make rx64); - let card_interface = Card.make interface in - let card_sensors = Card.make sensors in - let card_motors = Card.make motors in - let card_monitoring = Card.make monitoring in - let card_rx64 = Card.make rx64 in + let module Card_usb = Card(Krobot_usb) in + let module Card_dynamixel_over_serial = Card(Krobot_dynamixel_over_serial) in + let card_interface = Card_usb.make interface in + let card_sensors = Card_usb.make sensors in + let card_motors = Card_usb.make motors in + let card_monitoring = Card_usb.make monitoring in + let card_rx64 = Card_dynamixel_over_serial.make rx64 in OBus_object.add_interfaces card_interface [USB_card.interface]; OBus_object.add_interfaces card_sensors [USB_card.interface]; diff --git a/info/control/driver/krobot_dynamixel_over_serial.ml b/info/control/driver/krobot_dynamixel_over_serial.ml index 27374fd..ef2d158 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.ml +++ b/info/control/driver/krobot_dynamixel_over_serial.ml @@ -256,9 +256,6 @@ and wrapper = { watch : [ `Error of exn | `Closed ] Lwt.t; } -type t = wrapper - -let name wrapper = wrapper.name let closed wrapper = match wrapper.state with | Opened _ -> false | Closed _ -> true @@ -293,14 +290,14 @@ let abort wrapper exn = | Opening and closing | +-----------------------------------------------------------------+ *) -let close wrapper = match wrapper.state with +let close_wrapper wrapper = match wrapper.state with | Opened _ -> lwt _ = abort wrapper Card_closed in return () | Closed _ -> return () -let rec make ?(timeout=1.0) ~name ~path ~rate = +let make_wrapper ?(timeout=1.0) ~name ~path ~rate = let fd = Lwt_unix.openfile path [Unix.O_RDWR; Unix.O_NONBLOCK] 0o660 in let tio = { (* taken from minicom *) @@ -455,84 +452,96 @@ let () = Printexc.register_printer | The device class | +-----------------------------------------------------------------+ *) -let unavailable name = +type t = { + mutable wrapper : wrapper option; + mutable closed : bool; + name : string; + state : [ `Up | `Down ] React.signal; + set_state : [`Up | `Down ] -> unit; +} + +let unavailable card = Printf.ksprintf (OBus_error.fail Krobot_error.Device.Unavailable) "the %s card is currently not available" - name - -class device ?timeout ~name ~path ~rate () = - let state, set_state = React.S.create `Down in -object - val mutable card = None - val mutable closed = false - - method name = name - method state : [ `Up | `Down ] React.signal = state - method close = - closed <- true; - let card' = card in - card <- None; - set_state `Down; - match card' with - | Some card -> - close card - | None -> - return () + card.name + +let name card = card.name +let state card = card.state + +let close card = + card.closed <- true; + let wrapper = card.wrapper in + card.wrapper <- None; + card.set_state `Down; + match wrapper with + | Some wrapper -> + close_wrapper wrapper + | None -> + return () - method ping ~id = - match card with - | None -> - unavailable name - | Some card -> - lwt _ = call card id I_PING "" in - return () +let ping card ~id = + match card.wrapper with + | None -> + unavailable card + | Some wrapper -> + lwt _ = call wrapper id I_PING "" in + return () - method read ~id ~address ~length = - match card with - | None -> - unavailable name - | Some card -> - let data = String.create 2 in - data.[0] <- char_of_int address; - data.[1] <- char_of_int length; - lwt data = call card id I_READ_DATA data in - return (String.sub data 0 2) - - method write ~id ~address ~data = - match card with - | None -> - unavailable name - | Some card -> - let data = String.make 1 (char_of_int address) ^ data in - lwt _ = call card id I_WRITE_DATA data in - return () +let read card ~id ~address ~length = + match card.wrapper with + | None -> + unavailable card + | Some wrapper -> + let data = String.create 2 in + data.[0] <- char_of_int address; + data.[1] <- char_of_int length; + lwt data = call wrapper id I_READ_DATA data in + return (String.sub data 0 2) + +let write card ~id ~address ~data = + match card.wrapper with + | None -> + unavailable card + | Some wrapper -> + let data = String.make 1 (char_of_int address) ^ data in + lwt _ = call wrapper id I_WRITE_DATA data in + return () - method reset ~id = - match card with - | None -> - unavailable name - | Some card -> - lwt _ = call card id I_RESET "" in - return () +let reset card ~id = + match card.wrapper with + | None -> + unavailable card + | Some wrapper -> + lwt _ = call wrapper id I_RESET "" in + return () - initializer - let rec loop () = - lwt () = - try_lwt - lwt c = make ?timeout ~name ~path ~rate in - card <- Some c; - set_state `Up; - lwt _ = c.watch in - return () - with exn -> - return () - in - if closed then +let make ?timeout ~name ~path ~rate () = + let state, set_state = React.S.create `Down in + let card = { + wrapper = None; + closed = false; + name = name; + state = state; + set_state = set_state; + } in + let rec loop () = + lwt () = + try_lwt + lwt wrapper = make_wrapper ?timeout ~name ~path ~rate in + card.wrapper <- Some wrapper; + card.set_state `Up; + lwt _ = wrapper.watch in + return () + with exn -> return () - else - lwt () = Lwt_unix.sleep 0.1 in - loop () in - ignore (loop ()) -end + if card.closed then + return () + else + lwt () = Lwt_unix.sleep 0.1 in + loop () + in + ignore (loop ()); + card + diff --git a/info/control/driver/krobot_dynamixel_over_serial.mli b/info/control/driver/krobot_dynamixel_over_serial.mli index 8f6d0b0..5257095 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.mli +++ b/info/control/driver/krobot_dynamixel_over_serial.mli @@ -10,6 +10,8 @@ (** Access to dynamixel servos by serial port *) +include Krobot_device.S + type error = | E_Instruction (** an undefined instruction is sent or an action instruction is @@ -32,11 +34,11 @@ type error = (** the voltage is out of the operating voltage range as defined in the control table *) -class device : ?timeout : float -> name : string -> path : string -> rate : int -> unit -> object - inherit Krobot_device.t +val make : ?timeout : float -> name : string -> path : string -> rate : int -> unit -> t + (** [make ?timeout ~name ~path ~rate ()] creates a device for an + RX64 controlled over the serial port *) - method ping : id : int -> unit Lwt.t - method read : id : int -> address : int -> length : int -> string Lwt.t - method write : id : int -> address : int -> data : string -> unit Lwt.t - method reset : id : int -> unit Lwt.t -end +val ping : t -> id : int -> unit Lwt.t +val read : t -> id : int -> address : int -> length : int -> string Lwt.t +val write : t -> id : int -> address : int -> data : string -> unit Lwt.t +val reset : t -> id : int -> unit Lwt.t diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index c13de1f..8d0b5e2 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -88,279 +88,317 @@ let forge_message msg = end (* +-----------------------------------------------------------------+ - | The USB devie class | + | The USB devie type | +-----------------------------------------------------------------+ *) -exception Reopen_card +type t = { + name : string; + (* The name of the card *) + + vendor_id : int; + product_id : int; + + state : [ `Up | `Down ] React.signal; + set_state : [ `Up | `Down ] -> unit; + (* Current state of the card *) + + errors : string React.event; + send_error : string -> unit; + (* Event which occurs when the card send an error *) + + commands : (int * string) React.event; + send_command : (int * string) -> unit; + (* Event which occurs when the card send a spontaneous command *) + + reply_waiters : string Lwt.u option array; + (* Threads waiting for a reply *) + + mutable handle : USB.handle option; + (* The current USB handle *) + + mutable kernel_driver_active : bool; + (* Whether a kernel driver was attached to the peripherial before we + opened it *) + + mutex : Lwt_mutex.t; + (* Mutex for sending commands *) + + mutable abort_waiter : int Lwt.t; + mutable abort_wakener : int Lwt.u; + (* Sleeping thread which is wakeup when the card is reopened or + closed *) + + mutable closed : bool; + (* Initially [false], and set to [true] when the card is closed *) +} + +(* +-----------------------------------------------------------------+ + | Projections | + +-----------------------------------------------------------------+ *) + +let errors card = card.errors +let commands card = card.commands +let state card = card.state +let name card = card.name + +(* +-----------------------------------------------------------------+ + | Serials | + +-----------------------------------------------------------------+ *) let serial_count = 256 -class device ~name ~vendor_id ~product_id () = - let errors, send_error = React.E.create () - and commands, send_command = React.E.create () - and (state : [ `Up | `Down ] React.signal ), set_state = React.S.create `Down in -object(self) - - (* +---------------------------------------------------------------+ - | Public parameters | - +---------------------------------------------------------------+ *) - - method name = name - method state = state - method errors = errors - method commands = commands - - (* +---------------------------------------------------------------+ - | Serials | - +---------------------------------------------------------------+ *) - - val mutable reply_waiters = Array.create serial_count None - (* Threads waiting for a reply *) - - method private get_serial = - let rec loop n = - if n = serial_count then - OBus_error.raise Krobot_error.Device.Error "no more serial available!" - else match reply_waiters.(n) with - | Some _ -> loop (n + 1) - | None -> n - in - loop 0 - - (* +---------------------------------------------------------------+ - | Misc | - +---------------------------------------------------------------+ *) - - val mutable handle = None - (* The USB device handle *) - - val mutable kernel_driver_active = false - (* Whether a kernel driver was attached to the peripherial before - we open it *) - - val mutex = Lwt_mutex.create () - (* Mutex for sending commands *) - - val mutable abort = wait () - (* Sleeping thread which is wakeup when the card is reopened or - closed *) - - val mutable closed = false - (* Set to [true] when the card is closed *) - - (* +---------------------------------------------------------------+ - | Sending/receiving messages | - +---------------------------------------------------------------+ *) - - method private send buffer = - match handle with - | None -> - Printf.ksprintf - (OBus_error.fail Krobot_error.Device.Unavailable) - "the %s card is currently not available" - name - | Some handle -> - lwt len = pick [fst abort; USB.interrupt_send ~handle ~endpoint:1 buffer 0 64] in - if len <> 64 then begin - let exn = - Printf.ksprintf - (OBus_error.make Krobot_error.Device.Error) - "write on %s card returned %d instead of 64, reopening" name len - in - self#abort exn; - fail exn - end else - return () +let get_serial card = + let rec loop n = + if n = serial_count then + OBus_error.raise Krobot_error.Device.Error "no more serial available!" + else match card.reply_waiters.(n) with + | Some _ -> loop (n + 1) + | None -> n + in + loop 0 - (* Send a command without waiting for the reply: *) - method call_no_reply : 'a. command : int -> i_types : 'a Krobot_wire.convertor -> 'a -> unit Lwt.t = fun ~command ~i_types args -> - let buffer = forge_message { - host_serial = 0; - device_serial = 0; - command = command; - error = 0; - data = Krobot_wire.write i_types args; - } in - try_lwt - Lwt_mutex.with_lock mutex - (fun () -> - lwt () = self#send buffer in - return ()) - with - | Canceled -> - fail Canceled - | exn -> - self#abort exn; - fail exn +(* +-----------------------------------------------------------------+ + | Sending/receiving messages | + +-----------------------------------------------------------------+ *) - (* Send a command and wait for the reply: *) - method call : 'a 'b. command : int -> i_types : 'a Krobot_wire.convertor -> o_types : 'b Krobot_wire.convertor -> 'a -> 'b Lwt.t = fun ~command ~i_types ~o_types args -> - let waiter, wakener = Lwt.task () in - let serial = self#get_serial in - reply_waiters.(serial) <- Some wakener; - on_cancel waiter (fun () -> reply_waiters.(serial) <- None); - let buffer = forge_message { - host_serial = serial; - device_serial = 0; - command = command; - error = 0; - data = Krobot_wire.write i_types args; - } in - try_lwt - Lwt_mutex.with_lock mutex - (fun () -> - lwt () = self#send buffer in - lwt buffer = waiter in - return (Krobot_wire.read o_types buffer)) - with - | Canceled -> - fail Canceled - | exn -> - self#abort exn; +let abort card exn = + if Lwt.state card.abort_waiter = Sleep then + wakeup_exn card.abort_wakener exn + +let send card buffer = + match card.handle with + | None -> + Printf.ksprintf + (OBus_error.fail Krobot_error.Device.Unavailable) + "the %s card is currently not available" + card.name + | Some handle -> + lwt len = pick [card.abort_waiter; USB.interrupt_send ~handle ~timeout:1.0 ~endpoint:1 buffer 0 64] in + if len <> 64 then begin + let exn = + Printf.ksprintf + (OBus_error.make Krobot_error.Device.Error) + "write on %s card returned %d instead of 64, reopening" card.name len + in + abort card exn; fail exn + end else + return () - (* +---------------------------------------------------------------+ - | Logging | - +---------------------------------------------------------------+ *) +(* Send a command without waiting for the reply: *) +let call_no_reply card ~command ~i_types args = + let buffer = forge_message { + host_serial = 0; + device_serial = 0; + command = command; + error = 0; + data = Krobot_wire.write i_types args; + } in + try_lwt + Lwt_mutex.with_lock card.mutex + (fun () -> + lwt () = send card buffer in + return ()) + with + | Canceled -> + fail Canceled + | exn -> + abort card exn; + fail exn + +(* Send a command and wait for the reply: *) +let call card ?(timeout=1.0) ~command ~i_types ~o_types args = + let waiter, wakener = Lwt.task () in + let serial = get_serial card in + card.reply_waiters.(serial) <- Some wakener; + on_cancel waiter (fun () -> card.reply_waiters.(serial) <- None); + let buffer = forge_message { + host_serial = serial; + device_serial = 0; + command = command; + error = 0; + data = Krobot_wire.write i_types args; + } in + try_lwt + Lwt_mutex.with_lock card.mutex + (fun () -> + lwt () = send card buffer in + lwt buffer = Lwt_unix.with_timeout timeout (fun () -> waiter) in + return (Krobot_wire.read o_types buffer)) + with + | Canceled -> + fail Canceled + | exn -> + abort card exn; + fail exn + +(* +-----------------------------------------------------------------+ + | Logging | + +-----------------------------------------------------------------+ *) - (* Log dropped messages *) - method private dropped typ msg = - lwt data = Lwt_stream.to_list (Lwt_stream.hexdump (Lwt_stream.of_string msg.data)) in - Lwt_log.warning_f ~section "%s dropped on card %s +(* Log dropped messages *) +let dropped card typ msg = + lwt data = Lwt_stream.to_list (Lwt_stream.hexdump (Lwt_stream.of_string msg.data)) in + Lwt_log.warning_f ~section "%s dropped on card %s \ host_serial = %d\n\ \ device_serial = %d\n\ \ command = %d\n\ \ error = %s\n\ \ data:\n%s" - typ name msg.host_serial msg.device_serial msg.command - (if msg.error <> 0 then error_message msg.error else "none") - (String.concat "" (List.map (Printf.sprintf " %s\n") data)) - - (* +---------------------------------------------------------------+ - | Dispatching | - +---------------------------------------------------------------+ *) - - (* Dispatch one message *) - method private dispatch msg = - if msg.error <> 0 then begin - if msg.command = PcInterface.cmd_respond then - send_error ("response: " ^ error_message msg.error) - else - send_error ("spontaneous: " ^ error_message msg.error) - end; - if msg.command = PcInterface.cmd_respond then begin - match reply_waiters.(msg.host_serial) with - | Some wakener -> - reply_waiters.(msg.host_serial) <- None; - if msg.error <> 0 then - wakeup_exn wakener (OBus_error.make Krobot_error.Device.Error (error_message msg.error)) - else - wakeup wakener msg.data; - return () - | None -> - self#dropped "response" msg - end else begin - try - send_command (msg.command, msg.data); - return () - with exn -> - Lwt_log.error_f ~section ~exn "pushing event %d from %s card failed with" msg.command name - end + typ card.name msg.host_serial msg.device_serial msg.command + (if msg.error <> 0 then error_message msg.error else "none") + (String.concat "" (List.map (Printf.sprintf " %s\n") data)) - (* +---------------------------------------------------------------+ - | Closing the card | - +---------------------------------------------------------------+ *) - - method private abort exn = - if Lwt.state (fst abort) = Sleep then - wakeup_exn (snd abort) exn +(* +-----------------------------------------------------------------+ + | Dispatching | + +-----------------------------------------------------------------+ *) - method private cleanup = - match handle with +(* Dispatch one message *) +let dispatch card msg = + if msg.error <> 0 then begin + if msg.command = PcInterface.cmd_respond then + card.send_error ("response: " ^ error_message msg.error) + else + card.send_error ("spontaneous: " ^ error_message msg.error) + end; + if msg.command = PcInterface.cmd_respond then begin + match card.reply_waiters.(msg.host_serial) with + | Some wakener -> + card.reply_waiters.(msg.host_serial) <- None; + if msg.error <> 0 then + wakeup_exn wakener (OBus_error.make Krobot_error.Device.Error (error_message msg.error)) + else + wakeup wakener msg.data; + return () | None -> + dropped card "response" msg + end else begin + try + card.send_command (msg.command, msg.data); + return () + with exn -> + Lwt_log.error_f ~section ~exn "pushing event %d from %s card failed with" msg.command card.name + end + +(* +-----------------------------------------------------------------+ + | Closing the card | + +-----------------------------------------------------------------+ *) + +let cleanup card = + match card.handle with + | None -> + return () + | Some handle -> + card.handle <- None; + card.set_state `Down; + let exn = OBus_error.make Krobot_error.Device.Error (Printf.sprintf "the %s card has been closed" card.name) in + let abort_waiter = card.abort_waiter and abort_wakener = card.abort_wakener in + let waiter, wakener = wait () in + card.abort_waiter <- waiter; + card.abort_wakener <- wakener; + if Lwt.state abort_waiter = Sleep then wakeup_exn abort_wakener exn; + for i = 0 to serial_count - 1 do + match card.reply_waiters.(i) with + | Some wakener -> + card.reply_waiters.(i) <- None; + wakeup_exn wakener exn + | None -> + () + done; + try_lwt + lwt () = USB.release_interface handle 0 in + if card.kernel_driver_active then USB.attach_kernel_driver handle 0; return () - | Some h -> - handle <- None; - set_state `Down; - let exn = OBus_error.make Krobot_error.Device.Error (Printf.sprintf "the %s card has been closed" name) in - let waiter, wakener = abort in - abort <- wait (); - if Lwt.state waiter = Sleep then wakeup_exn wakener exn; - for i = 0 to serial_count - 1 do - match reply_waiters.(i) with - | Some wakener -> - reply_waiters.(i) <- None; - wakeup_exn wakener exn - | None -> - () - done; - try_lwt - lwt () = USB.release_interface h 0 in - if kernel_driver_active then USB.attach_kernel_driver h 0; - return () - finally - USB.close h; - return () + finally + USB.close handle; + return () + +let close card = + card.closed <- true; + cleanup card + +let safe_cleanup card = + try_lwt + cleanup card + with exn -> + Lwt_log.error_f ~section ~exn "failed to release card %s" card.name + +(* +-----------------------------------------------------------------+ + | Device monitoring | + +-----------------------------------------------------------------+ *) - method close = - closed <- true; - self#cleanup +exception Reopen_card - method private safe_cleanup = +let rec loop card = + if card.closed then + return () + else + lwt () = Lwt_log.info_f ~section "opening card %s" card.name in try_lwt - self#cleanup - with exn -> - Lwt_log.error_f ~exn "failed to release card %s" name + let handle = try USB.open_device_with ~vendor_id:card.vendor_id ~product_id:card.product_id with Failure _ -> raise Reopen_card in + card.handle <- Some handle; + lwt () = Lwt_log.info_f ~section "card %s opened" card.name in + + (* USB stuff *) + card.kernel_driver_active <- USB.kernel_driver_active handle 0; + if card.kernel_driver_active then USB.detach_kernel_driver handle 0; + lwt () = USB.claim_interface handle 0 in + lwt () = Lwt_log.info_f ~section "card %s is ready" card.name in + + (* Everything is ready, set the card up *) + card.set_state `Up; + + let rec read_and_dispatch () = + let buffer = String.create 64 in + lwt len = pick [card.abort_waiter; USB.interrupt_recv ~handle ~endpoint:1 buffer 0 64] in + lwt () = + if len <> 64 then + lwt () = Lwt_log.warning_f ~section "read on %s card returned %d instead of 64, reopening" card.name len in + fail Reopen_card + else + return () + in + ignore (dispatch card (parse_message buffer)); + read_and_dispatch () + in + read_and_dispatch () + with + | Reopen_card -> + lwt () = safe_cleanup card in + lwt () = Lwt_unix.sleep 0.1 in + loop card + | exn -> + lwt () = Lwt_log.error_f ~section ~exn "error on card %s" card.name in + lwt () = safe_cleanup card in + lwt () = Lwt_unix.sleep 0.1 in + loop card - (* +---------------------------------------------------------------+ - | Device monitoring | - +---------------------------------------------------------------+ *) +(* +-----------------------------------------------------------------+ + | Card creation | + +-----------------------------------------------------------------+ *) - initializer - let rec loop () = - if closed then - return () - else - lwt () = Lwt_log.info_f ~section "opening card %s" name in - try_lwt - let h = try USB.open_device_with ~vendor_id ~product_id with Failure _ -> raise Reopen_card in - handle <- Some h; - lwt () = Lwt_log.info_f ~section "card %s opened" name in - - (* USB stuff *) - lwt () = USB.reset_device h in - kernel_driver_active <- USB.kernel_driver_active h 0; - if kernel_driver_active then USB.detach_kernel_driver h 0; - lwt () = USB.set_configuration h 1 in - lwt () = USB.claim_interface h 0 in - - (* Everything is ready, set the card up *) - set_state `Up; - - let rec read_and_dispatch () = - let buffer = String.create 64 in - lwt len = pick [fst abort; USB.interrupt_recv ~handle:h ~endpoint:1 buffer 0 64] in - lwt () = - if len <> 64 then - lwt () = Lwt_log.warning_f ~section "read on %s card returned %d instead of 64, reopening" name len in - fail Reopen_card - else - return () - in - ignore (self#dispatch (parse_message buffer)); - read_and_dispatch () - in - read_and_dispatch () - with - | Reopen_card -> - lwt () = self#safe_cleanup in - lwt () = Lwt_unix.sleep 0.1 in - loop () - | exn -> - lwt () = Lwt_log.error_f ~section ~exn "error on card %s" name in - lwt () = self#safe_cleanup in - lwt () = Lwt_unix.sleep 0.1 in - loop () - in - ignore (loop ()) -end +let make ~name ~vendor_id ~product_id () = + let state, set_state = React.S.create `Down + and errors, send_error = React.E.create () + and commands, send_command = React.E.create () + and abort_waiter, abort_wakener = Lwt.task () in + let card = { + name = name; + vendor_id = vendor_id; + product_id = product_id; + state = state; + set_state = set_state; + errors = errors; + send_error = send_error; + commands = commands; + send_command = send_command; + reply_waiters = Array.make serial_count None; + handle = None; + kernel_driver_active = false; + mutex = Lwt_mutex.create (); + abort_waiter = abort_waiter; + abort_wakener = abort_wakener; + closed = false; + } in + ignore (loop card); + card diff --git a/info/control/driver/krobot_usb.mli b/info/control/driver/krobot_usb.mli index 72f4b89..dd49722 100644 --- a/info/control/driver/krobot_usb.mli +++ b/info/control/driver/krobot_usb.mli @@ -9,29 +9,32 @@ (** USB card devices *) -(** Class of USB cards *) -class device : name : string -> vendor_id : int -> product_id : int -> unit -> object - inherit Krobot_device.t +include Krobot_device.S - method call : 'a 'b. - command : int -> - i_types : 'a Krobot_wire.convertor -> - o_types : 'b Krobot_wire.convertor -> - 'a -> 'b Lwt.t - (** [call ~command ~i_types ~o_types args] calls a method of the - card *) +val make : name : string -> vendor_id : int -> product_id : int -> unit -> t + (** [make ?timeout ~name ~vendor_id ~product_id ()] creates a device + for a USB card of the robot. *) - method call_no_reply : 'a. - command : int -> - i_types : 'a Krobot_wire.convertor -> - 'a -> unit Lwt.t - (** [call ~command ~i_types ~o_types args] calls a method of the - card, but do not wait for a reply *) +val call : t -> + ?timeout : float -> + command : int -> + i_types : 'a Krobot_wire.convertor -> + o_types : 'b Krobot_wire.convertor -> + 'a -> 'b Lwt.t + (** [call dev ~command ~i_types ~o_types args] calls a method of the + card. If the reply does not come before [timeout], {!call} fails + with [Krobot_error.Timeout]. *) - method commands : (int * string) React.event - (** Event which occurs each time a command is received from the - card *) +val call_no_reply : t -> + command : int -> + i_types : 'a Krobot_wire.convertor -> + 'a -> unit Lwt.t + (** [call ~command ~i_types ~o_types args] calls a method of the + card, but do not wait for a reply *) - method errors : string React.event - (** Event which occurs each time the card send an error *) -end +val commands : t -> (int * string) React.event + (** Event which occurs each time a command is received from the + card *) + +val errors : t -> string React.event + (** Event which occurs each time the card send an error *) diff --git a/info/control/protocol/krobot_error.ml b/info/control/protocol/krobot_error.ml index 7985a34..544d913 100644 --- a/info/control/protocol/krobot_error.ml +++ b/info/control/protocol/krobot_error.ml @@ -13,10 +13,12 @@ struct exception Closed exception Unavailable exception Not_implemented + exception Timeout let () = OBus_error.register "fr.krobot.Device.Error.Error" Error; OBus_error.register "fr.krobot.Device.Error.Closed" Closed; OBus_error.register "fr.krobot.Device.Error.Unavailable" Unavailable; - OBus_error.register "fr.krobot.Device.Error.NotImplemented" Not_implemented + OBus_error.register "fr.krobot.Device.Error.NotImplemented" Not_implemented; + OBus_error.register "fr.krobot.Device.Error.Timeout" Timeout end diff --git a/info/control/protocol/krobot_error.mli b/info/control/protocol/krobot_error.mli index 58a92a0..8c176b4 100644 --- a/info/control/protocol/krobot_error.mli +++ b/info/control/protocol/krobot_error.mli @@ -15,13 +15,16 @@ module Device : sig (** D-Bus exception raised when a card return an error *) exception Closed - (** D-Bus Exception raised when trying to use a closed device. *) + (** D-Bus exception raised when trying to use a closed device. *) exception Unavailable - (** D-Bus Exception raised when trying to use a device that is not + (** D-Bus exception raised when trying to use a device that is not currently up. *) exception Not_implemented - (** D-Bus Exception raised when calling a request that is not + (** D-Bus exception raised when calling a request that is not implemented by the device. *) + + exception Timeout + (** D-Bus exception raised when a call timeout *) end hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-30 15:11:39
|
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 cfefd2ab998a6346acad98bae9eb9c046d7442aa (commit) via 075cc83fdd1c8d4bd218dbabd8d3b578b1eb4728 (commit) via 87697b2f5e20113b8cdf7313672c0d716499bc18 (commit) via b009cb4ced496f818f41c6648cd1677adbee9b4d (commit) from f11dd0beb9af9ef5fc42fe89901fffd043fae34e (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 cfefd2ab998a6346acad98bae9eb9c046d7442aa Author: Jérémie Dimino <je...@di...> Date: Fri May 28 18:34:26 2010 +0200 do not open devices too early in the driver commit 075cc83fdd1c8d4bd218dbabd8d3b578b1eb4728 Author: Jérémie Dimino <je...@di...> Date: Fri May 28 17:56:28 2010 +0200 small improvements in krobot_damon.ml commit 87697b2f5e20113b8cdf7313672c0d716499bc18 Author: Jérémie Dimino <je...@di...> Date: Fri May 28 16:08:51 2010 +0200 detach kernel driver if needed commit b009cb4ced496f818f41c6648cd1677adbee9b4d Author: Jérémie Dimino <je...@di...> Date: Fri May 28 15:16:37 2010 +0200 add functions to get the color state ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index ff57096..a006823 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -138,6 +138,7 @@ type state = { logs : Lwt_term.styled_text list; size : Lwt_term.size; engine_state : Lwt_read_line.Engine.state; + color : [ `Yellow | `Blue ] option; infrareds : int array option; logic_sensors : bool array option; range_finders : int array option; @@ -257,6 +258,15 @@ let draw state = Draw.textc zone x 4 (text_of_state "rx64" state.card_rx64); let x = x + 12 in + begin + match state.color with + | Some color -> + Draw.textc zone x 0 [text "color: "; text (match color with + | `Yellow -> "yellow" + | `Blue -> "blue")] + | None -> + Draw.textc zone x 0 [fg red; text "unavailable"] + end; let text_of_motor_state mode = function | Some true -> [text mode; fg lyellow; text "inhibited"] @@ -448,7 +458,7 @@ lwt () = (fun (box, services, logs, engine_state, size) (card_interface, card_sensors, card_motors, card_monitoring, card_rx64) - (infrareds, logic_sensors, range_finders) + (color, infrareds, logic_sensors, range_finders) (inhibited_forward, inhibited_backward) -> { box = box; @@ -456,6 +466,7 @@ lwt () = size = size; engine_state = engine_state; services = services; + color = color; infrareds = infrareds; logic_sensors = logic_sensors; range_finders = range_finders; @@ -479,17 +490,18 @@ lwt () = return (React.S.l5 (fun a b c d e -> (Some a, Some b, Some c, Some d, Some e)) interface sensors motors monitoring rx64))) - (monitor "Service.Sensors" (None, None, None) + (monitor "Service.Sensors" (None, None, None, None) (fun () -> - lwt infrareds = OBus_property.monitor (Krobot_sensors.infrareds krobot) + lwt color = OBus_property.monitor (Krobot_sensors.color krobot) + and infrareds = OBus_property.monitor (Krobot_sensors.infrareds krobot) and logic_sensors = OBus_property.monitor (Krobot_sensors.logic_sensors krobot) and range_finders = OBus_property.monitor (Krobot_sensors.range_finders krobot) in - return (React.S.l3 (fun x y z -> (Some x, Some y, Some z)) infrareds logic_sensors range_finders))) + return (React.S.l4 (fun a b c d -> (Some a, Some b, Some c, Some d)) color infrareds logic_sensors range_finders))) (monitor "Service.Motors" (None, None) (fun () -> lwt inhibited_forward = OBus_property.monitor (Krobot_motors.inhibited_forward krobot) and inhibited_backward = OBus_property.monitor (Krobot_motors.inhibited_backward krobot) in - return (React.S.l2 (fun x y -> (Some x, Some y)) inhibited_forward inhibited_backward))) + return (React.S.l2 (fun a b -> (Some a, Some b)) inhibited_forward inhibited_backward))) in (* Redraw the screen when the state change *) diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index 08e0c2d..52abae7 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -7,7 +7,7 @@ * This file is a part of [kro]bot. *) -let section = Lwt_log.Section.make "" +let section = Lwt_log.Section.make "main" open Lwt open Krobot_dbus_daemon.Fr_krobot_Daemon @@ -105,7 +105,7 @@ let start ~desc ~name init = List.map (fun line -> Buffer.clear buf; - Lwt_log.render ~buffer:buf ~template:"$(section): $(level): $(message)" ~section ~level ~message:line; + Lwt_log.render ~buffer:buf ~template:"$(level)@$(name)[$(section)]: $(message)" ~section ~level ~message:line; Buffer.contents buf) lines in diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 7018b49..e238aa1 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -24,85 +24,21 @@ open Krobot_wire | Devices | +-----------------------------------------------------------------+ *) -module Dev = -struct - let interface = - new Krobot_usb.device - ~name:"Interface" - ~vendor_id:PcInterface.usb_vid - ~product_id:PcInterface.usb_pid_robot_interface - () - - let monitoring = - new Krobot_usb.device - ~name:"Monitoring" - ~vendor_id:PcInterface.usb_vid - ~product_id:PcInterface.usb_pid_battery_monitoring - () - - let sensors = - new Krobot_usb.device - ~name:"Sensors" - ~vendor_id:PcInterface.usb_vid - ~product_id:PcInterface.usb_pid_sensor_interface - () - - let motors = - new Krobot_usb.device - ~name:"Motors" - ~vendor_id:PcInterface.usb_vid - ~product_id:PcInterface.usb_pid_motor_controller - () - - let rx64 = - new Krobot_dynamixel_over_serial.device - ~name:"RX64" - ~path:"/dev/ttyS0" - ~rate:57600 - () - - let devices = [ - (interface :> Krobot_device.t); - (monitoring :> Krobot_device.t); - (sensors :> Krobot_device.t); - (motors :> Krobot_device.t); - (rx64 :> Krobot_device.t); - ] -end - -let () = - (* Closes all devices on exit *) - Lwt_main.at_exit - (fun () -> - Lwt_list.iter_p - (fun device -> - try_lwt - device#close - with exn -> - Lwt_log.error_f ~section ~exn "failed to close device %S" device#name) - Dev.devices) - -(* +-----------------------------------------------------------------+ - | Devices | - +-----------------------------------------------------------------+ *) - let device_path name = ["fr"; "krobot"; "Devices"; name] module Analogic_motor = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicMotor - let obus = OBus_object.make (device_path "AnalogicMotor") - - let set_state ~state = - Dev.interface#call_no_reply + let set_state (card : Krobot_usb.device) ~state = + card#call_no_reply ~command:PcInterface.cmd_motor ~i_types:(seq2 uint8 uint8) ((if state then PcInterface.motor_enable else PcInterface.motor_disable), PcInterface.motor_both) - let set_velocity ~velocity ~duration = - Dev.interface#call_no_reply + let set_velocity (card : Krobot_usb.device) ~velocity ~duration = + card#call_no_reply ~command:PcInterface.cmd_motor ~i_types:(seq5 uint8 uint8 boolean uint8 uint32) (PcInterface.motor_move, @@ -115,37 +51,36 @@ struct make { m_set_state = ( fun ctx obj state -> - lwt result = set_state state in + lwt result = set_state obj ~state in OBus_method.return ctx result ); m_set_velocity = ( fun ctx obj (velocity, duration) -> let velocity = Int32.to_int velocity in - lwt result = set_velocity velocity duration in + lwt result = set_velocity obj velocity duration in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AnalogicMotor") in + OBus_object.attach obus card; + obus end module Analogic_servos = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicServos - let obus = OBus_object.make (device_path "AnalogicServos") - - let set_config ~enable ~disable = - Dev.interface#call_no_reply + let set_config (card : Krobot_usb.device) ~enable ~disable = + card#call_no_reply ~command:PcInterface.cmd_set ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.set_servo_config, List.fold_left (fun acc n -> acc lor (1 lsl n)) 0 enable, List.fold_left (fun acc n -> acc lor (1 lsl n)) 0 disable) - let set_state ~states = + let set_state (card : Krobot_usb.device) ~states = let get id mask = try (List.assoc id states, mask lor (1 lsl id)) @@ -158,7 +93,7 @@ struct let angle2, mask = get 2 mask in let angle3, mask = get 3 mask in let angle4, mask = get 4 mask in - Dev.interface#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_set ~i_types:(seq3 uint8 uint8 (array 5 int8)) (PcInterface.set_servo_state, @@ -171,31 +106,30 @@ struct fun ctx obj (enable, disable) -> let enable = List.map Int32.to_int enable in let disable = List.map Int32.to_int disable in - lwt result = set_config enable disable in + lwt result = set_config obj enable disable in OBus_method.return ctx result ); m_set_state = ( fun ctx obj states -> let states = List.map (fun (k, v) -> (Int32.to_int k, Int32.to_int v)) states in - lwt result = set_state states in + lwt result = set_state obj states in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AnalogicServos") in + OBus_object.attach obus card; + obus end module Compass = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Compass - let obus = OBus_object.make (device_path "Compass") - - let get_measure () = + let get_measure (card : Krobot_usb.device) = lwt dummy, value = - Dev.interface#call + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 uint16 uint16) @@ -208,14 +142,15 @@ struct m_get_measure = ( fun ctx obj () -> let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_measure () in + lwt result = get_measure obj in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Compass") in + OBus_object.attach obus card; + obus end type dynamixel_register8 = @@ -260,77 +195,75 @@ module AX12 = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Dynamixel - let obus = OBus_object.make (device_path "AX12") - let timeout = 1000 - let ping ~id = - Dev.interface#call + let ping (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq3 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_ping, id, timeout) - let action ~id = - Dev.interface#call + let action (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq3 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_action, id, timeout) - let reset ~id = - Dev.interface#call_no_reply + let reset (card : Krobot_usb.device) ~id = + card#call_no_reply ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) (PcInterface.ax12_reset, id) - let get ~id ~address = + let get (card : Krobot_usb.device) ~id ~address = match address with | #dynamixel_register8 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:uint8 (PcInterface.ax12_read8, id, Int32.to_int (cast_readable_register address), timeout) | #dynamixel_register16 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:uint16 (PcInterface.ax12_read16, id, Int32.to_int (cast_readable_register address), timeout) - let set ~id ~address ~value = + let set (card : Krobot_usb.device) ~id ~address ~value = match address with | #dynamixel_register8 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint8) ~o_types:unit (PcInterface.ax12_write8, id, Int32.to_int (cast_writable_register address), value) | #dynamixel_register16 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_write16, id, Int32.to_int (cast_writable_register address), value) - let reg_set ~id ~address ~value = + let reg_set (card : Krobot_usb.device) ~id ~address ~value = match address with | #dynamixel_register8 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint8) ~o_types:unit (PcInterface.ax12_write_reg8, id, Int32.to_int (cast_writable_register address), value) | #dynamixel_register16 -> - Dev.interface#call + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq4 uint8 uint8 uint8 uint16) ~o_types:unit (PcInterface.ax12_write_reg16, id, Int32.to_int (cast_writable_register address), value) - let goto ~id ~position ~speed ~mode = - Dev.interface#call + let goto (card : Krobot_usb.device) ~id ~position ~speed ~mode = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq5 uint8 uint8 uint16 uint16 uint8) ~o_types:unit @@ -339,22 +272,22 @@ struct | `Now -> PcInterface.ax12_exec_now | `Action -> PcInterface.ax12_exec_action)) - let config ~id = - Dev.interface#call + let config (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) ~o_types:unit (PcInterface.ax12_config, id) - let get_position ~id = - Dev.interface#call + let get_position (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) ~o_types:uint16 (PcInterface.ax12_get_pos, id) - let get_speed ~id = - Dev.interface#call + let get_speed (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_ax12 ~i_types:(seq2 uint8 uint8) ~o_types:uint16 @@ -365,19 +298,19 @@ struct m_ping = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = ping id in + lwt result = ping obj id in OBus_method.return ctx result ); m_action = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = action id in + lwt result = action obj id in OBus_method.return ctx result ); m_reset = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = reset id in + lwt result = reset obj id in OBus_method.return ctx result ); m_get = ( @@ -385,7 +318,7 @@ struct let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in let address = make_readable_register address in - lwt result = get id address in + lwt result = get obj id address in OBus_method.return ctx result ); m_set = ( @@ -393,7 +326,7 @@ struct let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = set id address value in + lwt result = set obj id address value in OBus_method.return ctx result ); m_reg_set = ( @@ -401,7 +334,7 @@ struct let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = reg_set id address value in + lwt result = reg_set obj id address value in OBus_method.return ctx result ); m_goto = ( @@ -410,106 +343,105 @@ struct let position = Int32.to_int position in let speed = Int32.to_int speed in let mode = make_exec_mode mode in - lwt result = goto id position speed mode in + lwt result = goto obj id position speed mode in OBus_method.return ctx result ); m_config = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = config id in + lwt result = config obj id in OBus_method.return ctx result ); m_get_position = ( fun ctx obj id -> let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_position id in + lwt result = get_position obj id in OBus_method.return ctx result ); m_get_speed = ( fun ctx obj id -> let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_speed id in + lwt result = get_speed obj id in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AX12") in + OBus_object.attach obus card; + obus end module RX64 = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Dynamixel - let obus = OBus_object.make (device_path "RX64") + let ping (card : Krobot_dynamixel_over_serial.device) ~id = + card#ping id - let ping ~id = - Dev.rx64#ping id - - let action ~id = + let action (card : Krobot_dynamixel_over_serial.device) ~id = fail (Failure "not implemented") - let reset ~id = - Dev.rx64#reset id + let reset (card : Krobot_dynamixel_over_serial.device) ~id = + card#reset id - let get ~id ~address = + let get (card : Krobot_dynamixel_over_serial.device) ~id ~address = match address with | #dynamixel_register8 -> - lwt data = Dev.rx64#read id (Int32.to_int (cast_readable_register address)) 1 in + lwt data = card#read id (Int32.to_int (cast_readable_register address)) 1 in return (int_of_char data.[0]) | #dynamixel_register16 -> - lwt data = Dev.rx64#read id (Int32.to_int (cast_readable_register address)) 2 in + lwt data = card#read id (Int32.to_int (cast_readable_register address)) 2 in return (((int_of_char data.[1]) lsl 8) lor (int_of_char data.[0])) - let set ~id ~address ~value = + let set (card : Krobot_dynamixel_over_serial.device) ~id ~address ~value = match address with | #dynamixel_register8 -> let data = String.create 1 in data.[0] <- char_of_int value; - Dev.rx64#write id (Int32.to_int (cast_writable_register address)) data + card#write id (Int32.to_int (cast_writable_register address)) data | #dynamixel_register16 -> let data = String.create 2 in data.[0] <- char_of_int (value land 0xff); data.[1] <- char_of_int ((value lsr 8) land 0xff); - Dev.rx64#write id (Int32.to_int (cast_writable_register address)) data + card#write id (Int32.to_int (cast_writable_register address)) data - let reg_set ~id ~address ~value = + let reg_set (card : Krobot_dynamixel_over_serial.device) ~id ~address ~value = fail (Failure "not implemented") - let goto ~id ~position ~speed ~mode = - lwt () = set id `Moving_speed speed in - set id `Goal_position position + let goto (card : Krobot_dynamixel_over_serial.device) ~id ~position ~speed ~mode = + lwt () = set card ~id ~address:`Moving_speed ~value:speed in + set card ~id ~address:`Goal_position ~value:position - let config ~id = + let config (card : Krobot_dynamixel_over_serial.device) ~id = fail (Failure "not implemented") - let get_position ~id = - get id `Present_position + let get_position (card : Krobot_dynamixel_over_serial.device) ~id = + get card ~id ~address:`Present_position - let get_speed ~id = - get id `Present_speed + let get_speed (card : Krobot_dynamixel_over_serial.device) ~id = + get card ~id ~address:`Present_speed let interface = make { m_ping = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = ping id in + lwt result = ping obj ~id in OBus_method.return ctx result ); m_action = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = action id in + lwt result = action obj ~id in OBus_method.return ctx result ); m_reset = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = reset id in + lwt result = reset obj ~id in OBus_method.return ctx result ); m_get = ( @@ -517,7 +449,7 @@ struct let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in let address = make_readable_register address in - lwt result = get id address in + lwt result = get obj ~id ~address in OBus_method.return ctx result ); m_set = ( @@ -525,7 +457,7 @@ struct let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = set id address value in + lwt result = set obj ~id ~address ~value in OBus_method.return ctx result ); m_reg_set = ( @@ -533,7 +465,7 @@ struct let id = Int32.to_int id in let address = make_writable_register address in let value = Int32.to_int value in - lwt result = reg_set id address value in + lwt result = reg_set obj ~id ~address ~value in OBus_method.return ctx result ); m_goto = ( @@ -542,44 +474,43 @@ struct let position = Int32.to_int position in let speed = Int32.to_int speed in let mode = make_exec_mode mode in - lwt result = goto id position speed mode in + lwt result = goto obj ~id ~position ~speed ~mode in OBus_method.return ctx result ); m_config = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = config id in + lwt result = config obj id in OBus_method.return ctx result ); m_get_position = ( fun ctx obj id -> let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_position id in + lwt result = get_position obj ~id in OBus_method.return ctx result ); m_get_speed = ( fun ctx obj id -> let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get_speed id in + lwt result = get_speed obj ~id in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "RX64") in + OBus_object.attach obus card; + obus end module Infrareds = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Infrareds - let obus = OBus_object.make (device_path "Infrareds") - - let get () = - Dev.interface#call + let get (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(array 4 uint32) @@ -589,54 +520,53 @@ struct make { m_get = ( fun ctx obj () -> - lwt result = get () in + lwt result = get obj in OBus_method.return ctx (List.map Int32.of_int (Array.to_list result)) ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make (card : Krobot_usb.device) = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Infrareds") in + OBus_object.attach obus card; + obus end module LCD = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_LCD - let obus = OBus_object.make (device_path "LCD") - - let clear () = - Dev.interface#call_no_reply + let clear (card : Krobot_usb.device) () = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:uint8 PcInterface.lcd_clear - let set_cursor ~state = - Dev.interface#call_no_reply + let set_cursor (card : Krobot_usb.device) ~state = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:uint8 (if state then PcInterface.lcd_cursor_on else PcInterface.lcd_cursor_off) - let set_backlight ~state = - Dev.interface#call_no_reply + let set_backlight (card : Krobot_usb.device) ~state = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:uint8 (if state then PcInterface.lcd_backlight_on else PcInterface.lcd_backlight_off) - let goto ~line ~column = - Dev.interface#call_no_reply + let goto (card : Krobot_usb.device) ~line ~column = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.lcd_goto_pos, column, line) - let write ~text = - Dev.interface#call_no_reply + let write (card : Krobot_usb.device) ~text = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:(seq2 uint8 string) (PcInterface.lcd_write, text) - let write_line ~line ~text = - Dev.interface#call_no_reply + let write_line (card : Krobot_usb.device) ~line ~text = + card#call_no_reply ~command:PcInterface.cmd_lcd ~i_types:(seq3 uint8 uint8 string) (PcInterface.lcd_write_line, line, text) @@ -645,53 +575,52 @@ struct make { m_clear = ( fun ctx obj () -> - lwt result = clear () in + lwt result = clear obj () in OBus_method.return ctx result ); m_set_cursor = ( fun ctx obj state -> - lwt result = set_cursor state in + lwt result = set_cursor obj state in OBus_method.return ctx result ); m_set_backlight = ( fun ctx obj state -> - lwt result = set_backlight state in + lwt result = set_backlight obj state in OBus_method.return ctx result ); m_goto = ( fun ctx obj (line, column) -> let line = Int32.to_int line in let column = Int32.to_int column in - lwt result = goto line column in + lwt result = goto obj line column in OBus_method.return ctx result ); m_write = ( fun ctx obj text -> - lwt result = write text in + lwt result = write obj text in OBus_method.return ctx result ); m_write_line = ( fun ctx obj (line, text) -> let line = Int32.to_int line in - lwt result = write_line line text in + lwt result = write_line obj line text in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "LCD") in + OBus_object.attach obus card; + obus end module Logic_sensors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_LogicSensors - let obus = OBus_object.make (device_path "LogicSensors") - - let get_state () = + let get_state (card : Krobot_usb.device) () = lwt bits = - Dev.sensors#call + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint16 @@ -709,71 +638,70 @@ struct make { m_get_state = ( fun ctx obj () -> - lwt result = get_state () in + lwt result = get_state obj () in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "LogicSensors") in + OBus_object.attach obus card; + obus end module Motors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Motors - let obus = OBus_object.make (device_path "Motors") - let map_dist x = truncate (x *. 1000.0) let map_angle x = truncate (x *. 180.0 /. Krobot_geometry.pi) let thread = ref (return ()) (* Thread waiting for movement completion or timeout expiration *) - let wait_for_completion () = + let wait_for_completion (card : Krobot_usb.device) = let w = lwt _ = Lwt_event.next (React.E.filter (fun (cmd, data) -> cmd = PcInterface.traj_completed) - Dev.motors#commands) + card#commands) in return () in thread := w; w - let move ~distance ~velocity ~acceleration = + let move (card : Krobot_usb.device) ~distance ~velocity ~acceleration = cancel !thread; lwt () = - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq4 uint8 int16 int16 int16) ((if distance >= 0.0 then PcInterface.traj_forward else PcInterface.traj_backward), abs (map_dist distance), map_dist velocity, map_dist acceleration) in - wait_for_completion () + wait_for_completion card - let turn ~angle ~velocity ~acceleration = + let turn (card : Krobot_usb.device) ~angle ~velocity ~acceleration = cancel !thread; lwt () = - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq4 uint8 int16 int16 int16) ((if angle >= 0.0 then PcInterface.traj_tl else PcInterface.traj_tr), abs (map_angle angle), map_dist velocity, map_dist acceleration) in - wait_for_completion () + wait_for_completion card let code_of_motor = function | `Both -> PcInterface.motor_both | `Left -> PcInterface.motor_left | `Right -> PcInterface.motor_right - let stop ~motor ~mode = + let stop (card : Krobot_usb.device) ~motor ~mode = cancel !thread; - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq3 uint8 uint8 uint8) (PcInterface.traj_stop, @@ -783,31 +711,31 @@ struct | `Abrupt -> PcInterface.traj_stop_abrupt | `Smooth -> PcInterface.traj_stop_smooth)) - let set_velocities ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = + let set_velocities (card : Krobot_usb.device) ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = cancel !thread; - thread := (Lwt_unix.sleep duration >> stop `Both `Off); + thread := (Lwt_unix.sleep duration >> stop card `Both `Off); let sign x = if x < 0.0 then -1 else if x > 0.0 then 1 else 0 in lwt () = - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq5 uint8 uint8 int16 int16 int8) (PcInterface.traj_new_velocity, code_of_motor `Right, abs (map_dist velocity_r), map_dist acceleration_r, sign velocity_r) and () = - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq5 uint8 uint8 int16 int16 int8) (PcInterface.traj_new_velocity, code_of_motor `Left, abs (map_dist velocity_l), map_dist acceleration_l, sign velocity_l) in - Dev.motors#call_no_reply + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq2 uint8 uint8) (PcInterface.traj_start, code_of_motor `Both) - let get_current_velocities () = + let get_current_velocities (card : Krobot_usb.device) = lwt vr, vl = - Dev.motors#call + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 int32 int32) @@ -816,9 +744,9 @@ struct return (float_of_int vr /. 1000.0, float_of_int vl /. 1000.0) - let get_current_positions () = + let get_current_positions (card : Krobot_usb.device) = lwt pr, pl = - Dev.motors#call + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(seq2 int32 int32) @@ -827,15 +755,15 @@ struct return (float_of_int pr /. 1000.0, float_of_int pl /. 1000.0) - let get_config () = - Dev.motors#call + let get_config (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_traj ~i_types:uint8 ~o_types:(seq8 uint16 uint16 uint16 uint16 uint16 uint16 uint16 uint16) PcInterface.traj_read_config - let set_config ~motor kp ~ki ~kd ~li = - Dev.motors#call_no_reply + let set_config (card : Krobot_usb.device) ~motor kp ~ki ~kd ~li = + card#call_no_reply ~command:PcInterface.cmd_traj ~i_types:(seq6 uint8 uint8 uint16 uint16 uint16 uint16) (PcInterface.traj_config, code_of_motor motor, @@ -845,34 +773,34 @@ struct make { m_move = ( fun ctx obj (distance, velocity, acceleration) -> - lwt result = move distance velocity acceleration in + lwt result = move obj distance velocity acceleration in OBus_method.return ctx result ); m_turn = ( fun ctx obj (angle, velocity, acceleration) -> - lwt result = turn angle velocity acceleration in + lwt result = turn obj angle velocity acceleration in OBus_method.return ctx result ); m_stop = ( fun ctx obj (motor, mode) -> let motor = make_motor motor in let mode = make_stop_mode mode in - lwt result = stop motor mode in + lwt result = stop obj motor mode in OBus_method.return ctx result ); m_set_velocities = ( fun ctx obj (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) -> - lwt result = set_velocities velocity_r acceleration_r velocity_l acceleration_l duration in + lwt result = set_velocities obj velocity_r acceleration_r velocity_l acceleration_l duration in OBus_method.return ctx result ); m_get_current_velocities = ( fun ctx obj () -> - lwt result = get_current_velocities () in + lwt result = get_current_velocities obj in OBus_method.return ctx result ); m_get_current_positions = ( fun ctx obj () -> - lwt result = get_current_positions () in + lwt result = get_current_positions obj in OBus_method.return ctx result ); m_get_config = ( @@ -891,7 +819,7 @@ struct (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l)) ctx in - lwt result = get_config () in + lwt result = get_config obj in OBus_method.return ctx result ); m_set_config = ( @@ -901,53 +829,52 @@ struct let ki = Int32.to_int ki in let kd = Int32.to_int kd in let li = Int32.to_int li in - lwt result = set_config motor kp ki kd li in + lwt result = set_config obj motor kp ki kd li in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Motors") in + OBus_object.attach obus card; + obus end module Power = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Power - let obus = OBus_object.make (device_path "Power") - type battery_state = type_battery_state - let set_buzzer_state ~state = - Dev.monitoring#call_no_reply + let set_buzzer_state (card : Krobot_usb.device) ~state = + card#call_no_reply ~command:PcInterface.cmd_set ~i_types:(seq2 uint8 boolean) (PcInterface.set_buzzer_state, state) - let get_cell_voltage () = - Dev.monitoring#call + let get_cell_voltage (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:(array 8 uint16) PcInterface.get_cell_voltage - let get_current () = - Dev.monitoring#call + let get_current (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint32 PcInterface.get_current - let get_power_state () = - Dev.monitoring#call + let get_power_state (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:boolean PcInterface.get_power_state - let get_battery_state () = - Dev.monitoring#call + let get_battery_state (card : Krobot_usb.device) = + card#call ~command:PcInterface.cmd_get ~i_types:uint8 ~o_types:uint8 @@ -957,53 +884,52 @@ struct make { m_set_buzzer_state = ( fun ctx obj state -> - lwt result = set_buzzer_state state in + lwt result = set_buzzer_state obj state in OBus_method.return ctx result ); m_get_cell_voltage = ( fun ctx obj () -> - lwt result = get_cell_voltage () in + lwt result = get_cell_voltage obj in OBus_method.return ctx (List.map Int32.of_int (Array.to_list result)) ); m_get_current = ( fun ctx obj () -> let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_current () in + lwt result = get_current obj in OBus_method.return ctx result ); m_get_power_state = ( fun ctx obj () -> - lwt result = get_power_state () in + lwt result = get_power_state obj in OBus_method.return ctx result ); m_get_battery_state = ( fun ctx obj () -> let ctx = OBus_context.map Int32.of_int ctx in - lwt result = get_battery_state () in + lwt result = get_battery_state obj in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Power") in + OBus_object.attach obus card; + obus end module Range_finders = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_RangeFinders - let obus = OBus_object.make (device_path "RangeFinders") - - let measure ~id = - Dev.sensors#call + let measure (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_usrf ~i_types:(seq2 uint8 uint8) ~o_types:unit (PcInterface.usrf_measure, id) - let get ~id = - Dev.sensors#call + let get (card : Krobot_usb.device) ~id = + card#call ~command:PcInterface.cmd_usrf ~i_types:(seq2 uint8 uint8) ~o_types:uint16 @@ -1014,21 +940,22 @@ struct m_measure = ( fun ctx obj id -> let id = Int32.to_int id in - lwt result = measure id in + lwt result = measure obj id in OBus_method.return ctx result ); m_get = ( fun ctx obj id -> let ctx = OBus_context.map Int32.of_int ctx in let id = Int32.to_int id in - lwt result = get id in + lwt result = get obj id in OBus_method.return ctx result ); } - let () = - OBus_object.attach obus (); - OBus_object.add_interfaces obus [interface] + let make card = + let obus = OBus_object.make ~interfaces:[interface] (device_path "RangeFinders") in + OBus_object.attach obus card; + obus end module Card = @@ -1127,32 +1054,84 @@ struct end (* +-----------------------------------------------------------------+ - | Actions when cars come up/down | + | Entry point | +-----------------------------------------------------------------+ *) -let () = +let init bus = + (* Open cards *) + let interface = + new Krobot_usb.device + ~name:"Interface" + ~vendor_id:PcInterface.usb_vid + ~product_id:PcInterface.usb_pid_robot_interface + () + and monitoring = + new Krobot_usb.device + ~name:"Monitoring" + ~vendor_id:PcInterface.usb_vid + ~product_id:PcInterface.usb_pid_battery_monitoring + () + and sensors = + new Krobot_usb.device + ~name:"Sensors" + ~vendor_id:PcInterface.usb_vid + ~product_id:PcInterface.usb_pid_sensor_interface + () + and motors = + new Krobot_usb.device + ~name:"Motors" + ~vendor_id:PcInterface.usb_vid + ~product_id:PcInterface.usb_pid_motor_controller + () + and rx64 = + new Krobot_dynamixel_over_serial.device + ~name:"RX64" + ~path:"/dev/ttyS0" + ~rate:57600 + () + in + + (* Closes all devices on exit *) + Lwt_main.at_exit + (fun () -> + Lwt_list.iter_p + (fun device -> + try_lwt + device#close + with exn -> + Lwt_log.error_f ~section ~exn "failed to close device %S" device#name) + [ + (interface :> Krobot_device.t); + (monitoring :> Krobot_device.t); + (sensors :> Krobot_device.t); + (motors :> Krobot_device.t); + (rx64 :> Krobot_device.t); + ]); + + (* Actions when the interface card come up/down *) Lwt_signal.always_notify_s (function | `Up -> (* The first command on ax12 always fails, so we trigger it now: *) - lwt _ = AX12.get_position ~id:1 in + lwt _ = AX12.get_position interface ~id:1 in return () | `Down -> return ()) - Dev.interface#state; + interface#state; + (* Actions when the motor card come up/down *) Lwt_signal.always_notify_s (function | `Up -> (* Initializes motors *) lwt () = - Dev.motors#call_no_reply + motors#call_no_reply ~command:PcInterface.cmd_motor ~i_types:(seq2 uint8 uint8) (PcInterface.motor_enable, Motors.code_of_motor `Both) and () = - Dev.motors#call_no_reply + motors#call_no_reply ~command:PcInterface.cmd_traj ~i_types:uint8 PcInterface.traj_init @@ -1160,31 +1139,26 @@ let () = return () | `Down -> return ()) - Dev.motors#state + motors#state; -(* +-----------------------------------------------------------------+ - | Entry point | - +-----------------------------------------------------------------+ *) - -let init bus = (* Exports objects on the message bus *) - OBus_object.export bus Analogic_motor.obus; - OBus_object.export bus Analogic_servos.obus; - OBus_object.export bus Compass.obus; - OBus_object.export bus AX12.obus; - OBus_object.export bus RX64.obus; - OBus_object.export bus Infrareds.obus; - OBus_object.export bus LCD.obus; - OBus_object.export bus Logic_sensors.obus; - OBus_object.export bus Motors.obus; - OBus_object.export bus Power.obus; - OBus_object.export bus Range_finders.obus; - - let card_interface = Card.make Dev.interface in - let card_sensors = Card.make Dev.sensors in - let card_motors = Card.make Dev.motors in - let card_monitoring = Card.make Dev.monitoring in - let card_rx64 = Card.make Dev.rx64 in + OBus_object.export bus (Analogic_motor.make interface); + OBus_object.export bus (Analogic_servos.make interface); + OBus_object.export bus (Compass.make interface); + OBus_object.export bus (AX12.make interface); + OBus_object.export bus (LCD.make interface); + OBus_object.export bus (Infrareds.make interface); + OBus_object.export bus (Motors.make motors); + OBus_object.export bus (Power.make monitoring); + OBus_object.export bus (Logic_sensors.make sensors); + OBus_object.export bus (Range_finders.make sensors); + OBus_object.export bus (RX64.make rx64); + + let card_interface = Card.make interface in + let card_sensors = Card.make sensors in + let card_motors = Card.make motors in + let card_monitoring = Card.make monitoring in + let card_rx64 = Card.make rx64 in OBus_object.add_interfaces card_interface [USB_card.interface]; OBus_object.add_interfaces card_sensors [USB_card.interface]; diff --git a/info/control/driver/krobot_usb.ml b/info/control/driver/krobot_usb.ml index 68d9b66..c13de1f 100644 --- a/info/control/driver/krobot_usb.ml +++ b/info/control/driver/krobot_usb.ml @@ -330,6 +330,7 @@ object(self) (* USB stuff *) lwt () = USB.reset_device h in kernel_driver_active <- USB.kernel_driver_active h 0; + if kernel_driver_active then USB.detach_kernel_driver h 0; lwt () = USB.set_configuration h 1 in lwt () = USB.claim_interface h 0 in @@ -361,5 +362,5 @@ object(self) lwt () = Lwt_unix.sleep 0.1 in loop () in - ignore (Lwt_unix.yield () >> loop ()) + ignore (loop ()) end diff --git a/info/control/lib-krobot/krobot_sensors.ml b/info/control/lib-krobot/krobot_sensors.ml index 5fa2963..fa80380 100644 --- a/info/control/lib-krobot/krobot_sensors.ml +++ b/info/control/lib-krobot/krobot_sensors.ml @@ -13,6 +13,13 @@ open Krobot_dbus_sensors.Fr_krobot_Service_Sensors let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Sensors") ["fr"; "Krobot"; "Services"; "Sensors"] +type color = type_color + +let color krobot = + OBus_property.map_r + make_color + (OBus_property.make p_color (proxy krobot)) + let infrareds krobot = OBus_property.map_r (fun x -> Array.of_list (List.map Int32.to_int x)) diff --git a/info/control/lib-krobot/krobot_sensors.mli b/info/control/lib-krobot/krobot_sensors.mli index ad226f5..52b4c26 100644 --- a/info/control/lib-krobot/krobot_sensors.mli +++ b/info/control/lib-krobot/krobot_sensors.mli @@ -7,6 +7,10 @@ * This file is a part of [kro]bot. *) +type color = + [ `Blue + | `Yellow ] +val color : Krobot.t -> (color, [ `readable ]) OBus_property.t val infrareds : Krobot.t -> (int array, [ `readable ]) OBus_property.t val logic_sensors : Krobot.t -> (bool array, [ `readable ]) OBus_property.t val range_finders : Krobot.t -> (int array, [ `readable ]) OBus_property.t diff --git a/info/control/protocol/krobot_dbus_sensors.obus b/info/control/protocol/krobot_dbus_sensors.obus index 917dd34..c500252 100644 --- a/info/control/protocol/krobot_dbus_sensors.obus +++ b/info/control/protocol/krobot_dbus_sensors.obus @@ -11,6 +11,19 @@ interface fr.krobot.Service.Sensors { (** + * Colors + *) + enum color : uint32 { + 0: blue + 1: yellow + } + + (** + * The selected color. + *) + property_r color : color + + (** * Property holding the current values measured by the infrareds. *) property_r infrareds : int32 array diff --git a/info/control/services/krobot_service_sensors.ml b/info/control/services/krobot_service_sensors.ml index cfb8937..18b1a5e 100644 --- a/info/control/services/krobot_service_sensors.ml +++ b/info/control/services/krobot_service_sensors.ml @@ -15,14 +15,13 @@ type t = { obus : t OBus_object.t; krobot : Krobot.t; + color : [ `Yellow | `Blue ] React.signal; infrareds : int list React.signal; logic_sensors : bool list React.signal; range_finders : int list React.signal; } -let delay = 0.05 - -let poll f initial = +let poll ?(delay=0.05) f initial = React.S.hold initial (Lwt_event.from (fun () -> @@ -37,6 +36,7 @@ let poll f initial = let interface = make { + p_color = (fun obj -> React.S.map cast_color obj.color); p_infrareds = (fun obj -> React.S.map (List.map Int32.of_int) obj.infrareds); p_logic_sensors = (fun obj -> obj.logic_sensors); p_range_finders = (fun obj -> React.S.map (List.map Int32.of_int) obj.range_finders); @@ -47,6 +47,15 @@ let init bus = let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Sensors"]; krobot = krobot; + color = + poll ~delay:1.0 + (fun () -> + lwt ports = Krobot_driver.USB_card.get_ports_state (Krobot_driver.card_interface krobot) in + if List.nth ports 3 land 64 = 0 then + return `Yellow + else + return `Blue) + `Blue; infrareds = poll (fun () -> Infrareds.get (infrareds krobot)) hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-28 09:39:35
|
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 f11dd0beb9af9ef5fc42fe89901fffd043fae34e (commit) from 45151d092292ca517e0b44209ac325493336d273 (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 f11dd0beb9af9ef5fc42fe89901fffd043fae34e Author: Jérémie Dimino <je...@di...> Date: Fri May 28 11:36:55 2010 +0200 added some commands with bash-completion ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/commands/krobot_move.ml b/info/control/clients/commands/krobot_move.ml new file mode 100644 index 0000000..de01983 --- /dev/null +++ b/info/control/clients/commands/krobot_move.ml @@ -0,0 +1,45 @@ +(* + * krobot_move.ml + * -------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +open Lwt + +lwt () = + Krobot_arg.register [ + "-distance", `Float, "distance to move, in meters"; + "-velocity", `Float, "velocity during the move"; + "-acceleration", `Float, "acceleration during the move"; + ]; + Krobot_arg.parse (); + + lwt krobot = Krobot.create () in + lwt result, distance = + Krobot_motors.move krobot + (match Krobot_arg.float "-distance" with + | Some d -> d + | None -> 0.1) + (match Krobot_arg.float "-velocity" with + | Some v -> v + | None -> 0.4) + (match Krobot_arg.float "-acceleration" with + | Some a -> a + | None -> 0.8) + in + lwt () = Lwt_io.printlf "%f" distance in + match result with + | `Success -> + exit 0 + | `Stopped -> + lwt () = Lwt_log.warning "movemenet stopped" in + exit 1 + | `Inhibited -> + lwt () = Lwt_log.warning "movemenet inhibited" in + exit 2 + | `Replaced -> + lwt () = Lwt_log.warning "movemenet replaced" in + exit 3 diff --git a/info/control/clients/commands/krobot_turn.ml b/info/control/clients/commands/krobot_turn.ml new file mode 100644 index 0000000..35764f7 --- /dev/null +++ b/info/control/clients/commands/krobot_turn.ml @@ -0,0 +1,45 @@ +(* + * krobot_turn.ml + * -------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +open Lwt + +lwt () = + Krobot_arg.register [ + "-angle", `Float, "angle to move, in radiants"; + "-velocity", `Float, "velocity during the move"; + "-acceleration", `Float, "acceleration during the move"; + ]; + Krobot_arg.parse (); + + lwt krobot = Krobot.create () in + lwt result, distance = + Krobot_motors.turn krobot + (match Krobot_arg.float "-angle" with + | Some d -> d + | None -> 0.0) + (match Krobot_arg.float "-velocity" with + | Some v -> v + | None -> 0.4) + (match Krobot_arg.float "-acceleration" with + | Some a -> a + | None -> 0.8) + in + lwt () = Lwt_io.printlf "%f" distance in + match result with + | `Success -> + exit 10 + | `Stopped -> + lwt () = Lwt_log.warning "movemenet stopped" in + exit 11 + | `Inhibited -> + lwt () = Lwt_log.warning "movemenet inhibited" in + exit 12 + | `Replaced -> + lwt () = Lwt_log.warning "movemenet replaced" in + exit 13 diff --git a/info/control/common/krobot_arg.ml b/info/control/common/krobot_arg.ml index ab21870..4d1f90c 100644 --- a/info/control/common/krobot_arg.ml +++ b/info/control/common/krobot_arg.ml @@ -134,8 +134,17 @@ let help () = exit 0 let parse () = + let complete = ref false in try - Arg.parse_argv ~current:(ref 0) Sys.argv !std_args ignore "" + Arg.parse_argv ~current:(ref 0) Sys.argv (("-complete", Arg.Set complete, "") :: !std_args) ignore ""; + if !complete then begin + print_endline + (String.concat " " + (List.map + (fun (section, name, kind, value, doc) -> name) + !ext_args)); + exit 0 + end; with | Arg.Help msg -> help () diff --git a/info/control/install-programs.sh b/info/control/install-programs.sh index 867b9a3..053af09 100644 --- a/info/control/install-programs.sh +++ b/info/control/install-programs.sh @@ -13,7 +13,7 @@ else PREFIX="$1" fi -PROGRAMS=$(echo _build/{services,driver,clients,tools,usb-tools}/*.best _build/{services,driver,clients,tools,usb-tools}/**/*.best) +PROGRAMS=$(echo _build/{services,driver,clients,tools,usb-tools}/{*.best,**/*.best}) for prog in $PROGRAMS; do if [ -f $prog ]; then @@ -26,6 +26,8 @@ done mkdir -pv "$PREFIX/share/krobot/services" +install -vm 0644 utils/bash_completion "$PREFIX/share/krobot/bash_completion" + function instantiate { local destination="$PREFIX/share/krobot/$2" echo "Creation of $destination" diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index 390f08c..2c1a19f 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -83,6 +83,10 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, (true, "clients/krobot_write_lcd.best"); (true, "clients/krobot_controller.best"); + (* Commands *) + (true, "clients/commands/krobot_move.best"); + (true, "clients/commands/krobot_turn.best"); + (* Services *) (true, "services/krobot_service_claws.best"); (true, "services/krobot_service_motors.best"); @@ -177,6 +181,7 @@ let _ = Pathname.define_context "usb-tools" ["common"; "driver"]; Pathname.define_context "lib-krobot" ["protocol"; "common"]; Pathname.define_context "clients" ["protocol"; "common"; "lib-krobot"]; + Pathname.define_context "clients/commands" ["protocol"; "common"; "lib-krobot"]; Pathname.define_context "services" ["protocol"; "common"; "lib-krobot"]; Pathname.define_context "services/stoppers" ["protocol"; "common"; "lib-krobot"]; Pathname.define_context "tests" ["protocol"; "common"; "lib-krobot"]; diff --git a/info/control/utils/bash_completion b/info/control/utils/bash_completion new file mode 100644 index 0000000..8936caa --- /dev/null +++ b/info/control/utils/bash_completion @@ -0,0 +1,36 @@ +# -*- shell-script -*- + +_krobot_command() +{ + local cur + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + COMPREPLY=($(compgen -W "$($1 -complete)" -- $cur)) +} + +COMMANDS=" +driver +move +turn +controller +jack +joystick +recorder +record-infrared +servos-control +write-lcd +service-claws +service-gate +service-grip +service-motors +service-sensors +service-turret +infrareds-stop +range-finders-stop +" + +for cmd in $COMMANDS; do + complete -F _krobot_command krobot-$cmd +done hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-28 09:09:37
|
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 45151d092292ca517e0b44209ac325493336d273 (commit) from 78136a77b4f95e9153bb2c4eafcc160db781422a (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 45151d092292ca517e0b44209ac325493336d273 Author: Jérémie Dimino <je...@di...> Date: Fri May 28 11:09:08 2010 +0200 better daemons intialisation ----------------------------------------------------------------------- Changes: diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index d134136..08e0c2d 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -7,7 +7,7 @@ * This file is a part of [kro]bot. *) -let section = Lwt_log.Section.make "main" +let section = Lwt_log.Section.make "" open Lwt open Krobot_dbus_daemon.Fr_krobot_Daemon @@ -24,8 +24,6 @@ module Server = struct type t = { obus : t OBus_object.t; - close : unit -> unit Lwt.t; - name : OBus_name.bus; mutable quit : bool; quit_waiter : unit Lwt.t; quit_wakener : unit Lwt.u; @@ -41,23 +39,15 @@ struct end else begin daemon.quit <- true; lwt () = Lwt_log.info ~section "shutdown method invoked" in - lwt () = daemon.close () in - lwt () = - try_lwt - OBus_bus.release_name (OBus_context.connection context) daemon.name >|= ignore - with exn -> - Lwt_log.error_f ~section ~exn "failed to release name %S" daemon.name - in lwt _ = OBus_method.return context () in wakeup daemon.quit_wakener (); - lwt () = Lwt_log.info ~section "exiting" in exit 0 end let interface = make { m_shutdown = (fun context obj () -> shutdown obj context) } end -let init ~desc ~name ?(close=return) () = +let start ~desc ~name init = Krobot_arg.register ~section:"Daemon" [ ("-no-fork", `Flag, "do not daemonize"); ("-kill", `Flag, Printf.sprintf "kill any running %s service and exit" desc); @@ -68,24 +58,23 @@ let init ~desc ~name ?(close=return) () = lwt bus = Krobot_dbus.open_bus () in lwt () = - try_lwt - lwt owner = OBus_bus.get_name_owner bus name in - lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in - shutdown (OBus_peer.make bus owner) - with OBus_error.DBus(OBus_bus.Name_has_no_owner, _, _) -> + if Krobot_arg.flag "-kill" then begin + try_lwt + lwt owner = OBus_bus.get_name_owner bus name in + lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in + shutdown (OBus_peer.make bus owner) + with OBus_error.DBus(OBus_bus.Name_has_no_owner, _, _) -> + return () + finally + exit 0 + end else return () in - if Krobot_arg.flag "-kill" then exit 0; - - lwt () = - OBus_bus.request_name bus ~allow_replacement:true ~replace_existing:true name >>= function - | `Primary_owner -> - return () - | _ -> - lwt () = Lwt_log.error_f ~section "cannot get the %S name, exiting" name in - exit 1 - in + (* Exit the program when we lost the name *) + Lwt_event.always_notify + (fun lost_name -> if name = lost_name then exit 0) + (OBus_signal.event (OBus_bus.name_lost bus)); lwt () = if Krobot_arg.flag "-no-fork" then @@ -100,8 +89,6 @@ let init ~desc ~name ?(close=return) () = let quit_waiter, quit_wakener = wait () in let daemon = { Server.obus = OBus_object.make ~interfaces:[Server.interface] path; - Server.close = close; - Server.name = name; Server.quit = false; Server.quit_waiter = quit_waiter; Server.quit_wakener = quit_wakener; @@ -130,4 +117,18 @@ let init ~desc ~name ?(close=return) () = Lwt_log.default := Lwt_log.broadcast [!Lwt_log.default; dbus_logger]; - return bus + (* Does the program specifics initialisation *) + lwt () = init bus in + + (* Request the name once obejct are exported, to avoid race + condition *) + lwt () = + OBus_bus.request_name bus ~allow_replacement:true ~replace_existing:true name >>= function + | `Primary_owner -> + return () + | _ -> + lwt () = Lwt_log.error_f ~section "cannot get the %S name, exiting" name in + exit 1 + in + + fst (wait ()) diff --git a/info/control/common/krobot_daemon.mli b/info/control/common/krobot_daemon.mli index 297a282..5e4c322 100644 --- a/info/control/common/krobot_daemon.mli +++ b/info/control/common/krobot_daemon.mli @@ -20,9 +20,10 @@ val shutdown : OBus_peer.t -> unit Lwt.t (** {6 Running daemons} *) -val init : desc : string -> name : OBus_name.bus -> ?close : (unit -> unit Lwt.t) -> unit -> OBus_bus.t Lwt.t - (** [init ~desc ~name ?close] does common daemon initializations, - request the given bus name, open the robot bus and returns - it. [close] is called when the daemon is remotly shutdown, just - before the reply to the shutdown method is sent, thus preventing - race conditions. *) +val start : desc : string -> name : OBus_name.bus -> (OBus_bus.t -> unit Lwt.t) -> unit Lwt.t + (** [init ~desc ~name init] does common daemon initializations, + request the given bus name, open the robot bus and pass it to + [init]. [init] should do specifics initialisations, like + exporting objects on D-Bus, then return. + + When [name] is lost, the program will be exited with code 0. *) diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index e53e61b..7018b49 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -70,14 +70,17 @@ struct ] end -let close () = - Lwt_list.iter_p - (fun device -> - try_lwt - device#close - with exn -> - Lwt_log.error_f ~section ~exn "failed to close device %S" device#name) - Dev.devices +let () = + (* Closes all devices on exit *) + Lwt_main.at_exit + (fun () -> + Lwt_list.iter_p + (fun device -> + try_lwt + device#close + with exn -> + Lwt_log.error_f ~section ~exn "failed to close device %S" device#name) + Dev.devices) (* +-----------------------------------------------------------------+ | Devices | @@ -1163,9 +1166,7 @@ let () = | Entry point | +-----------------------------------------------------------------+ *) -lwt () = - lwt bus = Krobot_daemon.init ~desc:"krobot driver" ~name:"fr.krobot.Driver" ~close () in - +let init bus = (* Exports objects on the message bus *) OBus_object.export bus Analogic_motor.obus; OBus_object.export bus Analogic_servos.obus; @@ -1196,7 +1197,6 @@ lwt () = OBus_object.export bus card_monitoring; OBus_object.export bus card_rx64; - lwt () = Lwt_log.notice ~section "ready, waiting for requests" in + Lwt_log.notice ~section "ready, waiting for requests" - (* Wait forever *) - fst (wait ()) +lwt () = Krobot_daemon.start ~desc:"krobot driver" ~name:"fr.krobot.Driver" init diff --git a/info/control/services/krobot_service_claws.ml b/info/control/services/krobot_service_claws.ml index 30290ac..ca387ee 100644 --- a/info/control/services/krobot_service_claws.ml +++ b/info/control/services/krobot_service_claws.ml @@ -60,8 +60,7 @@ let interface = ); } -lwt () = - lwt bus = Krobot_daemon.init ~desc:"claws control" ~name:"fr.krobot.Service.Claws" () in +let init bus = lwt krobot = Krobot.create () in let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Claws"]; @@ -69,4 +68,6 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () + +lwt () = Krobot_daemon.start ~desc:"claws control" ~name:"fr.krobot.Service.Claws" init diff --git a/info/control/services/krobot_service_gate.ml b/info/control/services/krobot_service_gate.ml index 008327d..e6053d5 100644 --- a/info/control/services/krobot_service_gate.ml +++ b/info/control/services/krobot_service_gate.ml @@ -68,8 +68,7 @@ let interface = ); } -lwt () = - lwt bus = Krobot_daemon.init ~desc:"gate control" ~name:"fr.krobot.Service.Gate" () in +let init bus = lwt krobot = Krobot.create () in let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Gate"]; @@ -77,4 +76,6 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () + +lwt () = Krobot_daemon.start ~desc:"gate control" ~name:"fr.krobot.Service.Gate" init diff --git a/info/control/services/krobot_service_grip.ml b/info/control/services/krobot_service_grip.ml index f5504c6..f63fc8a 100644 --- a/info/control/services/krobot_service_grip.ml +++ b/info/control/services/krobot_service_grip.ml @@ -117,8 +117,7 @@ let interface = ); } -lwt () = - lwt bus = Krobot_daemon.init ~desc:"grip control" ~name:"fr.krobot.Service.Grip" () in +let init bus = lwt krobot = Krobot.create () in let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Grip"]; @@ -126,4 +125,6 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () + +lwt () = Krobot_daemon.start ~desc:"grip control" ~name:"fr.krobot.Service.Grip" init diff --git a/info/control/services/krobot_service_motors.ml b/info/control/services/krobot_service_motors.ml index 4c8e8da..e0a0222 100644 --- a/info/control/services/krobot_service_motors.ml +++ b/info/control/services/krobot_service_motors.ml @@ -170,8 +170,7 @@ let interface = p_inhibited_backward = (fun obj -> obj.inhibited_backward); } -lwt () = - lwt bus = Krobot_daemon.init ~desc:"motors control" ~name:"fr.krobot.Service.Motors" () in +let init bus = lwt krobot = Krobot.create () in let inhibited_forward, set_inhibited_forward = React.S.create false in let inhibited_backward, set_inhibited_backward = React.S.create false in @@ -189,5 +188,7 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () +lwt () = + Krobot_daemon.start ~desc:"motors control" ~name:"fr.krobot.Service.Motors" init diff --git a/info/control/services/krobot_service_sensors.ml b/info/control/services/krobot_service_sensors.ml index 83c4e38..cfb8937 100644 --- a/info/control/services/krobot_service_sensors.ml +++ b/info/control/services/krobot_service_sensors.ml @@ -42,8 +42,7 @@ let interface = p_range_finders = (fun obj -> React.S.map (List.map Int32.of_int) obj.range_finders); } -lwt () = - lwt bus = Krobot_daemon.init ~desc:"sensors measurement" ~name:"fr.krobot.Service.Sensors" () in +let init bus = lwt krobot = Krobot.create () in let obj = { obus = OBus_object.make ~interfaces:[interface] ["fr"; "krobot"; "Services"; "Sensors"]; @@ -75,4 +74,6 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () + +lwt bus = Krobot_daemon.start ~desc:"sensors measurement" ~name:"fr.krobot.Service.Sensors" init diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index f9a7ba6..f512453 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -115,11 +115,12 @@ let load_data file_name = (fun line -> Scanf.sscanf line "%f %d" (fun position measure -> (position, measure))) (Lwt_io.lines_of_file file_name)) -lwt () = +let () = Krobot_arg.register [ "-data", `String, "file containing calibration data for the infrared"; - ]; - lwt bus = Krobot_daemon.init ~desc:"turret control" ~name:"fr.krobot.Service.Turret" () in + ] + +let init bus = lwt krobot = Krobot.create () in lwt data = load_data (match Krobot_arg.string "-data" with | None -> "/home/krobot/var/infrareds" @@ -131,4 +132,6 @@ lwt () = } in OBus_object.attach obj.obus obj; OBus_object.export bus obj.obus; - fst (wait ()) + return () + +lwt () = Krobot_daemon.start ~desc:"turret control" ~name:"fr.krobot.Service.Turret" init diff --git a/info/control/services/stoppers/krobot_infrareds_stop.ml b/info/control/services/stoppers/krobot_infrareds_stop.ml index 4e1bb85..7441381 100644 --- a/info/control/services/stoppers/krobot_infrareds_stop.ml +++ b/info/control/services/stoppers/krobot_infrareds_stop.ml @@ -34,9 +34,7 @@ let handle_collide krobot infrareds = in return () -lwt () = - lwt bus = Krobot_daemon.init ~desc:"infrared security" ~name:"fr.krobot.Service.Stopper.Infrareds" () in - +let init bus = lwt krobot = Krobot.create () in (* React as soon as possible: *) @@ -50,3 +48,5 @@ lwt () = loop () in loop () + +lwt () = Krobot_daemon.start ~desc:"infrared security" ~name:"fr.krobot.Service.Stopper.Infrareds" init diff --git a/info/control/services/stoppers/krobot_range_finders_stop.ml b/info/control/services/stoppers/krobot_range_finders_stop.ml index 8a05cde..a2ae9af 100644 --- a/info/control/services/stoppers/krobot_range_finders_stop.ml +++ b/info/control/services/stoppers/krobot_range_finders_stop.ml @@ -31,9 +31,7 @@ let handle_collide krobot range_finders = in return () -lwt () = - lwt bus = Krobot_daemon.init ~desc:"range-finders security" ~name:"fr.krobot.Service.Stopper.RangeFinders" () in - +let init bus = lwt krobot = Krobot.create () in (* React as soon as possible: *) @@ -47,3 +45,5 @@ lwt () = loop () in loop () + +lwt () = Krobot_daemon.start ~desc:"range-finders security" ~name:"fr.krobot.Service.Stopper.RangeFinders" init hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-28 08:07:54
|
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 78136a77b4f95e9153bb2c4eafcc160db781422a (commit) via ef29f1d3940dee8047b6c00e5f2cb324b8f487e4 (commit) via 2dc9d263868d40b000f658821c0593b6f0850127 (commit) from 6363c8caf4672b21a6f7197a8a01e3bbd75f61af (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 78136a77b4f95e9153bb2c4eafcc160db781422a Author: Jérémie Dimino <je...@di...> Date: Fri May 28 10:07:18 2010 +0200 enable service auto-starting commit ef29f1d3940dee8047b6c00e5f2cb324b8f487e4 Author: Jérémie Dimino <je...@di...> Date: Fri May 28 09:13:40 2010 +0200 typo commit 2dc9d263868d40b000f658821c0593b6f0850127 Author: Jérémie Dimino <je...@di...> Date: Fri May 28 09:13:11 2010 +0200 display logs comming from daemons in the controller ----------------------------------------------------------------------- Changes: diff --git a/info/control/Makefile b/info/control/Makefile index 9f95f4a..5c9de2e 100644 --- a/info/control/Makefile +++ b/info/control/Makefile @@ -40,6 +40,7 @@ install: uninstall: $(OF) remove krobot rm -vf $(PREFIX)/bin/krobot-* + rm -rvf $(PREFIX)/share/krobot .PHONY: reinstall reinstall: uninstall install diff --git a/info/control/bus.conf b/info/control/bus.conf deleted file mode 100644 index 080136b..0000000 --- a/info/control/bus.conf +++ /dev/null @@ -1,31 +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> - - <!-- 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/control/clients/krobot_controller.ml b/info/control/clients/krobot_controller.ml index c49811e..ff57096 100644 --- a/info/control/clients/krobot_controller.ml +++ b/info/control/clients/krobot_controller.ml @@ -495,6 +495,15 @@ lwt () = (* Redraw the screen when the state change *) Lwt_signal.always_notify_s draw state; + (* Display log comming from daemons *) + let daemons = OBus_proxy.make (OBus_peer.anonymous bus) ["fr"; "krobot"; "Daemon"] in + Lwt_event.always_notify + (fun msg -> log_add_line [text msg]) + (OBus_signal.event + (OBus_signal.connect + Krobot_dbus_daemon.Fr_krobot_Daemon.s_log + daemons)); + lwt history = Lwt_read_line.load_history history_file_name in set_engine_state (Engine.init history); diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index 87348f1..d134136 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -69,9 +69,10 @@ let init ~desc ~name ?(close=return) () = lwt () = try_lwt - lwt () = Lwt_log.info_f ~section "killing any running %s service" desc in - shutdown (OBus_peer.make bus name) - with OBus_error.DBus((OBus_bus.Service_unknown | OBus_error.No_reply), _, _) -> + lwt owner = OBus_bus.get_name_owner bus name in + lwt () = Lwt_log.info_f ~section "killing the running %s service" desc in + shutdown (OBus_peer.make bus owner) + with OBus_error.DBus(OBus_bus.Name_has_no_owner, _, _) -> return () in diff --git a/info/control/dbus-conf/bus.conf.in b/info/control/dbus-conf/bus.conf.in new file mode 100644 index 0000000..d585f3c --- /dev/null +++ b/info/control/dbus-conf/bus.conf.in @@ -0,0 +1,34 @@ +<!-- 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>@PREFIX@/share/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/control/dbus-conf/services/fr.krobot.Driver.service.in b/info/control/dbus-conf/services/fr.krobot.Driver.service.in new file mode 100644 index 0000000..4b0240a --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Driver.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Driver +Exec=@PREFIX@/bin/krobot-driver diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Claws.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Claws.service.in new file mode 100644 index 0000000..d403047 --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Claws.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Claws +Exec=@PREFIX@/bin/krobot-service-claws diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Gate.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Gate.service.in new file mode 100644 index 0000000..cc63742 --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Gate.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Gate +Exec=@PREFIX@/bin/krobot-service-gate diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Grip.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Grip.service.in new file mode 100644 index 0000000..202e823 --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Grip.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Grip +Exec=@PREFIX@/bin/krobot-service-grip diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Motors.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Motors.service.in new file mode 100644 index 0000000..df7f617 --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Motors.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Motors +Exec=@PREFIX@/bin/krobot-service-motors diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Sensors.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Sensors.service.in new file mode 100644 index 0000000..249b748 --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Sensors.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Sensors +Exec=@PREFIX@/bin/krobot-service-sensors diff --git a/info/control/dbus-conf/services/fr.krobot.Service.Turret.service.in b/info/control/dbus-conf/services/fr.krobot.Service.Turret.service.in new file mode 100644 index 0000000..649a7db --- /dev/null +++ b/info/control/dbus-conf/services/fr.krobot.Service.Turret.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=fr.krobot.Service.Turret +Exec=@PREFIX@/bin/krobot-service-turret diff --git a/info/control/install-programs.sh b/info/control/install-programs.sh index 879952c..867b9a3 100644 --- a/info/control/install-programs.sh +++ b/info/control/install-programs.sh @@ -23,3 +23,16 @@ for prog in $PROGRAMS; do install -vm 0755 $prog "$PREFIX/bin/$name" fi done + +mkdir -pv "$PREFIX/share/krobot/services" + +function instantiate { + local destination="$PREFIX/share/krobot/$2" + echo "Creation of $destination" + sed "s#@PREFIX@#$PREFIX#g" "$1" > "$destination" +} + +instantiate dbus-conf/bus.conf.in bus.conf +for service in dbus-conf/services/*.service.in; do + instantiate $service services/$(basename ${service/.in}) +done diff --git a/info/control/lib-krobot/krobot_motors.ml b/info/control/lib-krobot/krobot_motors.ml index 0a84bd0..9460930 100644 --- a/info/control/lib-krobot/krobot_motors.ml +++ b/info/control/lib-krobot/krobot_motors.ml @@ -11,7 +11,7 @@ open Lwt open Krobot_dbus_motors.Fr_krobot_Service_Motors -let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Motors") ["fr"; "Krobot"; "Services"; "Motors"] +let proxy krobot = OBus_proxy.make (OBus_peer.make (Krobot.to_bus krobot) "fr.krobot.Service.Motors") ["fr"; "krobot"; "Services"; "Motors"] type move_result = type_move_result type stop_mode = type_stop_mode hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-05-28 07:06:53
|
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 6363c8caf4672b21a6f7197a8a01e3bbd75f61af (commit) from 5d8a1f897c0083e62e6beb0f2d82458cf4760cf9 (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 6363c8caf4672b21a6f7197a8a01e3bbd75f61af Author: Jérémie Dimino <je...@di...> Date: Fri May 28 09:06:27 2010 +0200 add a missing file in the krobot library ----------------------------------------------------------------------- Changes: diff --git a/info/control/krobot.mllib b/info/control/krobot.mllib index e595302..64bf286 100644 --- a/info/control/krobot.mllib +++ b/info/control/krobot.mllib @@ -18,3 +18,4 @@ protocol/Krobot_dbus_grip protocol/Krobot_dbus_motors protocol/Krobot_dbus_sensors protocol/Krobot_dbus_turret +protocol/Krobot_dbus_daemon hooks/post-receive -- krobot |