From: Jérémie D. <Ba...@us...> - 2010-03-06 23:53:36
|
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 a9944f99ef133be4a4f19cb4855833c1648ef6d3 (commit) from 53198a8d5d1d8f51dc3d817a03443aebc4987cce (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 a9944f99ef133be4a4f19cb4855833c1648ef6d3 Author: Jérémie Dimino <je...@di...> Date: Sun Mar 7 00:48:58 2010 +0100 High-level commands to control the grip ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/clients/script.ml b/PC_Mainboard/clients/script.ml index f57651b..55dfb13 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:50 "velocity" + and velocity = int ~default:Config.ax12_default_velocity "velocity" and timeout = int ~default:100 "timeout" and goto_mode = keyword ~default:`Now "mode" [("now", `Now); ("action", `Action)] in @@ -311,6 +311,18 @@ let () = return ()); register ~path:["ax12"] "action" (f1 (int ~default:254 "id")) (fun logger krobot id -> - Krobot_unsafe.AX12.action krobot id) + Krobot_unsafe.AX12.action krobot id); + + (* +---------------------------------------------------------------+ + | Grip | + +---------------------------------------------------------------+ *) + + register ~path:["grip"] "up" f0 + (fun logger krobot -> + Krobot.grip_up krobot); + register ~path:["grip"] "down" f0 + (fun logger krobot -> + Krobot.grip_down krobot) + let () = Script_unsafe.register () diff --git a/PC_Mainboard/common/config.ml b/PC_Mainboard/common/config.ml index c248d6e..c05aaf8 100644 --- a/PC_Mainboard/common/config.ml +++ b/PC_Mainboard/common/config.ml @@ -13,3 +13,8 @@ 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 index 645ac10..66cd249 100644 --- a/PC_Mainboard/common/config.mli +++ b/PC_Mainboard/common/config.mli @@ -26,3 +26,8 @@ val update_delay : float 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/driver/driver.ml b/PC_Mainboard/driver/driver.ml index 9fb42d4..a7f256e 100644 --- a/PC_Mainboard/driver/driver.ml +++ b/PC_Mainboard/driver/driver.ml @@ -121,6 +121,12 @@ struct in 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 }] + + 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 }] + let make card path = return { obus = OBus.make ~interfaces:[Unsafe.interface; interface] path; diff --git a/PC_Mainboard/lib_krobot/krobot.ml b/PC_Mainboard/lib_krobot/krobot.ml index 62a7c10..7a845d7 100644 --- a/PC_Mainboard/lib_krobot/krobot.ml +++ b/PC_Mainboard/lib_krobot/krobot.ml @@ -11,6 +11,7 @@ module Log = Lwt_log.Make(struct let section = "krobot" end) open OBus_pervasives open Lwt +open Types (* +-----------------------------------------------------------------+ | Types | @@ -175,6 +176,8 @@ 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 GripUp : unit +OP_method GripDown : unit (* +-----------------------------------------------------------------+ | Motors | diff --git a/PC_Mainboard/lib_krobot/krobot.mli b/PC_Mainboard/lib_krobot/krobot.mli index 4dde27c..19b8c34 100644 --- a/PC_Mainboard/lib_krobot/krobot.mli +++ b/PC_Mainboard/lib_krobot/krobot.mli @@ -68,6 +68,9 @@ val set_ax12 : t -> Types.ax12_action list -> unit Lwt.t (** [set_ax12 krobot actions] move all given ax12 at the same time. *) +val grip_up : t -> unit Lwt.t +val grip_down : t -> unit Lwt.t + (** {6 Motors} *) val motors_state : t -> string Lwt.t hooks/post-receive -- krobot |