From: Jérémie D. <Ba...@us...> - 2010-03-07 22:29: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 6c4e8c5630ad64620ea8228a0a4c56d50b02571f (commit) from 19398dd4d385b2ce50f474cb573743d6ec7f70a6 (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 6c4e8c5630ad64620ea8228a0a4c56d50b02571f Author: Jérémie Dimino <je...@di...> Date: Sun Mar 7 23:28:35 2010 +0100 build and install the krobot library ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/Makefile b/PC_Mainboard/Makefile index 96a8d60..026a6a4 100644 --- a/PC_Mainboard/Makefile +++ b/PC_Mainboard/Makefile @@ -24,6 +24,14 @@ clean: .PHONY: install install: + $(OF) install krobot META \ + lib_krobot/krobot.mli \ + $(wildcard _build/lib_krobot/*.cmi) \ + $(wildcard _build/lib_krobot/*.cmx) \ + $(wildcard _build/*.cma) \ + $(wildcard _build/*.cmxa) \ + $(wildcard _build/*.cmxs) \ + $(wildcard _build/*.a) install -m 0755 _build/card_tools/send_firmware.best $(PREFIX)/bin/krobot-send-firmware install -m 0755 _build/card_tools/dump_memory.best $(PREFIX)/bin/krobot-dump-memory install -m 0755 _build/tools/forward_dbus.best $(PREFIX)/bin/krobot-forward-dbus @@ -35,6 +43,7 @@ install: .PHONY: uninstall uninstall: + $(OF) remove krobot rm -vf $(PREFIX)/bin/krobot-* .PHONY: reinstall diff --git a/PC_Mainboard/_tags b/PC_Mainboard/_tags index 2b3245a..0d628c0 100644 --- a/PC_Mainboard/_tags +++ b/PC_Mainboard/_tags @@ -38,8 +38,8 @@ # | Common | # +------------------------------------------------------------------+ -<common/{types,util}.{ml,mli}>: syntax_camlp4o, pkg_obus.syntax, pkg_lwt.syntax -<common/{types,util}.*>: pkg_obus +<common/{krobot_types,util}.{ml,mli}>: syntax_camlp4o, pkg_obus.syntax, pkg_lwt.syntax +<common/{krobot_types,util}.*>: pkg_obus # +------------------------------------------------------------------+ # | Driver | diff --git a/PC_Mainboard/clients/init_position.ml b/PC_Mainboard/clients/init_position.ml index 0a4e6d9..4e74d75 100644 --- a/PC_Mainboard/clients/init_position.ml +++ b/PC_Mainboard/clients/init_position.ml @@ -28,7 +28,7 @@ lwt () = lwt () = move_backward_slowly krobot in lwt () = Log.notice "going to initial position on first axis" in - lwt _ = Krobot.move krobot ~distance:Config.initial_position ~velocity:400 ~acceleration:800 in + lwt _ = Krobot.move krobot ~distance:Krobot_config.initial_position ~velocity:400 ~acceleration:800 in lwt () = Log.notice "turning" in lwt _ = Krobot.turn krobot ~angle:(-90) ~velocity:400 ~acceleration:800 in @@ -36,7 +36,7 @@ lwt () = lwt () = move_backward_slowly krobot in lwt () = Log.notice "going to initial position on second axis" in - lwt _ = Krobot.move krobot ~distance:Config.initial_position ~velocity:400 ~acceleration:800 in + lwt _ = Krobot.move krobot ~distance:Krobot_config.initial_position ~velocity:400 ~acceleration:800 in lwt () = Log.notice "turning" in lwt _ = Krobot.turn krobot ~angle:45 ~velocity:400 ~acceleration:800 in diff --git a/PC_Mainboard/clients/script.ml b/PC_Mainboard/clients/script.ml index 64a5ed8..5c64cf6 100644 --- a/PC_Mainboard/clients/script.ml +++ b/PC_Mainboard/clients/script.ml @@ -274,7 +274,7 @@ let () = let id = int "id" and position = int "position" - and velocity = int ~default:Config.ax12_default_velocity "velocity" + and velocity = int ~default:Krobot_config.ax12_default_velocity "velocity" and timeout = int ~default:100 "timeout" and goto_mode = keyword ~default:`Now "mode" [("now", `Now); ("action", `Action)] in @@ -301,13 +301,13 @@ let () = register ~path:["ax12"] "get-stats" (f2 id timeout) (fun logger krobot id timeout -> lwt stats = Krobot_unsafe.AX12.get_stats krobot id timeout in - lwt () = logger [textf "ax12[%d] position = %d" id stats.Types.ax12_position] in - lwt () = logger [textf "ax12[%d] velocity = %d" id stats.Types.ax12_velocity] in - lwt () = logger [textf "ax12[%d] torque = %d" id stats.Types.ax12_torque] in - lwt () = logger [textf "ax12[%d] voltage = %d" id stats.Types.ax12_voltage] in - lwt () = logger [textf "ax12[%d] temperature = %d" id stats.Types.ax12_temperature] in - lwt () = logger [textf "ax12[%d] cw-angle-limit = %d" id stats.Types.ax12_cw_angle_limit] in - lwt () = logger [textf "ax12[%d] ccw-angle-limit = %d" id stats.Types.ax12_ccw_angle_limit] in + lwt () = logger [textf "ax12[%d] position = %d" id stats.Krobot_types.ax12_position] in + lwt () = logger [textf "ax12[%d] velocity = %d" id stats.Krobot_types.ax12_velocity] in + lwt () = logger [textf "ax12[%d] torque = %d" id stats.Krobot_types.ax12_torque] in + lwt () = logger [textf "ax12[%d] voltage = %d" id stats.Krobot_types.ax12_voltage] in + lwt () = logger [textf "ax12[%d] temperature = %d" id stats.Krobot_types.ax12_temperature] in + lwt () = logger [textf "ax12[%d] cw-angle-limit = %d" id stats.Krobot_types.ax12_cw_angle_limit] in + lwt () = logger [textf "ax12[%d] ccw-angle-limit = %d" id stats.Krobot_types.ax12_ccw_angle_limit] in return ()); register ~path:["ax12"] "action" (f1 (int ~default:254 "id")) (fun logger krobot id -> diff --git a/PC_Mainboard/clients/script_commands.ml b/PC_Mainboard/clients/script_commands.ml index 5741602..0c92b84 100644 --- a/PC_Mainboard/clients/script_commands.ml +++ b/PC_Mainboard/clients/script_commands.ml @@ -9,7 +9,7 @@ (* +-----------------------------------------------------------------+ - | Types | + | Krobot_types | +-----------------------------------------------------------------+ *) type logger = Lwt_term.styled_text -> unit Lwt.t diff --git a/PC_Mainboard/common/config.ml b/PC_Mainboard/common/config.ml deleted file mode 100644 index c05aaf8..0000000 --- a/PC_Mainboard/common/config.ml +++ /dev/null @@ -1,20 +0,0 @@ -(* - * config.ml - * --------- - * Copyright : (c) 2010, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -let back_sensors = [3; 6; 7; 10] -let front_sensors = [0; 1; 2; 4; 5; 8; 9; 11; 12; 13; 14; 15] -let initial_position = 200 -let bus_address = "unix:abstract=krobot" -let update_delay = 0.05 -let reopen_delay = 1.0 - -let ax12_grip_up_down = 1 -let grip_up_position = 880 -let grip_down_position = 580 -let ax12_default_velocity = 50 diff --git a/PC_Mainboard/common/config.mli b/PC_Mainboard/common/config.mli deleted file mode 100644 index 66cd249..0000000 --- a/PC_Mainboard/common/config.mli +++ /dev/null @@ -1,33 +0,0 @@ -(* - * config.mli - * ---------- - * Copyright : (c) 2010, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(** Krobot parameters *) - -val front_sensors : int list - (** List of front sensors *) - -val back_sensors : int list - (** List of back sensors *) - -val initial_position : int - (** Position to borders at the beginning of the match *) - -val bus_address : string - (** Default address of the krobot dbus daemon *) - -val update_delay : float - (** Time to wait between updates *) - -val reopen_delay : float - (** Time to wait before retrying to open a card *) - -val ax12_grip_up_down : int -val grip_up_position : int -val grip_down_position : int -val ax12_default_velocity : int diff --git a/PC_Mainboard/common/krobot_config.ml b/PC_Mainboard/common/krobot_config.ml new file mode 100644 index 0000000..1895a58 --- /dev/null +++ b/PC_Mainboard/common/krobot_config.ml @@ -0,0 +1,20 @@ +(* + * krobot_config.ml + * ---------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +let back_sensors = [3; 6; 7; 10] +let front_sensors = [0; 1; 2; 4; 5; 8; 9; 11; 12; 13; 14; 15] +let initial_position = 200 +let bus_address = "unix:abstract=krobot" +let update_delay = 0.05 +let reopen_delay = 1.0 + +let ax12_grip_up_down = 1 +let grip_up_position = 880 +let grip_down_position = 580 +let ax12_default_velocity = 50 diff --git a/PC_Mainboard/common/krobot_config.mli b/PC_Mainboard/common/krobot_config.mli new file mode 100644 index 0000000..aa34719 --- /dev/null +++ b/PC_Mainboard/common/krobot_config.mli @@ -0,0 +1,33 @@ +(* + * krobot_config.mli + * ----------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(** Krobot parameters *) + +val front_sensors : int list + (** List of front sensors *) + +val back_sensors : int list + (** List of back sensors *) + +val initial_position : int + (** Position to borders at the beginning of the match *) + +val bus_address : string + (** Default address of the krobot dbus daemon *) + +val update_delay : float + (** Time to wait between updates *) + +val reopen_delay : float + (** Time to wait before retrying to open a card *) + +val ax12_grip_up_down : int +val grip_up_position : int +val grip_down_position : int +val ax12_default_velocity : int diff --git a/PC_Mainboard/common/krobot_types.ml b/PC_Mainboard/common/krobot_types.ml new file mode 100644 index 0000000..0b5a297 --- /dev/null +++ b/PC_Mainboard/common/krobot_types.ml @@ -0,0 +1,68 @@ +(* + * krobot_types.ml + * --------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +open OBus_pervasives + +type move_result = [ `OK | `Stopped ] + +let obus_move_result = + OBus_type.mapping obus_int [(`OK, 0); (`Stopped, 1)] + +type motor = [ `Left | `Right | `Both ] + +let obus_motor = OBus_type.mapping obus_int + [(`Left, -1); + (`Both, 0); + (`Right, 1)] + +type stop_mode = [ `Off | `Abrupt | `Smooth ] + +let obus_stop_mode = OBus_type.mapping obus_int + [(`Off, 0); + (`Abrupt, 1); + (`Smooth, 2)] + +type card_state = [ `Present | `Absent ] + +let obus_card_state = OBus_type.mapping obus_int + [(`Present, 0); + (`Absent, 1)] + +type goto_mode = [ `Straight | `Curve_right | `Curve_left ] + +let obus_goto_mode = OBus_type.mapping obus_int + [(`Straight, 0); + (`Curve_right, 1); + (`Curve_left, 2)] + +type ax12_stats = { + ax12_position : int; + ax12_velocity : int; + ax12_torque : int; + ax12_voltage : int; + ax12_temperature : int; + ax12_cw_angle_limit : int; + ax12_ccw_angle_limit : int; +} with obus + +type exec_mode = [ `Now | `Action ] + +let obus_exec_mode = OBus_type.mapping obus_int + [(`Now, 0); (`Action, 1)] + +type direction = [ `Forward | `Backward ] + +let obus_direction = OBus_type.mapping obus_int + [(`Forward, 0); (`Backward, 1)] + +type ax12_action = { + aa_id : int; + aa_position : int; + aa_velocity : int; +} with obus diff --git a/PC_Mainboard/common/krobot_types.mli b/PC_Mainboard/common/krobot_types.mli new file mode 100644 index 0000000..c7c261f --- /dev/null +++ b/PC_Mainboard/common/krobot_types.mli @@ -0,0 +1,54 @@ +(* + * krobot_types.mli + * ---------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(** Common types with their obus type combinators *) + +(** This types are used by the driver and the client-side krobot + library. + + Putting in a module shared by the client and the server prevents + typos in conversions. *) + +type move_result = [ `OK | `Stopped ] with obus(basic) + (** Result of a movement started by [Krobot.move] or + [Krobot.turn] *) + +type motor = [ `Left | `Right | `Both ] with obus(basic) + (** Motors *) + +type stop_mode = [ `Off | `Abrupt | `Smooth ] with obus(basic) + (** Mode for stopping motors *) + +type direction = [ `Forward | `Backward ] with obus(basic) + +type card_state = [ `Present | `Absent ] with obus(basic) + (** State of a card *) + +type goto_mode = [ `Straight | `Curve_right | `Curve_left ] with obus(basic) + (** Form of the trajectory for the goto command *) + +type exec_mode = [ `Now | `Action ] with obus(basic) + (** Mode of execution of the goto command for ax12 *) + +type ax12_stats = { + ax12_position : int; + ax12_velocity : int; + ax12_torque : int; + ax12_voltage : int; + ax12_temperature : int; + ax12_cw_angle_limit : int; + ax12_ccw_angle_limit : int; +} with obus(sequence) + +(** Action on an AX12: *) +type ax12_action = { + aa_id : int; + aa_position : int; + aa_velocity : int; +} with obus(sequence) diff --git a/PC_Mainboard/common/types.ml b/PC_Mainboard/common/types.ml deleted file mode 100644 index 3f970ca..0000000 --- a/PC_Mainboard/common/types.ml +++ /dev/null @@ -1,68 +0,0 @@ -(* - * types.ml - * -------- - * Copyright : (c) 2010, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -open OBus_pervasives - -type move_result = [ `OK | `Stopped ] - -let obus_move_result = - OBus_type.mapping obus_int [(`OK, 0); (`Stopped, 1)] - -type motor = [ `Left | `Right | `Both ] - -let obus_motor = OBus_type.mapping obus_int - [(`Left, -1); - (`Both, 0); - (`Right, 1)] - -type stop_mode = [ `Off | `Abrupt | `Smooth ] - -let obus_stop_mode = OBus_type.mapping obus_int - [(`Off, 0); - (`Abrupt, 1); - (`Smooth, 2)] - -type card_state = [ `Present | `Absent ] - -let obus_card_state = OBus_type.mapping obus_int - [(`Present, 0); - (`Absent, 1)] - -type goto_mode = [ `Straight | `Curve_right | `Curve_left ] - -let obus_goto_mode = OBus_type.mapping obus_int - [(`Straight, 0); - (`Curve_right, 1); - (`Curve_left, 2)] - -type ax12_stats = { - ax12_position : int; - ax12_velocity : int; - ax12_torque : int; - ax12_voltage : int; - ax12_temperature : int; - ax12_cw_angle_limit : int; - ax12_ccw_angle_limit : int; -} with obus - -type exec_mode = [ `Now | `Action ] - -let obus_exec_mode = OBus_type.mapping obus_int - [(`Now, 0); (`Action, 1)] - -type direction = [ `Forward | `Backward ] - -let obus_direction = OBus_type.mapping obus_int - [(`Forward, 0); (`Backward, 1)] - -type ax12_action = { - aa_id : int; - aa_position : int; - aa_velocity : int; -} with obus diff --git a/PC_Mainboard/common/types.mli b/PC_Mainboard/common/types.mli deleted file mode 100644 index 6fa04c8..0000000 --- a/PC_Mainboard/common/types.mli +++ /dev/null @@ -1,54 +0,0 @@ -(* - * types.mli - * --------- - * Copyright : (c) 2010, Jeremie Dimino <je...@di...> - * Licence : BSD3 - * - * This file is a part of [kro]bot. - *) - -(** Common types with their obus type combinators *) - -(** This types are used by the driver and the client-side krobot - library. - - Putting in a module shared by the client and the server prevents - typos in conversions. *) - -type move_result = [ `OK | `Stopped ] with obus(basic) - (** Result of a movement started by [Krobot.move] or - [Krobot.turn] *) - -type motor = [ `Left | `Right | `Both ] with obus(basic) - (** Motors *) - -type stop_mode = [ `Off | `Abrupt | `Smooth ] with obus(basic) - (** Mode for stopping motors *) - -type direction = [ `Forward | `Backward ] with obus(basic) - -type card_state = [ `Present | `Absent ] with obus(basic) - (** State of a card *) - -type goto_mode = [ `Straight | `Curve_right | `Curve_left ] with obus(basic) - (** Form of the trajectory for the goto command *) - -type exec_mode = [ `Now | `Action ] with obus(basic) - (** Mode of execution of the goto command for ax12 *) - -type ax12_stats = { - ax12_position : int; - ax12_velocity : int; - ax12_torque : int; - ax12_voltage : int; - ax12_temperature : int; - ax12_cw_angle_limit : int; - ax12_ccw_angle_limit : int; -} with obus(sequence) - -(** Action on an AX12: *) -type ax12_action = { - aa_id : int; - aa_position : int; - aa_velocity : int; -} with obus(sequence) diff --git a/PC_Mainboard/common/util.ml b/PC_Mainboard/common/util.ml index 705623f..1f3ca4f 100644 --- a/PC_Mainboard/common/util.ml +++ b/PC_Mainboard/common/util.ml @@ -13,7 +13,7 @@ let front_collide sensors = if Array.length sensors <> 16 then invalid_arg "Until.front_collide"; let rec loop = function | 16 -> false - | n -> (sensors.(n) && List.mem n Config.front_sensors) || loop (n + 1) + | n -> (sensors.(n) && List.mem n Krobot_config.front_sensors) || loop (n + 1) in loop 0 @@ -21,7 +21,7 @@ let back_collide sensors = if Array.length sensors <> 16 then invalid_arg "Until.back_collide"; let rec loop = function | 16 -> false - | n -> (sensors.(n) && List.mem n Config.back_sensors) || loop (n + 1) + | n -> (sensors.(n) && List.mem n Krobot_config.back_sensors) || loop (n + 1) in loop 0 diff --git a/PC_Mainboard/driver/bus.conf b/PC_Mainboard/driver/bus.conf index 9808b8e..0fb7c62 100644 --- a/PC_Mainboard/driver/bus.conf +++ b/PC_Mainboard/driver/bus.conf @@ -1,5 +1,5 @@ -<!-- Configuration for the dbus daemon --> -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" +<!-- Krobot_configuration for the dbus daemon --> +<!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/> diff --git a/PC_Mainboard/driver/driver.ml b/PC_Mainboard/driver/driver.ml index a7f256e..82b5d48 100644 --- a/PC_Mainboard/driver/driver.ml +++ b/PC_Mainboard/driver/driver.ml @@ -12,7 +12,7 @@ module Log = Lwt_log.Make(struct let section = "driver" end) open OBus_pervasives -open Types +open Krobot_types open Lwt (* +-----------------------------------------------------------------+ @@ -44,10 +44,10 @@ struct if data <> dev.data then begin dev.data <- data; lwt () = value dev data in - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev end else - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev let make card path = @@ -107,7 +107,7 @@ struct OL_interface(OBus) "fr.krobot.Device.AX12" as interface - OL_method SetAX12 : Types.ax12_action structure list -> unit = fun dev actions -> + OL_method SetAX12 : Krobot_types.ax12_action structure list -> unit = fun dev actions -> lwt () = Lwt_list.iter_p (fun action -> @@ -122,10 +122,10 @@ struct USB_commands.AX12.action dev.card ~id:0xfe OL_method GripUp : unit = fun dev -> - set_ax12 dev [{ aa_id = Config.ax12_grip_up_down; aa_position = Config.grip_up_position; aa_velocity = Config.ax12_default_velocity }] + set_ax12 dev [{ aa_id = Krobot_config.ax12_grip_up_down; aa_position = Krobot_config.grip_up_position; aa_velocity = Krobot_config.ax12_default_velocity }] OL_method GripDown : unit = fun dev -> - set_ax12 dev [{ aa_id = Config.ax12_grip_up_down; aa_position = Config.grip_down_position; aa_velocity = Config.ax12_default_velocity }] + set_ax12 dev [{ aa_id = Krobot_config.ax12_grip_up_down; aa_position = Krobot_config.grip_down_position; aa_velocity = Krobot_config.ax12_default_velocity }] let make card path = return { @@ -163,10 +163,10 @@ struct if data <> dev.data then begin dev.data <- data; lwt () = value dev data in - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev end else - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev let make card path = @@ -217,10 +217,10 @@ struct if data <> dev.data then begin dev.data <- data; lwt () = value dev data in - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev end else - lwt () = Lwt_unix.sleep Config.update_delay in + lwt () = Lwt_unix.sleep Krobot_config.update_delay in loop dev let make card path = @@ -437,9 +437,9 @@ struct return (if trajectory.stopped then `Stopped else `OK) end - OL_method Turn : int -> int -> int -> Types.move_result - OL_method Move : int -> int -> int -> Types.move_result - OL_method Goto : int -> int -> int -> int -> Types.goto_mode -> int -> Types.move_result + OL_method Turn : int -> int -> int -> Krobot_types.move_result + OL_method Move : int -> int -> int -> Krobot_types.move_result + OL_method Goto : int -> int -> int -> int -> Krobot_types.goto_mode -> int -> Krobot_types.move_result (* +---------------------------------------------------------------+ | Manually sets the velocity and acceleration of each motor | @@ -517,7 +517,7 @@ struct let static = { velocity = 0; acceleration = 0; direction = `Forward } in _set_velocities dev (return ()) (static, static) velocities accelerations duration - OL_method StopMotors : Types.stop_mode -> unit + OL_method StopMotors : Krobot_types.stop_mode -> unit OL_method SetVelocities : int * int -> int * int -> float -> unit (* +---------------------------------------------------------------+ @@ -596,7 +596,7 @@ struct | Some card -> Krobot_card.close card - OL_method CardStates : OBus_connection.t -> Types.card_state * Types.card_state * Types.card_state = fun manager connection -> + OL_method CardStates : OBus_connection.t -> Krobot_types.card_state * Krobot_types.card_state * Krobot_types.card_state = fun manager connection -> let state card = match React.S.value card with | Some _ -> `Present | None -> `Absent @@ -649,7 +649,7 @@ struct OL_property_r Name : string = fun dev -> return (Krobot_card.name (get_card dev)) - OL_method GetState : Types.card_state = fun dev -> + OL_method GetState : Krobot_types.card_state = fun dev -> match React.S.value dev.card with | None -> return `Absent @@ -671,7 +671,7 @@ struct OL_method Test : unit = fun dev -> USB_commands.Card.test (get_card dev) - OL_signal StateChanged : Types.card_state + OL_signal StateChanged : Krobot_types.card_state let make name card path = let dev = { @@ -730,7 +730,7 @@ and restart_card ~name ~vendor_id ~product_id ~set on_up on_down = if !quit then return () else begin - lwt () = Lwt_unix.sleep Config.reopen_delay in + lwt () = Lwt_unix.sleep Krobot_config.reopen_delay in monitor_card ~name ~vendor_id ~product_id ~set on_up on_down end @@ -748,7 +748,7 @@ lwt () = Arg.parse args ignore usage_msg; (* Open the krobot message bus *) - lwt bus = OBus_bus.of_addresses (OBus_address.of_string Config.bus_address) in + lwt bus = OBus_bus.of_addresses (OBus_address.of_string Krobot_config.bus_address) in lwt () = try_lwt diff --git a/PC_Mainboard/generators/gen_dbus_exports.ml b/PC_Mainboard/generators/gen_dbus_exports.ml index 134edef..fc99314 100644 --- a/PC_Mainboard/generators/gen_dbus_exports.ml +++ b/PC_Mainboard/generators/gen_dbus_exports.ml @@ -78,10 +78,10 @@ let rec print path indent = function printf "%send\n" indent | Enum enum -> - printf "%stype %s = Types.%s with obus\n" indent (Name.lid enum.enum_name) (Name.lid enum.enum_name) + printf "%stype %s = Krobot_types.%s with obus\n" indent (Name.lid enum.enum_name) (Name.lid enum.enum_name) | Record record -> - printf "%stype %s = Types.%s with obus\n" indent (Name.lid record.rec_name) (Name.lid record.rec_name) + printf "%stype %s = Krobot_types.%s with obus\n" indent (Name.lid record.rec_name) (Name.lid record.rec_name) let () = printf "open OBus_pervasives\n"; diff --git a/PC_Mainboard/generators/gen_dbus_imports.ml b/PC_Mainboard/generators/gen_dbus_imports.ml index 2f62ba9..09eac87 100644 --- a/PC_Mainboard/generators/gen_dbus_imports.ml +++ b/PC_Mainboard/generators/gen_dbus_imports.ml @@ -60,10 +60,10 @@ let rec print indent = function printf "%send\n" indent | Enum enum -> - printf "%stype %s = Types.%s with obus\n" indent (Name.lid enum.enum_name) (Name.lid enum.enum_name) + printf "%stype %s = Krobot_types.%s with obus\n" indent (Name.lid enum.enum_name) (Name.lid enum.enum_name) | Record record -> - printf "%stype %s = Types.%s with obus\n" indent (Name.lid record.rec_name) (Name.lid record.rec_name) + printf "%stype %s = Krobot_types.%s with obus\n" indent (Name.lid record.rec_name) (Name.lid record.rec_name) let () = print_string "\ diff --git a/PC_Mainboard/generators/gen_script_commands.ml b/PC_Mainboard/generators/gen_script_commands.ml index 8ee4f3e..be2da55 100644 --- a/PC_Mainboard/generators/gen_script_commands.ml +++ b/PC_Mainboard/generators/gen_script_commands.ml @@ -80,7 +80,7 @@ let rec print is_card path caml_path = function printf " \"{\" ^ (String.concat \"; \" ["; List.iter (fun (name, typ) -> - printf "\"%s = \" ^ %s; " name (typ.print (sprintf "x.Types.%s%s" record.rec_prefix (Name.lid name)))) + printf "\"%s = \" ^ %s; " name (typ.print (sprintf "x.Krobot_types.%s%s" record.rec_prefix (Name.lid name)))) record.rec_args; printf "]) ^ \"}\" in\n"; printf " let _ = print_%s in\n" (Name.lid record.rec_name) diff --git a/PC_Mainboard/generators/gen_usb_commands.ml b/PC_Mainboard/generators/gen_usb_commands.ml index 70bfb92..2c457dd 100644 --- a/PC_Mainboard/generators/gen_usb_commands.ml +++ b/PC_Mainboard/generators/gen_usb_commands.ml @@ -78,7 +78,7 @@ let rec print indent = function printf "%slet put_%s writer value =\n" indent (Name.lid record.rec_name); List.iter (fun (name, typ) -> - printf "%s %s;\n" indent (typ.writer ("value.Types." ^ record.rec_prefix ^ Name.lid name))) + printf "%s %s;\n" indent (typ.writer ("value.Krobot_types." ^ record.rec_prefix ^ Name.lid name))) record.rec_args; printf "%s ()\n" indent; @@ -92,7 +92,7 @@ let rec print indent = function (List.map (fun (name, typ) -> let name = Name.lid name in - sprintf "Types.%s%s = %s" record.rec_prefix (Name.lid name) name) + sprintf "Krobot_types.%s%s = %s" record.rec_prefix (Name.lid name) name) record.rec_args)) | Module(name, items) -> printf "%smodule %s = struct\n" indent (Name.uid name); diff --git a/PC_Mainboard/krobot.mllib b/PC_Mainboard/krobot.mllib new file mode 100644 index 0000000..6116255 --- /dev/null +++ b/PC_Mainboard/krobot.mllib @@ -0,0 +1,4 @@ +lib_krobot/Krobot +lib_krobot/Krobot_unsafe +common/Krobot_types +common/Krobot_config diff --git a/PC_Mainboard/lib_krobot/krobot.ml b/PC_Mainboard/lib_krobot/krobot.ml index 7a845d7..800683e 100644 --- a/PC_Mainboard/lib_krobot/krobot.ml +++ b/PC_Mainboard/lib_krobot/krobot.ml @@ -11,16 +11,16 @@ module Log = Lwt_log.Make(struct let section = "krobot" end) open OBus_pervasives open Lwt -open Types +open Krobot_types (* +-----------------------------------------------------------------+ - | Types | + | Krobot_types | +-----------------------------------------------------------------+ *) type team = Team_red | Team_green type card = { - card_state : Types.card_state React.signal; + card_state : Krobot_types.card_state React.signal; } type t = { @@ -106,7 +106,7 @@ let bus = lazy( | None -> try_lwt lwt () = Log.info "connecting to the krobot with the local krobot bus" in - OBus_bus.of_addresses (OBus_address.of_string Config.bus_address) + OBus_bus.of_addresses (OBus_address.of_string Krobot_config.bus_address) with exn -> lwt () = Log.exn exn "failed to connect to the local krobot bus" in fail exn @@ -125,9 +125,9 @@ let create ?peer () = and range_finders = make_dev_signal peer "RangeFinders" "Get" "Value" <:obus_type< int array >> (Array.make 8 0) and inhibited_forward_until = make_dev_signal peer "Motors" "InhibitedForward" "InhibitedForwardChanged" <:obus_type< float >> 0. and inhibited_backward_until = make_dev_signal peer "Motors" "InhibitedBackward" "InhibitedBackwardChanged" <:obus_type< float >> 0. - and card_interface = make_card_signal peer "Interface" "GetState" "StateChanged" <:obus_type< Types.card_state >> `Absent - and card_sensor = make_card_signal peer "Sensor" "GetState" "StateChanged" <:obus_type< Types.card_state >> `Absent - and card_motor = make_card_signal peer "Motor" "GetState" "StateChanged" <:obus_type< Types.card_state >> `Absent in + and card_interface = make_card_signal peer "Interface" "GetState" "StateChanged" <:obus_type< Krobot_types.card_state >> `Absent + and card_sensor = make_card_signal peer "Sensor" "GetState" "StateChanged" <:obus_type< Krobot_types.card_state >> `Absent + and card_motor = make_card_signal peer "Motor" "GetState" "StateChanged" <:obus_type< Krobot_types.card_state >> `Absent in return { peer = peer; compass = compass; @@ -175,7 +175,7 @@ OP_method CalibrationContinue : unit module AX12 = Make_device(struct let name = "AX12" end) OP_interface(AX12) "fr.krobot.Device.AX12" -OP_method SetAX12 : Types.ax12_action structure list -> unit +OP_method SetAX12 : Krobot_types.ax12_action structure list -> unit OP_method GripUp : unit OP_method GripDown : unit @@ -186,10 +186,10 @@ OP_method GripDown : unit module Motors = Make_device(struct let name = "Motors" end) OP_interface(Motors) "fr.krobot.Device.Motors" -OP_method Turn : angle : int -> velocity : int -> acceleration : int -> Types.move_result -OP_method Move : distance : int -> velocity : int -> acceleration : int -> Types.move_result -OP_method Goto : x : int -> y : int -> velocity : int -> acceleration : int -> mode : Types.goto_mode -> bypass_distance : int -> Types.move_result -OP_method StopMotors : mode : Types.stop_mode -> unit +OP_method Turn : angle : int -> velocity : int -> acceleration : int -> Krobot_types.move_result +OP_method Move : distance : int -> velocity : int -> acceleration : int -> Krobot_types.move_result +OP_method Goto : x : int -> y : int -> velocity : int -> acceleration : int -> mode : Krobot_types.goto_mode -> bypass_distance : int -> Krobot_types.move_result +OP_method StopMotors : mode : Krobot_types.stop_mode -> unit OP_method SetVelocities : velocities : int * int -> accelerations : int * int -> duration : float -> unit OP_method InhibitForward : float -> unit OP_method InhibitBackward : float -> unit diff --git a/PC_Mainboard/lib_krobot/krobot.mli b/PC_Mainboard/lib_krobot/krobot.mli index 19b8c34..b5a56bf 100644 --- a/PC_Mainboard/lib_krobot/krobot.mli +++ b/PC_Mainboard/lib_krobot/krobot.mli @@ -64,7 +64,7 @@ val calibration_stop : t -> unit Lwt.t (** {6 AX12s} *) -val set_ax12 : t -> Types.ax12_action list -> unit Lwt.t +val set_ax12 : t -> Krobot_types.ax12_action list -> unit Lwt.t (** [set_ax12 krobot actions] move all given ax12 at the same time. *) @@ -76,16 +76,16 @@ val grip_down : t -> unit Lwt.t val motors_state : t -> string Lwt.t (** Return a string describing the current state of motors *) -val turn : t -> angle : int -> velocity : int -> acceleration : int -> Types.move_result Lwt.t -val move : t -> distance : int -> velocity : int -> acceleration : int -> Types.move_result Lwt.t +val turn : t -> angle : int -> velocity : int -> acceleration : int -> Krobot_types.move_result Lwt.t +val move : t -> distance : int -> velocity : int -> acceleration : int -> Krobot_types.move_result Lwt.t val goto : t -> x : int -> y : int -> velocity : int -> acceleration : int -> - mode : Types.goto_mode -> - bypass_distance : int -> Types.move_result Lwt.t + mode : Krobot_types.goto_mode -> + bypass_distance : int -> Krobot_types.move_result Lwt.t -val stop_motors : t -> mode : Types.stop_mode -> unit Lwt.t +val stop_motors : t -> mode : Krobot_types.stop_mode -> unit Lwt.t (** [stop_motorw t mode] stop the two motors. *) val set_velocities : t -> @@ -121,7 +121,7 @@ module Card : sig val name : card -> string (** Returns the name of a card *) - val state : t * card -> Types.card_state React.signal + val state : t * card -> Krobot_types.card_state React.signal (** Returns the status of one of the card of the krobot *) val bootloader : t * card -> unit Lwt.t diff --git a/PC_Mainboard/myocamlbuild.ml b/PC_Mainboard/myocamlbuild.ml index 3cedd3f..578fb43 100644 --- a/PC_Mainboard/myocamlbuild.ml +++ b/PC_Mainboard/myocamlbuild.ml @@ -61,8 +61,9 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, (have_lwt_unix && have_usb, "card_tools/dump_memory.best"); (* Krobot client library *) - (have_lwt_unix && have_obus, "lib_krobot/krobot.cma"); - (have_lwt_unix && have_obus && have_native, "lib_krobot/krobot.cmxa"); + (have_lwt_unix && have_obus, "krobot.cma"); + (have_lwt_unix && have_obus && have_native, "krobot.cmxa"); + (have_lwt_unix && have_obus && have_native, "krobot.cmxs"); (* Tools *) (have_lwt_unix && have_obus, "tools/forward_dbus.best"); @@ -148,6 +149,10 @@ let _ = | After_rules -> + rule "shared libraries (cmxs)" + ~dep:"%.cmxa" ~prod:"%.cmxs" + (fun env _ -> Cmd(S[!(Options.ocamlopt); A"-shared"; A"-linkall"; A(env "%.cmxa"); A"-o"; A(env "%.cmxs")])); + (* +---------------------------------------------------------+ | Autogenerated files | +---------------------------------------------------------+ *) diff --git a/PC_Mainboard/tools/forward_dbus.ml b/PC_Mainboard/tools/forward_dbus.ml index 7c85c84..8685578 100644 --- a/PC_Mainboard/tools/forward_dbus.ml +++ b/PC_Mainboard/tools/forward_dbus.ml @@ -15,7 +15,7 @@ let rec copy ta tb = copy ta tb lwt () = - let addresses = OBus_address.of_string Config.bus_address in + let addresses = OBus_address.of_string Krobot_config.bus_address in lwt (_, ta) = OBus_transport.of_addresses addresses in let tb = OBus_transport.make diff --git a/PC_Mainboard/www/krobot.ml b/PC_Mainboard/www/krobot.ml index 2636c6e..5fe7dae 100644 --- a/PC_Mainboard/www/krobot.ml +++ b/PC_Mainboard/www/krobot.ml @@ -65,7 +65,7 @@ let bottom sp = ( let side_menu cur_menu sp = Eliom_tools.menu ~classe:["mainmenu"] (serv_home, [pcdata "Home"]) [ - (serv_config, [pcdata "Config"]); + (serv_config, [pcdata "Krobot_config"]); (serv_sensors, [pcdata "Sensors"]); (serv_control, [pcdata "Control"]) ] ~service:cur_menu ~sp @@ -227,7 +227,7 @@ let config_handler sp posted = div_with_id "page" [ div_with_id "content" [ h1 [pcdata "Mobile Robot Platform"]; - h2 [pcdata "Config"]; + h2 [pcdata "Krobot_config"]; (res); (form); (bottom sp) hooks/post-receive -- krobot |