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: Olivier B. <Ba...@us...> - 2010-12-17 20:33:55
|
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 8395573a92737b6d1cf66cdf871829ad09ee864c (commit) from d0685e25bcaee9322350710d15c797ee88aeb090 (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 8395573a92737b6d1cf66cdf871829ad09ee864c Author: Olivier BICHLER <oli...@cr...> Date: Fri Dec 17 21:33:15 2010 +0100 Suppression des dernières erreurs DRC et améliorations dans le routage (via moins près de la vis de fixation, footprint plus adapté pour les diodes SD101A, jumper CMS) ----------------------------------------------------------------------- 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 index ce379e2..8039c55 100644 Binary files a/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX differ diff --git a/elec/lib/OrCAD/KROBOT.LLB b/elec/lib/OrCAD/KROBOT.LLB index 93aa6b6..9a95cdd 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-12-17 18:02: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 d0685e25bcaee9322350710d15c797ee88aeb090 (commit) from 5fbbf698697fa4647fc16b7cb0e348d8f2585bbe (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 d0685e25bcaee9322350710d15c797ee88aeb090 Author: Olivier BICHLER <oli...@cr...> Date: Fri Dec 17 19:02:05 2010 +0100 Ajout des exports PDF pour les PCBs des nouvelles cartes ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/PCB/PDF/Bottom Layer.pdf b/elec/boards/Controller_Motor_STM32/PCB/PDF/Bottom Layer.pdf new file mode 100644 index 0000000..a436c37 Binary files /dev/null and b/elec/boards/Controller_Motor_STM32/PCB/PDF/Bottom Layer.pdf differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/PDF/Drill Drawing.pdf b/elec/boards/Controller_Motor_STM32/PCB/PDF/Drill Drawing.pdf new file mode 100644 index 0000000..6ac2f73 Binary files /dev/null and b/elec/boards/Controller_Motor_STM32/PCB/PDF/Drill Drawing.pdf differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/PDF/Silkscreen Top.pdf b/elec/boards/Controller_Motor_STM32/PCB/PDF/Silkscreen Top.pdf new file mode 100644 index 0000000..c4aba11 Binary files /dev/null and b/elec/boards/Controller_Motor_STM32/PCB/PDF/Silkscreen Top.pdf differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/PDF/Soldermask Top.pdf b/elec/boards/Controller_Motor_STM32/PCB/PDF/Soldermask Top.pdf new file mode 100644 index 0000000..39de278 Binary files /dev/null and b/elec/boards/Controller_Motor_STM32/PCB/PDF/Soldermask Top.pdf differ diff --git a/elec/boards/Controller_Motor_STM32/PCB/PDF/Top Layer.pdf b/elec/boards/Controller_Motor_STM32/PCB/PDF/Top Layer.pdf new file mode 100644 index 0000000..26dce1e Binary files /dev/null and b/elec/boards/Controller_Motor_STM32/PCB/PDF/Top Layer.pdf differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Bottom Layer.pdf b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Bottom Layer.pdf new file mode 100644 index 0000000..c53a04c Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Bottom Layer.pdf differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Drill Drawing.pdf b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Drill Drawing.pdf new file mode 100644 index 0000000..267452e Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Drill Drawing.pdf differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Silkscreen Top.pdf b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Silkscreen Top.pdf new file mode 100644 index 0000000..3eb71de Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Silkscreen Top.pdf differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Soldermask Top.pdf b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Soldermask Top.pdf new file mode 100644 index 0000000..44bada4 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Soldermask Top.pdf differ diff --git a/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Top Layer.pdf b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Top Layer.pdf new file mode 100644 index 0000000..2459e34 Binary files /dev/null and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/PDF/Top Layer.pdf differ diff --git a/elec/boards/USB_CAN/PCB/PDF/Bottom Layer.pdf b/elec/boards/USB_CAN/PCB/PDF/Bottom Layer.pdf new file mode 100644 index 0000000..8df19ff Binary files /dev/null and b/elec/boards/USB_CAN/PCB/PDF/Bottom Layer.pdf differ diff --git a/elec/boards/USB_CAN/PCB/PDF/Drill Drawing.pdf b/elec/boards/USB_CAN/PCB/PDF/Drill Drawing.pdf new file mode 100644 index 0000000..963bf58 Binary files /dev/null and b/elec/boards/USB_CAN/PCB/PDF/Drill Drawing.pdf differ diff --git a/elec/boards/USB_CAN/PCB/PDF/Silkscreen Top.pdf b/elec/boards/USB_CAN/PCB/PDF/Silkscreen Top.pdf new file mode 100644 index 0000000..16b4e5b Binary files /dev/null and b/elec/boards/USB_CAN/PCB/PDF/Silkscreen Top.pdf differ diff --git a/elec/boards/USB_CAN/PCB/PDF/Soldermask Top.pdf b/elec/boards/USB_CAN/PCB/PDF/Soldermask Top.pdf new file mode 100644 index 0000000..6b7095f Binary files /dev/null and b/elec/boards/USB_CAN/PCB/PDF/Soldermask Top.pdf differ diff --git a/elec/boards/USB_CAN/PCB/PDF/Top Layer.pdf b/elec/boards/USB_CAN/PCB/PDF/Top Layer.pdf new file mode 100644 index 0000000..7593610 Binary files /dev/null and b/elec/boards/USB_CAN/PCB/PDF/Top Layer.pdf differ hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-17 16:24:23
|
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 5fbbf698697fa4647fc16b7cb0e348d8f2585bbe (commit) from 2cef0721c85493392c5535b3143b1677f0d9e455 (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 5fbbf698697fa4647fc16b7cb0e348d8f2585bbe Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 17:23:53 2010 +0100 Fake implementation of sensor simulators ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml index fdb2f5e..d91029b 100644 --- a/info/control/simulator/krobot_simulator.ml +++ b/info/control/simulator/krobot_simulator.ml @@ -107,9 +107,8 @@ module Compass = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Compass - - let get_measure obj = - raise_lwt (Failure "not implemented") + let get_measure env = + return (truncate ((Krobot_env.get_state env).Krobot_env.theta *. 180. /. (4. *. atan 1.))) let interface = make { @@ -121,9 +120,9 @@ struct ); } - let make () = + let make env = let obus = OBus_object.make ~interfaces:[interface] (device_path "Compass") in - OBus_object.attach obus (); + OBus_object.attach obus env; obus end @@ -369,8 +368,8 @@ module Infrareds = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Infrareds - let get obj = - raise_lwt (Failure "not implemented") + let get env = + return [0; 0; 0; 0] let interface = make { @@ -382,9 +381,9 @@ struct ); } - let make () = + let make env = let obus = OBus_object.make ~interfaces:[interface] (device_path "Infrareds") in - OBus_object.attach obus (); + OBus_object.attach obus env; obus end @@ -561,8 +560,11 @@ module Logic_sensors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_LogicSensors - let get_state obj = - raise_lwt (Failure "not implemented") + let get_state env = + return [false; false; false; false; + false; false; false; false; + false; false; false; false; + false; false; false; false] let interface = make { @@ -573,9 +575,9 @@ struct ); } - let make () = + let make env = let obus = OBus_object.make ~interfaces:[interface] (device_path "LogicSensors") in - OBus_object.attach obus (); + OBus_object.attach obus env; obus end @@ -748,11 +750,11 @@ module Range_finders = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_RangeFinders - let measure obj ~id = - raise_lwt (Failure "not implemented") + let measure env ~id = + return () let get obj ~id = - raise_lwt (Failure "not implemented") + return 0 let interface = make { @@ -771,9 +773,9 @@ struct ); } - let make () = + let make env = let obus = OBus_object.make ~interfaces:[interface] (device_path "RangeFinders") in - OBus_object.attach obus (); + OBus_object.attach obus env; obus end @@ -810,14 +812,14 @@ let init bus = OBus_object.export bus (Analogic_motor.make ()); OBus_object.export bus (Analogic_servos.make ()); - OBus_object.export bus (Compass.make ()); + OBus_object.export bus (Compass.make env); OBus_object.export bus (AX12.make ()); OBus_object.export bus (LCD.make window); - OBus_object.export bus (Infrareds.make ()); + OBus_object.export bus (Infrareds.make env); OBus_object.export bus (Motors.make env); OBus_object.export bus (Power.make ()); - OBus_object.export bus (Logic_sensors.make ()); - OBus_object.export bus (Range_finders.make ()); + OBus_object.export bus (Logic_sensors.make env); + OBus_object.export bus (Range_finders.make env); OBus_object.export bus (RX64.make ()); let card_interface = Card.make "Interface" in hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-17 16:03: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 2cef0721c85493392c5535b3143b1677f0d9e455 (commit) from 638aaf62dd36565cdc4d7212f3cc7c22e834c0e8 (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 2cef0721c85493392c5535b3143b1677f0d9e455 Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 17:03:33 2010 +0100 Install krobot-simulator ----------------------------------------------------------------------- Changes: diff --git a/info/control/install-programs.sh b/info/control/install-programs.sh index 053af09..4d8fd5c 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,**/*.best}) +PROGRAMS=$(echo _build/{services,driver,clients,tools,usb-tools,simulator}/{*.best,**/*.best}) for prog in $PROGRAMS; do if [ -f $prog ]; then hooks/post-receive -- krobot |
From: Xavier L. <Ba...@us...> - 2010-12-17 02:05:52
|
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 638aaf62dd36565cdc4d7212f3cc7c22e834c0e8 (commit) from 08c9adb002699e9ac3cec674e73d96519bc62ecd (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 638aaf62dd36565cdc4d7212f3cc7c22e834c0e8 Author: Xavier Lagorce <Xav...@cr...> Date: Fri Dec 17 03:03:46 2010 +0100 Added movement functionnality to the simulator with : * time-variable speed commands (move, turn) * added the duration parameter to set_velocities * correction of the several speed computations Rmq : time-variable speed commands seems to be a little error-prone ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml index 471dd05..e762f12 100644 --- a/info/control/simulator/krobot_env.ml +++ b/info/control/simulator/krobot_env.ml @@ -16,7 +16,9 @@ type state = { } type command = - | Speed of float * float + | Speed of float * float * float * float (* start_time, end_time, left_velocity, right_velocity *) + | Turn of float * float * float * float (* start_time, t1, end_time, velocity *) + | Move of float * float * float * float (* start_time, t1, end_time, velocity *) type color = | Black @@ -41,9 +43,32 @@ let time = ref 0. let velocities_of_command cmd time = match cmd with - | Speed (l_v, r_v) -> ((l_v +. r_v) *. wheels_diam /. 4., (l_v -. r_v) *. wheels_diam /. 2. /. wheels_dist) + | Speed (start, tend, l_v, r_v) -> + if time < start || time > tend then + (0., 0.) + else + ((l_v +. r_v) *. wheels_diam /. 4., (l_v -. r_v) *. wheels_diam /. wheels_dist) + | Turn (start, t1, tend, vel) -> + if time < start || time > tend then + (0., 0.) + else if time < t1 then + (0., vel *. (time -. start) /. t1) + else if time < (tend -. t1) then + (0., vel) + else + (0., vel *. (tend -. time) /. t1) + | Move (start, t1, tend, vel) -> + if time < start || time > tend then + (0., 0.) + else if time < t1 then + (vel *. (time -. start) /. t1, 0.) + else if time < (tend -. t1) then + (vel, 0.) + else + (vel *. (tend -. time) /. t1, 0.) let rec simu_loop env = + time := !time +. sim_step; let (u1, u2) = velocities_of_command env.command !time in let dx = u1 *. (cos env.state.theta) and dy = u1 *. (sin env.state.theta) @@ -53,25 +78,34 @@ let rec simu_loop env = y = env.state.y +. dy *. sim_step; theta = env.state.theta +. dtheta *. sim_step; }; - time := !time +. sim_step; lwt () = Lwt_unix.sleep sim_step in simu_loop env let create state = let env = { state = state; - command = Speed (0.,0.); + command = Speed (0.,0., 0., 0.); } in ignore (simu_loop env); env -let set_velocities env left_velocity right_velocity = - env.command <- Speed (left_velocity, right_velocity) +let move env distance velocity acceleration = + let t1 = velocity /. acceleration in + let t_end = (velocity *. velocity +. distance *. acceleration) /. (velocity *. acceleration) in + env.command <- Move (!time, t1, !time +. t_end, velocity) + +let turn env angle velocity acceleration = + let t1 = velocity /. acceleration in + let t_end = (velocity *. velocity +. angle *. acceleration) /. (velocity *. acceleration) in + env.command <- Turn (!time, t1, !time +. t_end, velocity) + +let set_velocities env left_velocity right_velocity duration = + env.command <- Speed (!time, !time +. duration, left_velocity, right_velocity) let get_velocities env = let (u1, u2) = velocities_of_command env.command !time in - let l_v = (u1 -. wheels_diam /. 2. *. u2) - and r_v = (u1 +. wheels_diam /. 2. *. u2) in + let l_v = (4. *. u1 +. wheels_dist *. u2) /. (2. *. wheels_diam) + and r_v = (4. *. u1 -. wheels_dist *. u2) /. (2. *. wheels_diam) in (l_v, r_v) let get_state env = diff --git a/info/control/simulator/krobot_env.mli b/info/control/simulator/krobot_env.mli index 51411db..bdf9840 100644 --- a/info/control/simulator/krobot_env.mli +++ b/info/control/simulator/krobot_env.mli @@ -17,7 +17,13 @@ type state = { val create : state -> t -val set_velocities : t -> float -> float -> unit +val move : t -> float -> float -> float -> unit + +val turn : t -> float -> float -> float -> unit + +val set_velocities : t -> float -> float -> float -> unit + +val get_velocities : t-> float * float val get_state : t -> state diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml index 8e51048..fdb2f5e 100644 --- a/info/control/simulator/krobot_simulator.ml +++ b/info/control/simulator/krobot_simulator.ml @@ -583,22 +583,35 @@ module Motors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Motors - let move obj ~distance ~velocity ~acceleration = - raise_lwt (Failure "not implemented") + let move env ~distance ~velocity ~acceleration = + let vel, acc = if distance >= 0. then + (abs_float velocity, abs_float acceleration) + else + (-. (abs_float velocity), -. (abs_float acceleration)) + in + Krobot_env.move env distance vel acc; + return () - let turn obj ~angle ~velocity ~acceleration = - raise_lwt (Failure "not implemented") + let turn env ~angle ~velocity ~acceleration = + let vel, acc = if angle >= 0. then + (abs_float velocity, abs_float acceleration) + else + (-. (abs_float velocity), -. (abs_float acceleration)) + in + Krobot_env.turn env angle vel acc; + return () let stop env ~motor ~mode = - Krobot_env.set_velocities env 0. 0.; + Krobot_env.set_velocities env 0. 0. 0.; return () let set_velocities env ~velocity_r ~velocity_l ~duration = - Krobot_env.set_velocities env velocity_r velocity_l; + Krobot_env.set_velocities env velocity_r velocity_l duration; return () let get_current_velocities env = - return (Krobot_env.get_velocities env) + let (l_v, r_v) = Krobot_env.get_velocities env in + return (r_v, l_v) let get_current_positions obj = raise_lwt (Failure "not implemented") hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-17 01:33:16
|
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 08c9adb002699e9ac3cec674e73d96519bc62ecd (commit) from 18ac5ec5c5e8c3b2dd768223584f11262801f5b3 (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 08c9adb002699e9ac3cec674e73d96519bc62ecd Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 02:03:15 2010 +0100 Teminates the drawing of the board in the simulator ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml index fd1c4b0..471dd05 100644 --- a/info/control/simulator/krobot_env.ml +++ b/info/control/simulator/krobot_env.ml @@ -88,28 +88,54 @@ let set_color ctx color = in Cairo.set_source_rgb ctx (r /. 255.) (g /. 255.) (b /. 255.) +let pi = 4. *. atan 1. + let draw env ctx width height = (* Draw the background *) Cairo.rectangle ctx 0. 0. width height; - set_color ctx Black; + set_color ctx White; Cairo.fill ctx; (* Compute the optimal width and height *) let dw, dh = - if width/.height >= world_width/.world_height then - (world_width /. world_height *. height, height) + if width /. height >= (world_width +. 0.204) /. (world_height +. 0.204) then + ((world_width +. 0.204) /. (world_height +. 0.204) *. height, height) else - (width, width /. world_width *. world_height) + (width, width /. (world_width +. 0.204) *. (world_height +. 0.204)) in - (* Translation to have the board at the center *) + (* Translation to have the board at the center and scaling to match the window sizes *) let x0 = (width -. dw) /. 2. and y0 = (height -. dh) /. 2. in - - (* Transformations *) - let scale = dw /. world_width in - Cairo.translate ctx x0 (y0 +. dh); + let scale = dw /. (world_width +. 0.204) in + Cairo.translate ctx (x0 +. 0.102 *. scale) (y0 +. dh -. 0.102 *. scale); Cairo.scale ctx scale (-.scale); + Cairo.set_line_width ctx (1. /. scale); + + (* Draw the borders *) + Cairo.rectangle ctx (-0.022) (-0.022) (world_width +. 0.044) (world_height +. 0.044); + set_color ctx Black; + Cairo.fill ctx; + + (* Draw beacon supports *) + Cairo.rectangle ctx (-0.102) (-0.102) 0.08 0.08; + Cairo.fill ctx; + + Cairo.rectangle ctx (-0.102) (world_height /. 2. -. 0.04) 0.08 0.08; + Cairo.fill ctx; + + Cairo.rectangle ctx (-0.102) (world_height +. 0.022) 0.08 0.08; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width +. 0.022) (-0.102) 0.08 0.08; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width +. 0.022) (world_height /. 2. -. 0.04) 0.08 0.08; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width +. 0.022) (world_height +. 0.022) 0.08 0.08; + Cairo.fill ctx; + (* Draw the board background *) Cairo.rectangle ctx 0. 0. world_width world_height; set_color ctx Green; @@ -134,6 +160,74 @@ let draw env ctx width height = done done; + (* Draw the bands *) + set_color ctx Black; + + Cairo.rectangle ctx 0.4 0. 0.05 world_height; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width -. 0.45) 0. 0.05 world_height; + Cairo.fill ctx; + + Cairo.rectangle ctx 0.45 0.33 0.7 0.02; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width -. 1.15) 0.33 0.7 0.02; + Cairo.fill ctx; + + Cairo.rectangle ctx 1.13 0. 0.02 0.35; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width -. 1.15) 0. 0.02 0.35; + Cairo.fill ctx; + + Cairo.rectangle ctx 0.45 0. 0.7 0.12; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width -. 1.15) 0. 0.7 0.12; + Cairo.fill ctx; + + Cairo.rectangle ctx 0.45 0. 0.02 0.25; + Cairo.fill ctx; + + Cairo.rectangle ctx (world_width -. 0.47) 0. 0.02 0.25; + Cairo.fill ctx; + + Cairo.move_to ctx 0. (world_height -. 0.4); + Cairo.rel_line_to ctx 0.4 0.; + Cairo.stroke ctx; + + Cairo.move_to ctx 0. (world_height -. 0.422); + Cairo.rel_line_to ctx 0.4 0.; + Cairo.stroke ctx; + + Cairo.move_to ctx (world_width -. 0.4) (world_height -. 0.4); + Cairo.rel_line_to ctx 0.4 0.; + Cairo.stroke ctx; + + Cairo.move_to ctx (world_width -. 0.4) (world_height -. 0.422); + Cairo.rel_line_to ctx 0.4 0.; + Cairo.stroke ctx; + + (* Draw circles on bonus cases *) + Cairo.arc ctx 0.975 0.875 0.05 0. (2. *. pi); + Cairo.fill ctx; + + Cairo.arc ctx 0.975 1.575 0.05 0. (2. *. pi); + Cairo.fill ctx; + + Cairo.arc ctx 2.025 0.875 0.05 0. (2. *. pi); + Cairo.fill ctx; + + Cairo.arc ctx 2.025 1.575 0.05 0. (2. *. pi); + Cairo.fill ctx; + + Cairo.arc ctx 1.325 0.175 0.05 0. (2. *. pi); + Cairo.fill ctx; + + Cairo.arc ctx 1.675 0.175 0.05 0. (2. *. pi); + Cairo.fill ctx; + (* Draw the robot *) Cairo.translate ctx env.state.x env.state.y; Cairo.rotate ctx env.state.theta; @@ -148,6 +242,5 @@ let draw env ctx width height = Cairo.line_to ctx 0. (robot_size /. 4.); Cairo.line_to ctx (robot_size /. 4.) 0.; set_color ctx Black; - Cairo.set_line_width ctx (1. /. scale); Cairo.stroke ctx hooks/post-receive -- krobot |
From: Xavier L. <Ba...@us...> - 2010-12-17 00:42:30
|
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 18ac5ec5c5e8c3b2dd768223584f11262801f5b3 (commit) from 58e13b2a681014a8d06289f25106855d79f4aa96 (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 18ac5ec5c5e8c3b2dd768223584f11262801f5b3 Author: Xavier Lagorce <Xav...@cr...> Date: Fri Dec 17 01:41:15 2010 +0100 First basic functionnal simulator * implemented basic kinematic simulation * implemented basic command * corrected the drawing of the robot's orientation * the state vector no longer contains speeds ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml index c509a20..fd1c4b0 100644 --- a/info/control/simulator/krobot_env.ml +++ b/info/control/simulator/krobot_env.ml @@ -13,9 +13,6 @@ type state = { x : float; y : float; theta : float; - vx : float; - vy : float; - vtheta : float; } type command = @@ -37,10 +34,27 @@ type t = { let world_height = 2.1 let world_width = 3. let robot_size = 0.3 +let wheels_diam = 0.098 +let wheels_dist = 0.259 +let sim_step = 0.01 +let time = ref 0. + +let velocities_of_command cmd time = + match cmd with + | Speed (l_v, r_v) -> ((l_v +. r_v) *. wheels_diam /. 4., (l_v -. r_v) *. wheels_diam /. 2. /. wheels_dist) let rec simu_loop env = - (* Simulation here *) - lwt () = Lwt_unix.sleep 0.01 in + let (u1, u2) = velocities_of_command env.command !time in + let dx = u1 *. (cos env.state.theta) + and dy = u1 *. (sin env.state.theta) + and dtheta = u2 in + env.state <- { + x = env.state.x +. dx *. sim_step; + y = env.state.y +. dy *. sim_step; + theta = env.state.theta +. dtheta *. sim_step; + }; + time := !time +. sim_step; + lwt () = Lwt_unix.sleep sim_step in simu_loop env let create state = @@ -54,6 +68,12 @@ let create state = let set_velocities env left_velocity right_velocity = env.command <- Speed (left_velocity, right_velocity) +let get_velocities env = + let (u1, u2) = velocities_of_command env.command !time in + let l_v = (u1 -. wheels_diam /. 2. *. u2) + and r_v = (u1 +. wheels_diam /. 2. *. u2) in + (l_v, r_v) + let get_state env = env.state @@ -122,11 +142,11 @@ let draw env ctx width height = Cairo.fill ctx; (* Draw an arrow on the robot *) - Cairo.move_to ctx 0. (-. robot_size /. 4.); - Cairo.line_to ctx 0. (robot_size /. 4.); - Cairo.line_to ctx (-. robot_size /. 4.) 0.; + Cairo.move_to ctx (-. robot_size /. 4.) 0.; Cairo.line_to ctx (robot_size /. 4.) 0.; + Cairo.line_to ctx 0. (-. robot_size /. 4.); Cairo.line_to ctx 0. (robot_size /. 4.); + Cairo.line_to ctx (robot_size /. 4.) 0.; set_color ctx Black; Cairo.set_line_width ctx (1. /. scale); Cairo.stroke ctx diff --git a/info/control/simulator/krobot_env.mli b/info/control/simulator/krobot_env.mli index 100dcf3..51411db 100644 --- a/info/control/simulator/krobot_env.mli +++ b/info/control/simulator/krobot_env.mli @@ -13,9 +13,6 @@ type state = { x : float; y : float; theta : float; - vx : float; - vy : float; - vtheta : float; } val create : state -> t diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml index bba2bfb..8e51048 100644 --- a/info/control/simulator/krobot_simulator.ml +++ b/info/control/simulator/krobot_simulator.ml @@ -583,25 +583,22 @@ module Motors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Motors - type t = { - ui : Krobot_ui.window; - env : Krobot_env.t; - } - let move obj ~distance ~velocity ~acceleration = raise_lwt (Failure "not implemented") let turn obj ~angle ~velocity ~acceleration = raise_lwt (Failure "not implemented") - let stop obj ~motor ~mode = - raise_lwt (Failure "not implemented") + let stop env ~motor ~mode = + Krobot_env.set_velocities env 0. 0.; + return () - let set_velocities obj ~velocity_r ~velocity_l ~duration = - raise_lwt (Failure "not implemented") + let set_velocities env ~velocity_r ~velocity_l ~duration = + Krobot_env.set_velocities env velocity_r velocity_l; + return () - let get_current_velocities obj = - raise_lwt (Failure "not implemented") + let get_current_velocities env = + return (Krobot_env.get_velocities env) let get_current_positions obj = raise_lwt (Failure "not implemented") @@ -671,9 +668,9 @@ struct ); } - let make () = + let make env = let obus = OBus_object.make ~interfaces:[interface] (device_path "Motors") in - OBus_object.attach obus (); + OBus_object.attach obus env; obus end @@ -793,8 +790,7 @@ let init bus = let window = new Krobot_ui.window () in ignore (window#window#connect#destroy ~callback:(fun () -> exit 0)); window#window#show (); - - let env = Krobot_env.create Krobot_env.({x=0.2; y=0.2; theta=atan (-1.); vx=0.; vy=0.; vtheta=0.}) in + let env = Krobot_env.create Krobot_env.({x=0.2; y=1.9; theta=(2. *. atan (-1.))}) in ignore (draw env window); (* OBus stuff *) @@ -805,7 +801,7 @@ let init bus = OBus_object.export bus (AX12.make ()); OBus_object.export bus (LCD.make window); OBus_object.export bus (Infrareds.make ()); - OBus_object.export bus (Motors.make ()); + OBus_object.export bus (Motors.make env); OBus_object.export bus (Power.make ()); OBus_object.export bus (Logic_sensors.make ()); OBus_object.export bus (Range_finders.make ()); hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-17 00:02: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 58e13b2a681014a8d06289f25106855d79f4aa96 (commit) from 63b120bb370e8951e76c1416973f8d9e6d51115f (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 58e13b2a681014a8d06289f25106855d79f4aa96 Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 01:01:37 2010 +0100 Inverts the Y axis for the drawing in Krobot_env ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml index 61f94bc..c509a20 100644 --- a/info/control/simulator/krobot_env.ml +++ b/info/control/simulator/krobot_env.ml @@ -87,8 +87,8 @@ let draw env ctx width height = (* Transformations *) let scale = dw /. world_width in - Cairo.translate ctx x0 y0; - Cairo.scale ctx scale scale; + Cairo.translate ctx x0 (y0 +. dh); + Cairo.scale ctx scale (-.scale); (* Draw the board background *) Cairo.rectangle ctx 0. 0. world_width world_height; @@ -96,10 +96,10 @@ let draw env ctx width height = Cairo.fill ctx; (* Draw the starting areas *) - Cairo.rectangle ctx 0. 0. 0.4 0.4; + Cairo.rectangle ctx 0. (world_height -. 0.4) 0.4 0.4; set_color ctx Red; Cairo.fill ctx; - Cairo.rectangle ctx (world_width -. 0.4) 0. 0.4 0.4; + Cairo.rectangle ctx (world_width -. 0.4) (world_height -. 0.4) 0.4 0.4; set_color ctx Blue; Cairo.fill ctx; @@ -109,7 +109,7 @@ let draw env ctx width height = let x = 0.45 +. 0.35 *. float i and y = 0.35 *. float j in Cairo.rectangle ctx x y 0.35 0.35; - set_color ctx (if (i + j) mod 2 = 0 then Blue else Red); + set_color ctx (if (i + j) mod 2 = 0 then Red else Blue); Cairo.fill ctx done done; hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-16 23:49:13
|
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 63b120bb370e8951e76c1416973f8d9e6d51115f (commit) from 8b0308f56f408299fc6c5ccf447c114efdd548d6 (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 63b120bb370e8951e76c1416973f8d9e6d51115f Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 00:48:31 2010 +0100 Uses Cairo.scale and Cairo.translate to transform the drawing in Krobot_env ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml index 283987e..61f94bc 100644 --- a/info/control/simulator/krobot_env.ml +++ b/info/control/simulator/krobot_env.ml @@ -69,47 +69,65 @@ let set_color ctx color = Cairo.set_source_rgb ctx (r /. 255.) (g /. 255.) (b /. 255.) let draw env ctx width height = + (* Draw the background *) Cairo.rectangle ctx 0. 0. width height; set_color ctx Black; Cairo.fill ctx; + + (* Compute the optimal width and height *) let dw, dh = if width/.height >= world_width/.world_height then (world_width /. world_height *. height, height) else (width, width /. world_width *. world_height) in + + (* Translation to have the board at the center *) let x0 = (width -. dw) /. 2. and y0 = (height -. dh) /. 2. in + + (* Transformations *) let scale = dw /. world_width in - Cairo.rectangle ctx x0 y0 dw dh; + Cairo.translate ctx x0 y0; + Cairo.scale ctx scale scale; + + (* Draw the board background *) + Cairo.rectangle ctx 0. 0. world_width world_height; set_color ctx Green; Cairo.fill ctx; - Cairo.rectangle ctx x0 y0 (0.4 *. scale) (0.4 *. scale); + + (* Draw the starting areas *) + Cairo.rectangle ctx 0. 0. 0.4 0.4; set_color ctx Red; Cairo.fill ctx; - Cairo.rectangle ctx (x0 +. dw -. 0.4 *. scale) y0 (0.4 *. scale) (0.4 *. scale); + Cairo.rectangle ctx (world_width -. 0.4) 0. 0.4 0.4; set_color ctx Blue; Cairo.fill ctx; + + (* Draw the paving *) for i = 0 to 5 do for j = 0 to 5 do - let x = x0 +. scale *. (0.45 +. 0.35 *. float i) - and y = y0 +. scale *. (0.35 *. float j) in - Cairo.rectangle ctx x y (scale *. 0.35) (scale *. 0.35); - if (i+j) mod 2 = 0 then - set_color ctx Blue - else - set_color ctx Red; + let x = 0.45 +. 0.35 *. float i + and y = 0.35 *. float j in + Cairo.rectangle ctx x y 0.35 0.35; + set_color ctx (if (i + j) mod 2 = 0 then Blue else Red); Cairo.fill ctx done done; - Cairo.translate ctx (x0 +. scale *. env.state.x) (y0 +. scale *. env.state.y); + + (* Draw the robot *) + Cairo.translate ctx env.state.x env.state.y; Cairo.rotate ctx env.state.theta; - Cairo.rectangle ctx (-. scale *. robot_size /. 2.) (-. scale *. robot_size /. 2.) (scale *. robot_size) (scale *. robot_size); + Cairo.rectangle ctx (-. robot_size /. 2.) (-. robot_size /. 2.) robot_size robot_size; set_color ctx White; Cairo.fill ctx; - Cairo.move_to ctx 0. (-.scale *. robot_size/.4.); - Cairo.line_to ctx 0. (scale *. robot_size/.4.); - Cairo.line_to ctx (-.scale *. robot_size/.4.) 0.; - Cairo.line_to ctx (scale *. robot_size/.4.) 0.; - Cairo.line_to ctx 0. (scale *. robot_size/.4.); + + (* Draw an arrow on the robot *) + Cairo.move_to ctx 0. (-. robot_size /. 4.); + Cairo.line_to ctx 0. (robot_size /. 4.); + Cairo.line_to ctx (-. robot_size /. 4.) 0.; + Cairo.line_to ctx (robot_size /. 4.) 0.; + Cairo.line_to ctx 0. (robot_size /. 4.); set_color ctx Black; + Cairo.set_line_width ctx (1. /. scale); Cairo.stroke ctx + hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-16 23:24:24
|
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 8b0308f56f408299fc6c5ccf447c114efdd548d6 (commit) from 0455ecfb82041ad07d2fea1a7dfb385e9a90648f (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 8b0308f56f408299fc6c5ccf447c114efdd548d6 Author: Jérémie Dimino <je...@di...> Date: Fri Dec 17 00:23:55 2010 +0100 Finish surfaces when done drawing ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml index 2471ea9..bba2bfb 100644 --- a/info/control/simulator/krobot_simulator.ml +++ b/info/control/simulator/krobot_simulator.ml @@ -462,7 +462,8 @@ struct let ctx = Cairo_lablgtk.create lcd.ui#lcd#misc#window in Cairo.set_source_surface ctx surface 0. 0.; Cairo.rectangle ctx 0. 0. (float width) (float height); - Cairo.fill ctx + Cairo.fill ctx; + Cairo.surface_finish surface let add_char lcd ch = lcd.chars.(lcd.line).(lcd.column) <- ch; @@ -779,6 +780,7 @@ let rec draw env window = Cairo.set_source_surface ctx surface 0. 0.; Cairo.rectangle ctx 0. 0. (float width) (float height); Cairo.fill ctx; + Cairo.surface_finish surface; lwt () = Lwt_unix.sleep 0.04 in draw env window hooks/post-receive -- krobot |
From: Xavier L. <Ba...@us...> - 2010-12-16 23:14:22
|
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 0455ecfb82041ad07d2fea1a7dfb385e9a90648f (commit) from 9ddddc1f1c5e0a75a155757750aaf5c65f79d220 (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 0455ecfb82041ad07d2fea1a7dfb385e9a90648f Author: Xavier Lagorce <Xav...@cr...> Date: Fri Dec 17 00:13:16 2010 +0100 Initial import of an environnement simulator ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_env.ml b/info/control/simulator/krobot_env.ml new file mode 100644 index 0000000..283987e --- /dev/null +++ b/info/control/simulator/krobot_env.ml @@ -0,0 +1,115 @@ +(* + * krobot_env.ml + * ------------- + * Copyright : (c) 2010, Xavier Lagorce <Xav...@cr...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +open React + +type state = { + x : float; + y : float; + theta : float; + vx : float; + vy : float; + vtheta : float; +} + +type command = + | Speed of float * float + +type color = + | Black + | White + | Green + | Red + | Blue + | Yellow + +type t = { + mutable state : state; + mutable command : command; +} + +let world_height = 2.1 +let world_width = 3. +let robot_size = 0.3 + +let rec simu_loop env = + (* Simulation here *) + lwt () = Lwt_unix.sleep 0.01 in + simu_loop env + +let create state = + let env = { + state = state; + command = Speed (0.,0.); + } in + ignore (simu_loop env); + env + +let set_velocities env left_velocity right_velocity = + env.command <- Speed (left_velocity, right_velocity) + +let get_state env = + env.state + +let set_color ctx color = + let r, g, b = match color with + | Black -> (0., 0., 0.) + | White -> (255., 255., 255.) + | Green -> (36., 145., 64.) + | Red -> (199., 23., 18.) + | Blue -> (0., 59., 128.) + | Yellow -> (252., 189., 31.) + in + Cairo.set_source_rgb ctx (r /. 255.) (g /. 255.) (b /. 255.) + +let draw env ctx width height = + Cairo.rectangle ctx 0. 0. width height; + set_color ctx Black; + Cairo.fill ctx; + let dw, dh = + if width/.height >= world_width/.world_height then + (world_width /. world_height *. height, height) + else + (width, width /. world_width *. world_height) + in + let x0 = (width -. dw) /. 2. and y0 = (height -. dh) /. 2. in + let scale = dw /. world_width in + Cairo.rectangle ctx x0 y0 dw dh; + set_color ctx Green; + Cairo.fill ctx; + Cairo.rectangle ctx x0 y0 (0.4 *. scale) (0.4 *. scale); + set_color ctx Red; + Cairo.fill ctx; + Cairo.rectangle ctx (x0 +. dw -. 0.4 *. scale) y0 (0.4 *. scale) (0.4 *. scale); + set_color ctx Blue; + Cairo.fill ctx; + for i = 0 to 5 do + for j = 0 to 5 do + let x = x0 +. scale *. (0.45 +. 0.35 *. float i) + and y = y0 +. scale *. (0.35 *. float j) in + Cairo.rectangle ctx x y (scale *. 0.35) (scale *. 0.35); + if (i+j) mod 2 = 0 then + set_color ctx Blue + else + set_color ctx Red; + Cairo.fill ctx + done + done; + Cairo.translate ctx (x0 +. scale *. env.state.x) (y0 +. scale *. env.state.y); + Cairo.rotate ctx env.state.theta; + Cairo.rectangle ctx (-. scale *. robot_size /. 2.) (-. scale *. robot_size /. 2.) (scale *. robot_size) (scale *. robot_size); + set_color ctx White; + Cairo.fill ctx; + Cairo.move_to ctx 0. (-.scale *. robot_size/.4.); + Cairo.line_to ctx 0. (scale *. robot_size/.4.); + Cairo.line_to ctx (-.scale *. robot_size/.4.) 0.; + Cairo.line_to ctx (scale *. robot_size/.4.) 0.; + Cairo.line_to ctx 0. (scale *. robot_size/.4.); + set_color ctx Black; + Cairo.stroke ctx diff --git a/info/control/simulator/krobot_env.mli b/info/control/simulator/krobot_env.mli new file mode 100644 index 0000000..100dcf3 --- /dev/null +++ b/info/control/simulator/krobot_env.mli @@ -0,0 +1,28 @@ +(* + * krobot_env.mli + * -------------- + * Copyright : (c) 2010, Xavier Lagorce <Xav...@cr...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +type t + +type state = { + x : float; + y : float; + theta : float; + vx : float; + vy : float; + vtheta : float; +} + +val create : state -> t + +val set_velocities : t -> float -> float -> unit + +val get_state : t -> state + +val draw : t -> Cairo.t -> float -> float -> unit + diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml index ad94e0d..2471ea9 100644 --- a/info/control/simulator/krobot_simulator.ml +++ b/info/control/simulator/krobot_simulator.ml @@ -2,6 +2,7 @@ * krobot_simulator.ml * ------------------- * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Copyright : (c) 2010, Xavier Lagorce <Xav...@cr...> * Licence : BSD3 * * This file is a part of [kro]bot. @@ -581,6 +582,11 @@ module Motors = struct open Krobot_dbus_driver.Fr_krobot_LowLevel_Motors + type t = { + ui : Krobot_ui.window; + env : Krobot_env.t; + } + let move obj ~distance ~velocity ~acceleration = raise_lwt (Failure "not implemented") @@ -764,6 +770,18 @@ end | Entry point | +-----------------------------------------------------------------+ *) +let rec draw env window = + let { Gtk.width; Gtk.height } = window#scene#misc#allocation in + let surface = Cairo.image_surface_create Cairo.FORMAT_ARGB32 width height in + let ctx = Cairo.create surface in + Krobot_env.draw env ctx (float width) (float height); + let ctx = Cairo_lablgtk.create window#scene#misc#window in + Cairo.set_source_surface ctx surface 0. 0.; + Cairo.rectangle ctx 0. 0. (float width) (float height); + Cairo.fill ctx; + lwt () = Lwt_unix.sleep 0.04 in + draw env window + let init bus = (* GTK stuff *) @@ -774,6 +792,9 @@ let init bus = ignore (window#window#connect#destroy ~callback:(fun () -> exit 0)); window#window#show (); + let env = Krobot_env.create Krobot_env.({x=0.2; y=0.2; theta=atan (-1.); vx=0.; vy=0.; vtheta=0.}) in + ignore (draw env window); + (* OBus stuff *) OBus_object.export bus (Analogic_motor.make ()); diff --git a/info/control/simulator/krobot_ui.glade b/info/control/simulator/krobot_ui.glade index aff284f..ade135a 100644 --- a/info/control/simulator/krobot_ui.glade +++ b/info/control/simulator/krobot_ui.glade @@ -152,6 +152,8 @@ <child> <widget class="GtkDrawingArea" id="scene"> <property name="visible">True</property> + <property name="app_paintable">True</property> + <property name="double_buffered">False</property> </widget> <packing> <property name="position">0</property> hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-16 17:16:21
|
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 9ddddc1f1c5e0a75a155757750aaf5c65f79d220 (commit) from 796ece21281f664d3d35e6371b27a1228ce1be17 (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 9ddddc1f1c5e0a75a155757750aaf5c65f79d220 Author: Jérémie Dimino <je...@di...> Date: Thu Dec 16 18:15:26 2010 +0100 Simulator UI tweaking ----------------------------------------------------------------------- Changes: diff --git a/info/control/simulator/krobot_ui.glade b/info/control/simulator/krobot_ui.glade index a10e90b..aff284f 100644 --- a/info/control/simulator/krobot_ui.glade +++ b/info/control/simulator/krobot_ui.glade @@ -3,11 +3,202 @@ <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy project-wide --> <widget class="GtkWindow" id="window"> + <property name="default_width">1024</property> + <property name="default_height">768</property> <child> - <widget class="GtkDrawingArea" id="lcd"> - <property name="width_request">404</property> - <property name="height_request">97</property> + <widget class="GtkVBox" id="vbox1"> <property name="visible">True</property> + <property name="orientation">vertical</property> + <child> + <widget class="GtkMenuBar" id="menubar1"> + <property name="visible">True</property> + <child> + <widget class="GtkMenuItem" id="menuitem1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Fichier</property> + <property name="use_underline">True</property> + <child> + <widget class="GtkMenu" id="menu1"> + <property name="visible">True</property> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem1"> + <property name="label">gtk-new</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem2"> + <property name="label">gtk-open</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem3"> + <property name="label">gtk-save</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem4"> + <property name="label">gtk-save-as</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkSeparatorMenuItem" id="separatormenuitem1"> + <property name="visible">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem5"> + <property name="label">gtk-quit</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkMenuItem" id="menuitem2"> + <property name="visible">True</property> + <property name="label" translatable="yes">É_dition</property> + <property name="use_underline">True</property> + <child> + <widget class="GtkMenu" id="menu2"> + <property name="visible">True</property> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem6"> + <property name="label">gtk-cut</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem7"> + <property name="label">gtk-copy</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem8"> + <property name="label">gtk-paste</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem9"> + <property name="label">gtk-delete</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + <child> + <widget class="GtkMenuItem" id="menuitem3"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Affichage</property> + <property name="use_underline">True</property> + </widget> + </child> + <child> + <widget class="GtkMenuItem" id="menuitem4"> + <property name="visible">True</property> + <property name="label" translatable="yes">Aid_e</property> + <property name="use_underline">True</property> + <child> + <widget class="GtkMenu" id="menu3"> + <property name="visible">True</property> + <child> + <widget class="GtkImageMenuItem" id="imagemenuitem10"> + <property name="label">gtk-about</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkHBox" id="hbox1"> + <property name="visible">True</property> + <child> + <widget class="GtkDrawingArea" id="scene"> + <property name="visible">True</property> + </widget> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="orientation">vertical</property> + <child> + <widget class="GtkDrawingArea" id="lcd"> + <property name="width_request">404</property> + <property name="height_request">97</property> + <property name="visible">True</property> + <property name="app_paintable">True</property> + <property name="double_buffered">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <widget class="GtkViewport" id="viewport1"> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> </widget> </child> </widget> hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-16 09:52: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 796ece21281f664d3d35e6371b27a1228ce1be17 (commit) via b46859ba6b03ef287728f7169dbe891ed7ca112e (commit) from f1d7f0f3631c740eddf7d9f8565c63618beda0a3 (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 796ece21281f664d3d35e6371b27a1228ce1be17 Author: Jérémie Dimino <dim@arrakis.(none)> Date: Thu Dec 16 10:52:06 2010 +0100 Simulate the LCD commit b46859ba6b03ef287728f7169dbe891ed7ca112e Author: Jérémie Dimino <dim@arrakis.(none)> Date: Wed Dec 15 22:46:37 2010 +0100 add skeleton for the simulator ----------------------------------------------------------------------- Changes: diff --git a/info/control/_tags b/info/control/_tags index 4dfe115..8c8133a 100644 --- a/info/control/_tags +++ b/info/control/_tags @@ -18,3 +18,6 @@ # The python generator needs to read IDL files <python/generate.*>: package(obus.idl) + +# The simulator uses GTK +<simulator/*>: package(lablgtk2), package(lablgtk2.glade), package(cairo), package(cairo.lablgtk2), package(lwt.glib) diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index 30c0a74..0ee77b7 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -33,6 +33,9 @@ let have_obus = try_exec "ocamlfind query obus" let have_lwt_text = try_exec "ocamlfind query lwt.text" let have_usb = try_exec "ocamlfind query usb" let have_serial = try_exec "ocamlfind query serial" +let have_lwt_glib = try_exec "ocamlfind query lwt.glib" +let have_lablgtk2 = try_exec "ocamlfind query lablgtk2" +let have_cairo = try_exec "ocamlfind query cairo" let () = let yes_no = function true -> "yes" | false -> "no" in @@ -99,6 +102,9 @@ let targets = List.filter_opt (function (true, target) -> Some target | (false, (* Python *) (true, "python/generate.best"); + + (* Simulator *) + (have_cairo && have_lablgtk2 && have_lwt_glib, "simulator/krobot_simulator.best"); ] (* +-----------------------------------------------------------------+ @@ -131,6 +137,7 @@ let _ = +---------------------------------------------------------+ *) Pathname.define_context "driver" ["protocol"; "common"]; + Pathname.define_context "simulator" ["protocol"; "common"]; Pathname.define_context "manager" ["protocol"; "common"; "lib-krobot"]; Pathname.define_context "common" ["protocol"]; Pathname.define_context "usb-tools" ["common"; "driver"]; @@ -154,6 +161,14 @@ let _ = (fun env _ -> Cmd(S[A"obus-gen-interface"; A"-o"; A(env "%"); A(env "%.obus")])); (* +---------------------------------------------------------+ + | Glade | + +---------------------------------------------------------+ *) + + rule ".glade -> .ml" ~dep:"%.glade" ~prod:"%.ml" + (fun env _ -> + Cmd(S[A"lablgladecc2"; A"-embed"; A(env "%.glade"); Sh">"; A(env "%.ml")])); + + (* +---------------------------------------------------------+ | Autogenerated files | +---------------------------------------------------------+ *) diff --git a/info/control/simulator/krobot_simulator.ml b/info/control/simulator/krobot_simulator.ml new file mode 100644 index 0000000..ad94e0d --- /dev/null +++ b/info/control/simulator/krobot_simulator.ml @@ -0,0 +1,805 @@ +(* + * krobot_simulator.ml + * ------------------- + * Copyright : (c) 2010, Jeremie Dimino <je...@di...> + * Licence : BSD3 + * + * This file is a part of [kro]bot. + *) + +(* The [kro]bot simulator. + + This program replace the driver by simulating the robot. *) + +let section = Lwt_log.Section.make "simulator" + +open Lwt + +(* +-----------------------------------------------------------------+ + | Devices | + +-----------------------------------------------------------------+ *) + +let device_path name = ["fr"; "krobot"; "Devices"; name] + +module Analogic_motor = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicMotor + + let set_state obj ~state = + raise_lwt (Failure "not implemented") + + let set_velocity obj ~velocity ~duration = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_set_state = ( + fun obj state -> + lwt () = set_state (OBus_object.get obj) state in + return () + ); + m_set_velocity = ( + fun obj (velocity, duration) -> + let velocity = Int32.to_int velocity in + lwt () = set_velocity (OBus_object.get obj) velocity duration in + return () + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AnalogicMotor") in + OBus_object.attach obus (); + obus +end + +module Analogic_servos = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_AnalogicServos + + let set_config obj ~enable ~disable = + raise_lwt (Failure "not implemented") + + let set_state obj ~states = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_set_config = ( + fun obj (enable, disable) -> + let enable = List.map Int32.to_int enable in + let disable = List.map Int32.to_int disable in + lwt () = set_config (OBus_object.get obj) enable disable in + return () + ); + m_set_state = ( + fun obj states -> + let states = List.map (fun (k, v) -> (Int32.to_int k, Int32.to_int v)) states in + lwt () = set_state (OBus_object.get obj) states in + return () + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AnalogicServos") in + OBus_object.attach obus (); + obus +end + +module Card = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Card + + let make name = + let obus = + OBus_object.make + ~interfaces:[make { + p_name = (fun obj -> React.S.const name); + p_state = (fun obj -> React.S.const (cast_state `Up)); + }] + ["fr"; "krobot"; "Cards"; name] + in + OBus_object.attach obus (); + obus +end + +module Compass = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Compass + + + let get_measure obj = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_get_measure = ( + fun obj () -> + lwt value = get_measure (OBus_object.get obj) in + let value = Int32.of_int value in + return value + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Compass") in + OBus_object.attach obus (); + obus +end + +module AX12 = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Dynamixel + + type readable_register = type_readable_register + type writable_register = type_writable_register + type exec_mode = type_exec_mode + + let ping obj ~id = + raise_lwt (Failure "not implemented") + + let action obj ~id = + raise_lwt (Failure "not implemented") + + let reset obj ~id = + raise_lwt (Failure "not implemented") + + let get obj ~id ~address = + raise_lwt (Failure "not implemented") + + let set obj ~id ~address ~value = + raise_lwt (Failure "not implemented") + + let reg_set obj ~id ~address ~value = + raise_lwt (Failure "not implemented") + + let goto obj ~id ~position ~speed ~mode = + raise_lwt (Failure "not implemented") + + let config obj ~id = + raise_lwt (Failure "not implemented") + + let get_position obj ~id = + raise_lwt (Failure "not implemented") + + let get_speed obj ~id = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_ping = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = ping (OBus_object.get obj) id in + return () + ); + m_action = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = action (OBus_object.get obj) id in + return () + ); + m_reset = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = reset (OBus_object.get obj) id in + return () + ); + m_get = ( + fun obj (id, address) -> + let id = Int32.to_int id in + let address = make_readable_register address in + lwt value = get (OBus_object.get obj) id address in + let value = Int32.of_int value in + return value + ); + m_set = ( + fun 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 () = set (OBus_object.get obj) id address value in + return () + ); + m_reg_set = ( + fun 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 () = reg_set (OBus_object.get obj) id address value in + return () + ); + m_goto = ( + fun obj (id, position, speed, mode) -> + let id = Int32.to_int id in + let position = Int32.to_int position in + let speed = Int32.to_int speed in + let mode = make_exec_mode mode in + lwt () = goto (OBus_object.get obj) id position speed mode in + return () + ); + m_config = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = config (OBus_object.get obj) id in + return () + ); + m_get_position = ( + fun obj id -> + let id = Int32.to_int id in + lwt position = get_position (OBus_object.get obj) id in + let position = Int32.of_int position in + return position + ); + m_get_speed = ( + fun obj id -> + let id = Int32.to_int id in + lwt speed = get_speed (OBus_object.get obj) id in + let speed = Int32.of_int speed in + return speed + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "AX12") in + OBus_object.attach obus (); + obus +end + +module RX64 = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Dynamixel + + type readable_register = type_readable_register + type writable_register = type_writable_register + type exec_mode = type_exec_mode + + let ping obj ~id = + raise_lwt (Failure "not implemented") + + let action obj ~id = + raise_lwt (Failure "not implemented") + + let reset obj ~id = + raise_lwt (Failure "not implemented") + + let get obj ~id ~address = + raise_lwt (Failure "not implemented") + + let set obj ~id ~address ~value = + raise_lwt (Failure "not implemented") + + let reg_set obj ~id ~address ~value = + raise_lwt (Failure "not implemented") + + let goto obj ~id ~position ~speed ~mode = + raise_lwt (Failure "not implemented") + + let config obj ~id = + raise_lwt (Failure "not implemented") + + let get_position obj ~id = + raise_lwt (Failure "not implemented") + + let get_speed obj ~id = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_ping = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = ping (OBus_object.get obj) id in + return () + ); + m_action = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = action (OBus_object.get obj) id in + return () + ); + m_reset = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = reset (OBus_object.get obj) id in + return () + ); + m_get = ( + fun obj (id, address) -> + let id = Int32.to_int id in + let address = make_readable_register address in + lwt value = get (OBus_object.get obj) id address in + let value = Int32.of_int value in + return value + ); + m_set = ( + fun 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 () = set (OBus_object.get obj) id address value in + return () + ); + m_reg_set = ( + fun 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 () = reg_set (OBus_object.get obj) id address value in + return () + ); + m_goto = ( + fun obj (id, position, speed, mode) -> + let id = Int32.to_int id in + let position = Int32.to_int position in + let speed = Int32.to_int speed in + let mode = make_exec_mode mode in + lwt () = goto (OBus_object.get obj) id position speed mode in + return () + ); + m_config = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = config (OBus_object.get obj) id in + return () + ); + m_get_position = ( + fun obj id -> + let id = Int32.to_int id in + lwt position = get_position (OBus_object.get obj) id in + let position = Int32.of_int position in + return position + ); + m_get_speed = ( + fun obj id -> + let id = Int32.to_int id in + lwt speed = get_speed (OBus_object.get obj) id in + let speed = Int32.of_int speed in + return speed + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "RX64") in + OBus_object.attach obus (); + obus +end + +module Infrareds = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Infrareds + + let get obj = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_get = ( + fun obj () -> + lwt states = get (OBus_object.get obj) in + let states = List.map Int32.of_int states in + return states + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Infrareds") in + OBus_object.attach obus (); + obus +end + +module LCD = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_LCD + + type t = { + ui : Krobot_ui.window; + chars : char array array; + mutable line : int; + mutable column : int; + mutable cursor : bool; + mutable backlight : bool; + } + + let lines = 3 + let columns = 20 + let inter = 4. + let border = 2. + + type colors = { + background : float * float * float; + text_background : float * float * float; + text_foreground : float * float * float; + } + + let colors_light = { + background = (0.4, 0.4, 1.0); + text_background = (0.0, 0.0, 0.7); + text_foreground = (1.0, 1.0, 1.0); + } + + let colors_dark = { + background = (0.1, 0.1, 0.25); + text_background = (0.0, 0.0, 0.7 /. 4.); + text_foreground = (0.25, 0.25, 0.25); + } + + let set_color ctx (r, g, b) = + Cairo.set_source_rgb ctx r g b + + let draw lcd = + let colors = if lcd.backlight then colors_light else colors_dark in + let { Gtk.width; Gtk.height } = lcd.ui#lcd#misc#allocation in + let surface = Cairo.image_surface_create Cairo.FORMAT_ARGB32 width height in + let ctx = Cairo.create surface in + Cairo.select_font_face ctx "Monospace" Cairo.FONT_SLANT_NORMAL Cairo.FONT_WEIGHT_NORMAL; + Cairo.set_font_size ctx 20.; + set_color ctx colors.background; + Cairo.rectangle ctx 0. 0. (float width) (float height); + Cairo.fill ctx; + let { Cairo.max_x_advance = fw; + Cairo.font_height = fh; + Cairo.descent = descent } = Cairo.font_extents ctx in + for line = 0 to lines - 1 do + for column = 0 to columns - 1 do + let x = inter +. (fw +. inter +. border *. 2.0) *. float column + and y = inter +. (fh +. inter +. border *. 2.0) *. float line in + set_color ctx colors.text_background; + Cairo.rectangle ctx x y (fw +. border *. 2.0) (fh +. border *. 2.0); + Cairo.fill ctx; + Cairo.move_to ctx (x +. border) (y +. fh -. descent +. border); + set_color ctx colors.text_foreground; + Cairo.show_text ctx (Text.char (Char.code lcd.chars.(line).(column))) + done + done; + if lcd.cursor then begin + let x = inter +. (fw +. inter +. border *. 2.0) *. float lcd.column + and y = inter +. (fh +. inter +. border *. 2.0) *. float lcd.line in + set_color ctx colors.text_foreground; + Cairo.rectangle ctx x y (fw +. border *. 2.0) (fh +. border *. 2.0); + Cairo.fill ctx + end; + let ctx = Cairo_lablgtk.create lcd.ui#lcd#misc#window in + Cairo.set_source_surface ctx surface 0. 0.; + Cairo.rectangle ctx 0. 0. (float width) (float height); + Cairo.fill ctx + + let add_char lcd ch = + lcd.chars.(lcd.line).(lcd.column) <- ch; + if lcd.column + 1 < columns then + lcd.column <- lcd.column + 1 + else if lcd.line + 1 < lines then begin + lcd.line <- lcd.line + 1; + lcd.column <- 0 + end else begin + lcd.line <- 0; + lcd.column <- 0 + end + + let clear lcd = + Array.iter (fun line -> Array.fill line 0 columns ' ') lcd.chars; + lcd.column <- 0; + lcd.line <- 0; + draw lcd + + let set_cursor lcd ~state = + lcd.cursor <- state; + draw lcd + + let set_backlight lcd ~state = + lcd.backlight <- state; + draw lcd + + let goto lcd ~line ~column = + lcd.line <- line mod lines; + lcd.column <- column mod columns; + draw lcd + + let write lcd ~text = + String.iter (add_char lcd) text; + draw lcd + + let write_line lcd ~line ~text = + lcd.line <- line mod lines; + lcd.column <- 0; + write lcd text + + let interface = + make { + m_clear = ( + fun obj () -> + clear (OBus_object.get obj); + return () + ); + m_set_cursor = ( + fun obj state -> + set_cursor (OBus_object.get obj) state; + return () + ); + m_set_backlight = ( + fun obj state -> + set_backlight (OBus_object.get obj) state; + return () + ); + m_goto = ( + fun obj (line, column) -> + let line = Int32.to_int line in + let column = Int32.to_int column in + goto (OBus_object.get obj) line column; + return () + ); + m_write = ( + fun obj text -> + write (OBus_object.get obj) ~text; + return () + ); + m_write_line = ( + fun obj (line, text) -> + let line = Int32.to_int line in + write_line (OBus_object.get obj) line text; + return () + ); + } + + let make ui = + let obus = OBus_object.make ~interfaces:[interface] (device_path "LCD") in + let lcd = { + ui = ui; + chars = Array.make_matrix lines columns ' '; + line = 0; + column = 0; + cursor = true; + backlight = true; + } in + OBus_object.attach obus lcd; + ignore (ui#lcd#event#connect#expose (fun ev -> draw lcd; true)); + obus +end + +module Logic_sensors = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_LogicSensors + + let get_state obj = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_get_state = ( + fun obj () -> + lwt logic_sensors = get_state (OBus_object.get obj) in + return logic_sensors + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "LogicSensors") in + OBus_object.attach obus (); + obus +end + +module Motors = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Motors + + let move obj ~distance ~velocity ~acceleration = + raise_lwt (Failure "not implemented") + + let turn obj ~angle ~velocity ~acceleration = + raise_lwt (Failure "not implemented") + + let stop obj ~motor ~mode = + raise_lwt (Failure "not implemented") + + let set_velocities obj ~velocity_r ~velocity_l ~duration = + raise_lwt (Failure "not implemented") + + let get_current_velocities obj = + raise_lwt (Failure "not implemented") + + let get_current_positions obj = + raise_lwt (Failure "not implemented") + + let get_config obj = + raise_lwt (Failure "not implemented") + + let set_config obj ~motor ~kp ~ki ~kd ~li = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_move = ( + fun obj (distance, velocity, acceleration) -> + lwt () = move (OBus_object.get obj) distance velocity acceleration in + return () + ); + m_turn = ( + fun obj (angle, velocity, acceleration) -> + lwt () = turn (OBus_object.get obj) angle velocity acceleration in + return () + ); + m_stop = ( + fun obj (motor, mode) -> + let motor = make_motor motor in + let mode = make_stop_mode mode in + lwt () = stop (OBus_object.get obj) motor mode in + return () + ); + m_set_velocities = ( + fun obj (velocity_r, velocity_l, duration) -> + lwt () = set_velocities (OBus_object.get obj) velocity_r velocity_l duration in + return () + ); + m_get_current_velocities = ( + fun obj () -> + lwt (velocity_r, velocity_l) = get_current_velocities (OBus_object.get obj) in + return (velocity_r, velocity_l) + ); + m_get_current_positions = ( + fun obj () -> + lwt (position_r, position_l) = get_current_positions (OBus_object.get obj) in + return (position_r, position_l) + ); + m_get_config = ( + fun obj () -> + lwt (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l) = get_config (OBus_object.get obj) in + 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 + return (kp_r, ki_r, kd_r, li_r, kp_l, ki_l, kd_l, li_l) + ); + m_set_config = ( + fun obj (motor, kp, ki, kd, li) -> + let motor = make_motor motor in + let kp = Int32.to_int kp in + let ki = Int32.to_int ki in + let kd = Int32.to_int kd in + let li = Int32.to_int li in + lwt () = set_config (OBus_object.get obj) motor kp ki kd li in + return () + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Motors") in + OBus_object.attach obus (); + obus +end + +module Power = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_Power + + let set_buzzer_state obj ~state = + raise_lwt (Failure "not implemented") + + let get_cell_voltage obj = + raise_lwt (Failure "not implemented") + + let get_current obj = + raise_lwt (Failure "not implemented") + + let get_power_state obj = + raise_lwt (Failure "not implemented") + + let get_battery_state obj = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_set_buzzer_state = ( + fun obj state -> + lwt () = set_buzzer_state (OBus_object.get obj) state in + return () + ); + m_get_cell_voltage = ( + fun obj () -> + lwt states = get_cell_voltage (OBus_object.get obj) in + let states = List.map Int32.of_int states in + return states + ); + m_get_current = ( + fun obj () -> + lwt current = get_current (OBus_object.get obj) in + let current = Int32.of_int current in + return current + ); + m_get_power_state = ( + fun obj () -> + lwt state = get_power_state (OBus_object.get obj) in + return state + ); + m_get_battery_state = ( + fun obj () -> + lwt state = get_battery_state (OBus_object.get obj) in + let state = cast_battery_state state in + return state + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "Power") in + OBus_object.attach obus (); + obus +end + +module Range_finders = +struct + open Krobot_dbus_driver.Fr_krobot_LowLevel_RangeFinders + + let measure obj ~id = + raise_lwt (Failure "not implemented") + + let get obj ~id = + raise_lwt (Failure "not implemented") + + let interface = + make { + m_measure = ( + fun obj id -> + let id = Int32.to_int id in + lwt () = measure (OBus_object.get obj) id in + return () + ); + m_get = ( + fun obj id -> + let id = Int32.to_int id in + lwt value = get (OBus_object.get obj) id in + let value = Int32.of_int value in + return value + ); + } + + let make () = + let obus = OBus_object.make ~interfaces:[interface] (device_path "RangeFinders") in + OBus_object.attach obus (); + obus +end + +(* +-----------------------------------------------------------------+ + | Entry point | + +-----------------------------------------------------------------+ *) + +let init bus = + (* GTK stuff *) + + Lwt_glib.install (); + ignore (GMain.init ()); + + let window = new Krobot_ui.window () in + ignore (window#window#connect#destroy ~callback:(fun () -> exit 0)); + window#window#show (); + + (* OBus stuff *) + + OBus_object.export bus (Analogic_motor.make ()); + OBus_object.export bus (Analogic_servos.make ()); + OBus_object.export bus (Compass.make ()); + OBus_object.export bus (AX12.make ()); + OBus_object.export bus (LCD.make window); + OBus_object.export bus (Infrareds.make ()); + OBus_object.export bus (Motors.make ()); + OBus_object.export bus (Power.make ()); + OBus_object.export bus (Logic_sensors.make ()); + OBus_object.export bus (Range_finders.make ()); + OBus_object.export bus (RX64.make ()); + + 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.export bus card_interface; + OBus_object.export bus card_sensors; + OBus_object.export bus card_motors; + OBus_object.export bus card_monitoring; + OBus_object.export bus card_rx64; + + Lwt_log.notice ~section "ready, waiting for requests" + +lwt () = Krobot_daemon.start ~desc:"krobot simulator" ~name:"fr.krobot.Driver" init diff --git a/info/control/simulator/krobot_ui.glade b/info/control/simulator/krobot_ui.glade new file mode 100644 index 0000000..a10e90b --- /dev/null +++ b/info/control/simulator/krobot_ui.glade @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<glade-interface> + <!-- interface-requires gtk+ 2.16 --> + <!-- interface-naming-policy project-wide --> + <widget class="GtkWindow" id="window"> + <child> + <widget class="GtkDrawingArea" id="lcd"> + <property name="width_request">404</property> + <property name="height_request">97</property> + <property name="visible">True</property> + </widget> + </child> + </widget> +</glade-interface> hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-15 20:24:43
|
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 f1d7f0f3631c740eddf7d9f8565c63618beda0a3 (commit) from 8335da6e682c688e191aa485ecc5d248fdbceddf (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 f1d7f0f3631c740eddf7d9f8565c63618beda0a3 Author: [Kro]bot <kr...@wa...> Date: Wed Dec 15 20:56:12 2010 +0100 the threads package is not needed anymore ----------------------------------------------------------------------- Changes: diff --git a/info/control/_tags b/info/control/_tags index ec2b74b..4dfe115 100644 --- a/info/control/_tags +++ b/info/control/_tags @@ -11,7 +11,7 @@ # 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}/**/*>: package(threads), package(usb), package(serial) +<{driver,usb-tools}/**/*>: package(usb), package(serial) # SDL is used to access the sixaxis controller <clients/krobot_joystick.*>: package(sdl) diff --git a/info/control/myocamlbuild.ml b/info/control/myocamlbuild.ml index d049907..30c0a74 100644 --- a/info/control/myocamlbuild.ml +++ b/info/control/myocamlbuild.ml @@ -178,13 +178,6 @@ let _ = rule name ~stamp:name ~deps (fun _ _ -> Nop) in - virtual_rule "all" targets; - - (* +---------------------------------------------------------+ - | Hacks | - +---------------------------------------------------------+ *) - - flag ["ocaml"; "package(threads)"; "compile"] & S[A "-thread"]; - flag ["ocaml"; "package(threads)"; "link"] & S[A "-thread"] + virtual_rule "all" targets | _ -> () end hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-12-15 17:59: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 8335da6e682c688e191aa485ecc5d248fdbceddf (commit) from 9b43f1d7f5ede60002e7dd7b590401116633f19c (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 8335da6e682c688e191aa485ecc5d248fdbceddf Author: Jérémie Dimino <je...@di...> Date: Wed Dec 15 18:58:29 2010 +0100 upgrade for lwt 2.2.0 ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_joystick.ml b/info/control/clients/krobot_joystick.ml index f437da4..093d786 100644 --- a/info/control/clients/krobot_joystick.ml +++ b/info/control/clients/krobot_joystick.ml @@ -138,11 +138,11 @@ let axis_coef = 6.0 let axis_coef_turn = 4.0 let duration = 0.2 -let record_oc = +lwt record_oc = if Array.length Sys.argv >= 2 && Sys.argv.(1) = "record" then Lwt_io.open_file ~mode:Lwt_io.output "krobot.record" else - Lwt_io.null + return Lwt_io.null let date_last_command = ref (Unix.gettimeofday ()) diff --git a/info/control/clients/krobot_record_infrared.ml b/info/control/clients/krobot_record_infrared.ml index 4e928a6..8301ed2 100644 --- a/info/control/clients/krobot_record_infrared.ml +++ b/info/control/clients/krobot_record_infrared.ml @@ -32,7 +32,7 @@ lwt () = lwt () = printl "type Ctrl+C to stop" in lwt krobot = Krobot.create () in lwt infrareds = OBus_property.monitor (Krobot_sensors.infrareds krobot) in - let oc = Lwt_io.open_file ~mode:Lwt_io.output "infrareds-record" in + lwt oc = Lwt_io.open_file ~mode:Lwt_io.output "infrareds-record" in let rec loop dist = lwt () = Lwt_unix.sleep 1.0 in lwt measure = measure_infrared krobot infrareds in diff --git a/info/control/common/krobot_daemon.ml b/info/control/common/krobot_daemon.ml index fe63a99..133f821 100644 --- a/info/control/common/krobot_daemon.ml +++ b/info/control/common/krobot_daemon.ml @@ -42,7 +42,7 @@ struct exit 0 end - let interface = make { m_shutdown = (fun context obj () -> shutdown (OBus_object.get obj)) } + let interface = make { m_shutdown = (fun obj () -> shutdown (OBus_object.get obj)) } end let start ~desc ~name init = diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 94c591c..f6b518e 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -50,11 +50,11 @@ struct let interface = make { m_set_state = ( - fun ctx obj state -> + fun obj state -> set_state (OBus_object.get obj) ~state ); m_set_velocity = ( - fun ctx obj (velocity, duration) -> + fun obj (velocity, duration) -> let velocity = Int32.to_int velocity in set_velocity (OBus_object.get obj) velocity duration ); @@ -101,13 +101,13 @@ struct let interface = make { m_set_config = ( - fun ctx obj (enable, disable) -> + fun obj (enable, disable) -> let enable = List.map Int32.to_int enable in let disable = List.map Int32.to_int disable in set_config (OBus_object.get obj) enable disable ); m_set_state = ( - fun ctx obj states -> + fun obj states -> let states = List.map (fun (k, v) -> (Int32.to_int k, Int32.to_int v)) states in set_state (OBus_object.get obj) states ); @@ -136,7 +136,7 @@ struct let interface = make { m_get_measure = ( - fun ctx obj () -> + fun obj () -> get_measure (OBus_object.get obj) >|= Int32.of_int ); } @@ -290,42 +290,42 @@ struct let interface = make { m_ping = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in ping (OBus_object.get obj) id ); m_action = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in action (OBus_object.get obj) id ); m_reset = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in reset (OBus_object.get obj) id ); m_get = ( - fun ctx obj (id, address) -> + fun obj (id, address) -> let id = Int32.to_int id in let address = make_readable_register address in get (OBus_object.get obj) id address >|= Int32.of_int ); m_set = ( - fun ctx obj (id, address, value) -> + fun 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 set (OBus_object.get obj) id address value ); m_reg_set = ( - fun ctx obj (id, address, value) -> + fun 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 reg_set (OBus_object.get obj) id address value ); m_goto = ( - fun ctx obj (id, position, speed, mode) -> + fun obj (id, position, speed, mode) -> let id = Int32.to_int id in let position = Int32.to_int position in let speed = Int32.to_int speed in @@ -333,17 +333,17 @@ struct goto (OBus_object.get obj) id position speed mode ); m_config = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in config (OBus_object.get obj) id ); m_get_position = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in get_position (OBus_object.get obj) id >|= Int32.of_int ); m_get_speed = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in get_speed (OBus_object.get obj) id >|= Int32.of_int ); @@ -408,42 +408,42 @@ struct let interface = make { m_ping = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in ping (OBus_object.get obj) ~id ); m_action = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in action (OBus_object.get obj) ~id ); m_reset = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in reset (OBus_object.get obj) ~id ); m_get = ( - fun ctx obj (id, address) -> + fun obj (id, address) -> let id = Int32.to_int id in let address = make_readable_register address in get (OBus_object.get obj) ~id ~address >|= Int32.of_int ); m_set = ( - fun ctx obj (id, address, value) -> + fun 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 set (OBus_object.get obj) ~id ~address ~value ); m_reg_set = ( - fun ctx obj (id, address, value) -> + fun 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 reg_set (OBus_object.get obj) ~id ~address ~value ); m_goto = ( - fun ctx obj (id, position, speed, mode) -> + fun obj (id, position, speed, mode) -> let id = Int32.to_int id in let position = Int32.to_int position in let speed = Int32.to_int speed in @@ -451,17 +451,17 @@ struct goto (OBus_object.get obj) ~id ~position ~speed ~mode ); m_config = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in config (OBus_object.get obj) id ); m_get_position = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in get_position (OBus_object.get obj) ~id >|= Int32.of_int ); m_get_speed = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in get_speed (OBus_object.get obj) ~id >|= Int32.of_int ); @@ -487,7 +487,7 @@ struct let interface = make { m_get = ( - fun ctx obj () -> + fun obj () -> lwt result = get (OBus_object.get obj) in return (List.map Int32.of_int (Array.to_list result)) ); @@ -542,29 +542,29 @@ struct let interface = make { m_clear = ( - fun ctx obj () -> + fun obj () -> clear (OBus_object.get obj) () ); m_set_cursor = ( - fun ctx obj state -> + fun obj state -> set_cursor (OBus_object.get obj) state ); m_set_backlight = ( - fun ctx obj state -> + fun obj state -> set_backlight (OBus_object.get obj) state ); m_goto = ( - fun ctx obj (line, column) -> + fun obj (line, column) -> let line = Int32.to_int line in let column = Int32.to_int column in goto (OBus_object.get obj) line column ); m_write = ( - fun ctx obj text -> + fun obj text -> write (OBus_object.get obj) text ); m_write_line = ( - fun ctx obj (line, text) -> + fun obj (line, text) -> let line = Int32.to_int line in write_line (OBus_object.get obj) line text ); @@ -599,7 +599,7 @@ struct let interface = make { m_get_state = ( - fun ctx obj () -> + fun obj () -> get_state (OBus_object.get obj) () ); } @@ -799,33 +799,33 @@ struct let interface = make { m_move = ( - fun ctx obj (distance, velocity, acceleration) -> + fun obj (distance, velocity, acceleration) -> move (OBus_object.get obj) distance velocity acceleration ); m_turn = ( - fun ctx obj (angle, velocity, acceleration) -> + fun obj (angle, velocity, acceleration) -> turn (OBus_object.get obj) angle velocity acceleration ); m_stop = ( - fun ctx obj (motor, mode) -> + fun obj (motor, mode) -> let motor = make_motor motor in let mode = make_stop_mode mode in stop (OBus_object.get obj) motor mode ); m_set_velocities = ( - fun ctx obj (velocity_r, velocity_l, duration) -> + fun obj (velocity_r, velocity_l, duration) -> set_velocities (OBus_object.get obj) velocity_r velocity_l duration ); m_get_current_velocities = ( - fun ctx obj () -> + fun obj () -> get_current_velocities (OBus_object.get obj) ); m_get_current_positions = ( - fun ctx obj () -> + fun obj () -> get_current_positions (OBus_object.get obj) ); m_get_config = ( - fun ctx obj () -> + fun obj () -> 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, @@ -837,7 +837,7 @@ struct Int32.of_int li_l) ); m_set_config = ( - fun ctx obj (motor, kp, ki, kd, li) -> + fun obj (motor, kp, ki, kd, li) -> let motor = make_motor motor in let kp = Int32.to_int kp in let ki = Int32.to_int ki in @@ -896,24 +896,24 @@ struct let interface = make { m_set_buzzer_state = ( - fun ctx obj state -> + fun obj state -> set_buzzer_state (OBus_object.get obj) state ); m_get_cell_voltage = ( - fun ctx obj () -> + fun obj () -> 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 () -> + fun obj () -> get_current (OBus_object.get obj) >|= Int32.of_int ); m_get_power_state = ( - fun ctx obj () -> + fun obj () -> get_power_state (OBus_object.get obj) ); m_get_battery_state = ( - fun ctx obj () -> + fun obj () -> get_battery_state (OBus_object.get obj) >|= Int32.of_int ); } @@ -945,12 +945,12 @@ struct let interface = make { m_measure = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in measure (OBus_object.get obj) id ); m_get = ( - fun ctx obj id -> + fun obj id -> let id = Int32.to_int id in get (OBus_object.get obj) id >|= Int32.of_int ); @@ -1025,28 +1025,28 @@ struct let interface = make { m_get_firmware_build = ( - fun ctx obj () -> + fun obj () -> get_firmware_build (OBus_object.get obj) ); m_get_board_info = ( - fun ctx obj () -> + fun obj () -> get_board_info (OBus_object.get obj) ); m_get_ports_state = ( - fun ctx obj () -> + fun obj () -> 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 () -> + fun obj () -> bootloader (OBus_object.get obj) ); m_reset = ( - fun ctx obj () -> + fun obj () -> reset (OBus_object.get obj) ); m_test = ( - fun ctx obj () -> + fun obj () -> test (OBus_object.get obj) ); } diff --git a/info/control/driver/krobot_dynamixel_over_serial.ml b/info/control/driver/krobot_dynamixel_over_serial.ml index cb1cee5..aced863 100644 --- a/info/control/driver/krobot_dynamixel_over_serial.ml +++ b/info/control/driver/krobot_dynamixel_over_serial.ml @@ -280,7 +280,7 @@ let abort wrapper exn = | Opened card -> wrapper.state <- Closed exn; try_lwt - let () = Lwt_unix.close card.handle in + lwt () = Lwt_unix.close card.handle in return exn finally wakeup_exn card.abort_wakener exn; @@ -298,7 +298,7 @@ let close_wrapper wrapper = match wrapper.state with return () let make_wrapper ?(timeout=1.0) ~name ~path ~rate = - let fd = Lwt_unix.openfile path [Unix.O_RDWR; Unix.O_NONBLOCK] 0o660 in + lwt fd = Lwt_unix.openfile path [Unix.O_RDWR; Unix.O_NONBLOCK] 0o660 in let tio = { (* taken from minicom *) Unix.c_ignbrk = true; Unix.c_brkint = false; Unix.c_ignpar = false; @@ -315,7 +315,7 @@ let make_wrapper ?(timeout=1.0) ~name ~path ~rate = Unix.c_veol = '\000'; Unix.c_vmin = 1; Unix.c_vtime = 5; Unix.c_vstart = '\000'; Unix.c_vstop = '\000' } in - Lwt_unix.tcsetattr fd Unix.TCSANOW tio; + lwt () = Lwt_unix.tcsetattr fd Unix.TCSANOW tio in let abort_waiter, abort_wakener = wait () in let rec card = { handle = fd; diff --git a/info/control/services/krobot_service_claws.ml b/info/control/services/krobot_service_claws.ml index 2a36bc4..923d6b6 100644 --- a/info/control/services/krobot_service_claws.ml +++ b/info/control/services/krobot_service_claws.ml @@ -34,23 +34,23 @@ let take obj = let interface = make { m_enable = ( - fun ctx obj () -> + fun obj () -> enable (OBus_object.get obj) ); m_disable = ( - fun ctx obj () -> + fun obj () -> disable (OBus_object.get obj) ); m_open = ( - fun ctx obj () -> + fun obj () -> open_ (OBus_object.get obj) ); m_close = ( - fun ctx obj () -> + fun obj () -> close (OBus_object.get obj) ); m_take = ( - fun ctx obj () -> + fun obj () -> take (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_gate.ml b/info/control/services/krobot_service_gate.ml index 09a4d84..bdf245f 100644 --- a/info/control/services/krobot_service_gate.ml +++ b/info/control/services/krobot_service_gate.ml @@ -37,27 +37,27 @@ let stop obj = let interface = make { m_enable = ( - fun ctx obj () -> + fun obj () -> enable (OBus_object.get obj) ); m_disable = ( - fun ctx obj () -> + fun obj () -> disable (OBus_object.get obj) ); m_close = ( - fun ctx obj () -> + fun obj () -> close (OBus_object.get obj) ); m_open = ( - fun ctx obj () -> + fun obj () -> open_ (OBus_object.get obj) ); m_hold_closed = ( - fun ctx obj () -> + fun obj () -> hold_closed (OBus_object.get obj) ); m_stop = ( - fun ctx obj () -> + fun obj () -> stop (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_grip.ml b/info/control/services/krobot_service_grip.ml index a62f320..4c12667 100644 --- a/info/control/services/krobot_service_grip.ml +++ b/info/control/services/krobot_service_grip.ml @@ -91,23 +91,23 @@ let release obj = let interface = make { m_up = ( - fun ctx obj () -> + fun obj () -> up (OBus_object.get obj) ); m_down = ( - fun ctx obj () -> + fun obj () -> down (OBus_object.get obj) ); m_open = ( - fun ctx obj () -> + fun obj () -> open_ (OBus_object.get obj) ); m_close = ( - fun ctx obj () -> + fun obj () -> close (OBus_object.get obj) ); m_release = ( - fun ctx obj () -> + fun obj () -> release (OBus_object.get obj) ); } diff --git a/info/control/services/krobot_service_motors.ml b/info/control/services/krobot_service_motors.ml index d353fa9..a860384 100644 --- a/info/control/services/krobot_service_motors.ml +++ b/info/control/services/krobot_service_motors.ml @@ -122,30 +122,30 @@ let inhibit_backward motors ~duration = let interface = make { m_turn = ( - fun ctx obj (angle, velocity, acceleration) -> + fun obj (angle, velocity, acceleration) -> 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) -> + fun obj (distance, velocity, acceleration) -> lwt result = move (OBus_object.get obj) distance velocity acceleration in return (cast_move_result result, 0.0) ); m_stop = ( - fun ctx obj mode -> + fun obj mode -> let mode = make_stop_mode mode in stop (OBus_object.get obj) mode ); m_set_velocities = ( - fun ctx obj (velocity_r, velocity_l, duration) -> + fun obj (velocity_r, velocity_l, duration) -> set_velocities (OBus_object.get obj) velocity_r velocity_l duration ); m_inhibit_forward = ( - fun ctx obj duration -> + fun obj duration -> inhibit_forward (OBus_object.get obj) duration ); m_inhibit_backward = ( - fun ctx obj duration -> + fun obj duration -> inhibit_backward (OBus_object.get obj) duration ); p_inhibited_forward = (fun obj -> (OBus_object.get obj).inhibited_forward); diff --git a/info/control/services/krobot_service_turret.ml b/info/control/services/krobot_service_turret.ml index 8a580b6..2fda1cb 100644 --- a/info/control/services/krobot_service_turret.ml +++ b/info/control/services/krobot_service_turret.ml @@ -93,15 +93,15 @@ let find obj = let interface = make { m_goto = ( - fun ctx obj angle -> + fun obj angle -> goto (OBus_object.get obj) angle ); m_scan = ( - fun ctx obj () -> + fun obj () -> scan (OBus_object.get obj) ); m_find = ( - fun ctx obj () -> + fun obj () -> find (OBus_object.get obj) ); } diff --git a/info/control/usb-tools/hexfile.ml b/info/control/usb-tools/hexfile.ml index 2d2c361..b4effe2 100644 --- a/info/control/usb-tools/hexfile.ml +++ b/info/control/usb-tools/hexfile.ml @@ -59,7 +59,7 @@ let parse_line str = | _ -> assert false let parse_file file = - let ic = Lwt_io.open_file ~mode:input file in + lwt ic = Lwt_io.open_file ~mode:input file in let lines = Lwt_io.read_lines ic in let lines = Lwt_stream.map parse_line lines in lwt lines = Lwt_stream.get_while (fun _ -> true) lines in hooks/post-receive -- krobot |
From: Xavier L. <Ba...@us...> - 2010-12-11 17:54: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 9b43f1d7f5ede60002e7dd7b590401116633f19c (commit) from ce53747d0600c5be486f4eb9a7e1598277790d1a (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 9b43f1d7f5ede60002e7dd7b590401116633f19c Author: Xavier Lagorce <Xav...@cr...> Date: Sat Dec 11 18:52:36 2010 +0100 Ajout des dernières modifications sur le controller : - une démo du robot holonome - un début de planificateur de trajectoire ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/Makefile b/elec/boards/MotherBoard_KrobotJr2010/Firmware/Makefile index 03ea4a3..6336920 100644 --- a/elec/boards/MotherBoard_KrobotJr2010/Firmware/Makefile +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/Makefile @@ -82,6 +82,7 @@ CSRC += can_monitor.c CSRC += lift.c CSRC += ax12.c CSRC += watch_adc.c +CSRC += planner.c CSRC += main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/main.c b/elec/boards/MotherBoard_KrobotJr2010/Firmware/main.c index bbb1bec..b26ca55 100644 --- a/elec/boards/MotherBoard_KrobotJr2010/Firmware/main.c +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/main.c @@ -19,6 +19,7 @@ #include "ax12.h" #include "watch_adc.h" +#include "planner.h" /* * Global variables @@ -42,41 +43,6 @@ static msg_t Thread1(void *arg) { return 0; } -static WORKING_AREA(waThread2, 1024); -static msg_t Thread2(void *arg) { - - /*TIM_OCInitTypeDef TIM_OCInitStructure; - - // PWM1 Mode configuration: Channel1 - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; - TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; - TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; - - (void)arg; - while (TRUE) { - - TIM_OCInitStructure.TIM_Pulse = 3272; - TIM_OC1Init(TIM3, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable); - TIM_ARRPreloadConfig(TIM3, ENABLE); - chThdSleepMilliseconds(10000); - - TIM_OCInitStructure.TIM_Pulse = 6545; - TIM_OC1Init(TIM3, &TIM_OCInitStructure); - TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable); - TIM_ARRPreloadConfig(TIM3, ENABLE); - chThdSleepMilliseconds(10000); - } - };*/ - - chThdSleep(MS2ST(85000)); - canSetScrew(0, 0, 0, 0, 0); - while(1); - - return 0; -} - - /* * Executed as event handler at 500mS intervals. */ @@ -91,8 +57,109 @@ static void TimerHandler(eventid_t id) { else color = 1; - chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO+1, Thread2, NULL); + // square + canSetScrew(0, 0, -200, 0, 0); + chThdSleep(MS2ST(4000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(10)); + canSetScrew(0, 0, 0, -200, 0); + chThdSleep(MS2ST(4000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(10)); + canSetScrew(0, 0, 200, 0, 0); + chThdSleep(MS2ST(4000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(10)); + canSetScrew(0, 0, 0, 200, 0); + chThdSleep(MS2ST(4000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(10)); + + // open grips + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP1, GRIP_OPEN, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP2, GRIP_OPEN, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP3, GRIP_OPEN, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + chThdSleepMilliseconds(1000); + // lift down + liftGoto(LIFT_DOWN); + chThdSleepMilliseconds(4000); + + // close one grip at a time + ax12Goto(AX12_GRIP1, GRIP_CLOSE, 0, CMD_NOW); + chThdSleepMilliseconds(1000); + ax12Goto(AX12_GRIP2, GRIP_CLOSE, 0, CMD_NOW); + chThdSleepMilliseconds(1000); + ax12Goto(AX12_GRIP3, GRIP_CLOSE, 0, CMD_NOW); + chThdSleepMilliseconds(1000); + + // lift up + liftGoto(LIFT_UP); + chThdSleepMilliseconds(4000); + + // carry + ax12Goto(AX12_ARM1, ARM_CARRY, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM2, ARM_CARRY, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM3, ARM_CARRY, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + + chThdSleepMilliseconds(2000); + + // release + ax12Goto(AX12_GRIP1, GRIP_RELEASE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP2, GRIP_RELEASE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP3, GRIP_RELEASE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + + chThdSleepMilliseconds(1000); + + // close all + ax12Goto(AX12_GRIP1, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP2, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP3, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM1, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM2, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM3, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + chThdSleepMilliseconds(500); + + // around an obstacle + canSetScrew(0, -300, 0, 0, 60); + chThdSleep(MS2ST(6000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(1000)); + + // turn + canSetScrew(0, 0, 0, 0, 120); + chThdSleep(MS2ST(3000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(500)); + canSetScrew(0, 0, 0, 0, -120); + chThdSleep(MS2ST(3000)); + canSetScrew(0, 0, 0, 0, 0); + chThdSleep(MS2ST(500)); + + // stop + while(1); + } + /*TrajectoryPlannerStart(TIMELIMIT_90S); canSetScrew(0, 0, 0, -174, 0); chThdSleep(MS2ST(2000)); @@ -111,9 +178,9 @@ static void TimerHandler(eventid_t id) { canSetScrew(0, 0, 0, -300, 0); chThdSleep(MS2ST(15000)); canSetScrew(0, 0, 0, 0, 0); - } + }*/ - /*if (!palReadPad(IOPORT1, GPIOA_BUTTON)) { + /*if (!palReadPad(IOPORT1, GPIOA_BUTTON)) { palClearPad(IOPORT3, GPIOC_LED); chThdSleepMilliseconds(100); @@ -216,18 +283,37 @@ int main(int argc, char **argv) { /* * Initialise ADCs */ - adcWatchInit(); + //adcWatchInit(); /* * Init pins */ palSetGroupMode(IOPORT3, PAL_PORT_BIT(6) | PAL_PORT_BIT(8), PAL_MODE_INPUT_PULLDOWN); + ax12Goto(AX12_ARM1, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM1, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM2, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_ARM3, ARM_GET, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP1, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP2, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Goto(AX12_GRIP3, GRIP_CLOSE, 0, CMD_ACTION); + chThdSleepMilliseconds(500); + ax12Action(ID_BROADCAST); + chThdSleepMilliseconds(500); + /* * Creates the blinker thread. */ - //chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL); - //chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO+1, Thread2, NULL); + chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL); + /* * Normal main() thread activity, in this demo it does nothing except @@ -237,9 +323,9 @@ int main(int argc, char **argv) { evtInit(&evt, MS2ST(500)); /* Initializes an event timer object. */ evtStart(&evt); /* Starts the event timer. */ chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */ - chEvtRegister(&adcAlarmWarn[ADC_3], &elADC, 1); - chEvtRegister(&adcAlarmOK[ADC_3], &elNADC, 2); - adcSetAlarm(ADC_3, 1800, 2200); + //chEvtRegister(&adcAlarmWarn[ADC_3], &elADC, 1); + //chEvtRegister(&adcAlarmOK[ADC_3], &elNADC, 2); + //adcSetAlarm(ADC_3, 1800, 2200); while (TRUE) chEvtDispatch(evhndl, chEvtWaitOne(ALL_EVENTS)); return 0; diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.c b/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.c new file mode 100644 index 0000000..66cfd52 --- /dev/null +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.c @@ -0,0 +1,97 @@ +/* + * Trajectory planning for the Krobot Junior + * Xavier Lagorce + */ + +#include "planner.h" +#include "can_monitor.h" + +Thread *planner; + +static msg_t plannerStopThread(void *arg) { + + (void)arg; + chThdWait(MS2ST(89000)); + stopMatch(); + + return 0; +} + +static msg_t plannerThread(void *arg) { + + trajectory_t *trajectory; + arc_t *arc; + uint8_t i, flags; + systime_t time, time2; + int32_t duration; + + (void)arg; + + while (1) { + trajectory = (trajectory_t*)chMsgWait(); + + for (i=0; i < trajectory->arc_nbr; i ++) { + arc = &(trajectory->path[i]); + duration = MS2ST(arc->duration); + if (chThdShouldTerminate()) + chThdExit(0); + canSetScrew(arc->ptX, arc->ptY, arc->vX, arc->vY, arc->omega); + time = chTimeNow(); + while (duration > 0) { + if ((flags=chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(arc->duration))) != 0) { + time2 = chTimeNow(); + duration -= ((int32_t)time2 - (int32_t)time); + if (flags & PLANNER_EOG) + chThdExit(0); + if (flags & PLANNER_COLLISION) { + chEvtClear(PLANNER_COLLISION); + if (trajectory->opt_collisions & COLLISION_STOP) { + canSetScrew(0, 0, 0, 0, 0); + chEvtWaitAny(COLLISION_CLEAR); + chEvtClear(COLLISION_CLEAR); + } + } + time = time2; + } + break; + } + } + chMsgRelease(RDY_OK); + } + + return 0; +} + +void TrajectoryPlannerStart(uint8_t opt_time) { + + struct EventListener el0, el1; + + if (planner == NULL) { + if (opt_time & TIMELIMIT_90S) + chThdCreateFromHeap(NULL, THD_WA_SIZE(128), HIGHPRIO + 1, plannerStopThread, opt_time); + + // Register collision events + chEvtRegister(&adcAlarmWarn[ADC_3], &el0, PLANNER_COLLISION); + chEvtRegister(&adcAlarmOK[ADC_3], &el1, COLLISION_CLEAR); + adcSetAlarm(ADC_3, 1800, 2200); + + planner = chThdCreateFromHeap(NULL, THD_WA_SIZE(1024), NORMALPRIO + 1, plannerThread, NULL); + } +} + +void followTrajectory(trajectory_t* trajectory, void(*callback)(void)) { + + chMsgSend(planner, (msg_t)trajectory); + + if (callback != NULL) + callback(); +} + +void stopMatch(void) { + canSetScrew(0,0,0,0,0); + chEvtSignal(planner, PLANNER_EOG); + chThdTerminate(planner); + chThdWait(planner); + canSetScrew(0,0,0,0,0); + planner = NULL; +} diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.h b/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.h new file mode 100644 index 0000000..2a8510b --- /dev/null +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/planner.h @@ -0,0 +1,47 @@ +/* + * Trajectory planning for the Krobot Junior + * Xavier Lagorce + */ + +#ifndef HEADER__PLANNER +#define HEADER__PLANNER + +#define TIMELIMIT_NONE 0 +#define TIMELIMIT_90S 1 + +#define COLLISION_STOP 1 +#define COLLISION_IGNORE 0 + +#define PLANNER_ABORT 1 +#define PLANNER_EOG 2 +#define PLANNER_COLLISION 4 +#define COLLISION_CLEAR 8 + +#include "ch.h" +#include "hal.h" +#include "shell.h" +#include "can_monitor.h" +#include "watch_adc.h" + +extern Thread *planner; + +typedef struct { + int16_t ptX; + int16_t ptY; + int16_t vX; + int16_t vY; + int16_t omega; + uint16_t duration; +} arc_t; + +typedef struct { + uint8_t arc_nbr; + uint8_t opt_collisions; + arc_t* path; +} trajectory_t; + +void TrajectoryPlannerStart(uint8_t opt_time); +void followTrajectory(trajectory_t* trajectory, void(*callback)(void)); +void stopMatch(void); + +#endif diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.c b/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.c index 0968153..6ee4d0f 100644 --- a/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.c +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.c @@ -8,6 +8,8 @@ #define ADC_GRP1_NUM_CHANNELS 8 #define ADC_GRP1_BUF_DEPTH 3 +EventSource adcAlarmWarn[8], adcAlarmOK[8]; + static adcsample_t samples[ADC_GRP1_NUM_CHANNELS * ADC_GRP1_BUF_DEPTH]; static adcsample_t *curBuffer; static Thread *adctp; diff --git a/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.h b/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.h index e4cea30..87f73cc 100644 --- a/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.h +++ b/elec/boards/MotherBoard_KrobotJr2010/Firmware/watch_adc.h @@ -20,7 +20,7 @@ #define ADC_7 7 // Event sources -EventSource adcAlarmWarn[8], adcAlarmOK[8]; +extern EventSource adcAlarmWarn[8], adcAlarmOK[8]; void adcWatchInit(void); void adcSetAlarm(uint8_t adc, uint16_t histLow, uint16_t histHigh); hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-11-06 17:25:51
|
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 ce53747d0600c5be486f4eb9a7e1598277790d1a (commit) from 2796d11c6b4bc3bc37eb124b7ec2ca6b59ff0c36 (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 ce53747d0600c5be486f4eb9a7e1598277790d1a Author: Olivier BICHLER <oli...@cr...> Date: Sat Nov 6 18:25:32 2010 +0100 Ajout des BOMs ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Assembly/CONTROLLER_MOTORS.BOM b/elec/boards/Controller_Motor_STM32/Assembly/CONTROLLER_MOTORS.BOM new file mode 100644 index 0000000..3870fa5 --- /dev/null +++ b/elec/boards/Controller_Motor_STM32/Assembly/CONTROLLER_MOTORS.BOM @@ -0,0 +1,65 @@ +Motors Controller - Communication Revised: Tuesday, November 02, 2010 + Revision: 1.0 + + + + + + + +Bill Of Materials November 6,2010 18:23:48 Page1 + +Item Quantity Reference Part +______________________________________________ + +1 9 C1,C4,C8,C10,C11,C12,C13, 100n + C18,C20 +2 2 C2,C3 12p +3 2 C6,C7 22p +4 2 C9,C22 1u +5 2 C14,C17 10u +6 1 C21 4.7u +7 1 D1 LED 1 +8 1 D2 LED 2 +9 1 D3 LED 3 +10 1 D4 LED 4 +11 1 D6 10BQ040 +12 1 D7 5V LED +13 1 D8 3.3V LED +14 1 E1 CAN_T +15 1 E2 R-T +16 1 E3 SCL_PU +17 1 E4 SDA_PU +18 1 E5 BOOT0 +19 1 E6 BOOT1 +20 1 J1 CAN #1 +21 1 J2 JTAG +22 1 J3 I2C +23 1 J4 M1 Driver +24 1 J5 M2 Driver +25 1 J6 M3 Driver +26 1 J7 M4 Driver +27 1 J8 M1 Encoder +28 1 J9 M2 Encoder +29 1 J10 M3 Encoder +30 1 J11 M4 Encoder +31 1 J12 12V - 24V Power Supply +32 1 J13 CAN #2 +33 1 L1 Ferrite bead +34 1 R1 330 +35 12 R2,R4,R5,R6,R7,R8,R9,R10, 10k + R11,R24,R36,R37 +36 1 R3 120 +37 6 R12,R13,R16,R17,R25,R26 1k +38 4 R14,R15,R18,R19 2k +39 14 R20,R21,R22,R23,R33,R34, 4.7k + R35,R38,R39,R40,R41,R42, + R43,R44 +40 6 R27,R28,R29,R30,R32,R45 680 +41 1 SW1 RESET +42 1 U1 SN65HVD230 +43 1 U2 STM32F103RET +44 1 U4 TSR 1-2450 +45 1 U5 LT1521-3.3/SOT +46 1 X1 32768 +47 1 X2 8 MHz diff --git a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj index 2dd1317..8033842 100644 --- a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj +++ b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj @@ -32,10 +32,25 @@ (FALSE) (FALSE) (FALSE) - (FALSE)) + (FALSE) + (BOM_Scope "0") + (BOM_Mode "0") + (BOM_Report_File + "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\ASSEMBLY\CONTROLLER_MOTORS.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\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.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")) (Folder "Outputs" (File "..\pcb\controller_motors.mnl" - (Type "LAYOUT Netlist File"))) + (Type "LAYOUT Netlist File")) + (File "..\assembly\controller_motors.bom" + (Type "Report"))) (Folder "PSpice Resources" (Folder "Simulation Profiles") (Folder "Model Libraries" diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Assembly/H_BRIDGE.BOM b/elec/boards/H_Bridge_HIP4081_SMD/Assembly/H_BRIDGE.BOM new file mode 100644 index 0000000..84ffabd --- /dev/null +++ b/elec/boards/H_Bridge_HIP4081_SMD/Assembly/H_BRIDGE.BOM @@ -0,0 +1,44 @@ +H-Bridge HIP4081 SMD - Current Measurement Revised: Saturday, August 28, 2010 + Revision: 1.0 + + + + + + + +Bill Of Materials November 6,2010 18:24:56 Page1 + +Item Quantity Reference Part +______________________________________________ + +1 1 C1 220n +2 4 C2,C7,C8,C9 100n +3 2 C3,C4 1 uF +4 1 C5 100 nF +5 1 C6 0.1 uF +6 1 C10 EEVFK1H102M +7 1 C11 68 uF +8 1 C12 10n +9 2 D1,D2 ES1B +10 3 D3,D6,D7 SMBJ30CA +11 4 D4,D5,D8,D9 SD101AW +12 1 D10 10BQ040 +13 1 D11 LED +14 1 E1 INA/DIR +15 1 F1 Fusible thermique +16 1 J2 Moteur +17 1 J3 Control +18 1 J4 Batterie +19 1 L1 150 uH +20 4 M1,M2,M3,M4 IRLR3114 +21 2 R3,R4 220k +22 4 R5,R6,R8,R9 15 +23 1 R7 33 +24 4 R10,R11,R12,R13 1k +25 1 R14 680 +26 1 U1 ACS712ELCTR-30A-T +27 1 U2 HIP4081A +28 2 U3,U5 HCPL-2232-300E +29 1 U4 CD4011A +30 1 U7 LM2675/SO diff --git a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj index 36875e4..b12a4b7 100644 --- a/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj +++ b/elec/boards/H_Bridge_HIP4081_SMD/Schematic/H_Bridge.opj @@ -19,7 +19,8 @@ (FALSE) (BOM_Scope "0") (BOM_Mode "0") - (BOM_Report_File "C:\krobot\USB_Module\H_Bridge\Assembly\H_BRIDGE.BOM") + (BOM_Report_File + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\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") @@ -44,7 +45,9 @@ (FALSE)) (Folder "Outputs" (File "..\pcb\h_bridge-1_0.mnl" - (Type "LAYOUT Netlist File"))) + (Type "LAYOUT Netlist File")) + (File "..\assembly\h_bridge.bom" + (Type "Report"))) (Folder "PSpice Resources" (Folder "Simulation Profiles") (Folder "Model Libraries" @@ -125,16 +128,10 @@ (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" - "SCHEMATIC1" "Input Logic")) + "C:\krobot\elec\boards\H_Bridge_HIP4081_SMD\Schematic\h_bridge.dsn")) (HierarchyView) (Doc (Type "COrCapturePMDoc") diff --git a/elec/boards/USB_CAN/Assembly/USB_CAN.BOM b/elec/boards/USB_CAN/Assembly/USB_CAN.BOM new file mode 100644 index 0000000..f7df453 --- /dev/null +++ b/elec/boards/USB_CAN/Assembly/USB_CAN.BOM @@ -0,0 +1,52 @@ +Microcontroller Revised: Saturday, November 06, 2010 + Revision: 1.0 + + + + + + + +Bill Of Materials November 6,2010 18:23:15 Page1 + +Item Quantity Reference Part +______________________________________________ + +1 9 C1,C4,C5,C8,C10,C11,C12, 100n + C13,C15 +2 2 C2,C3 12p +3 2 C6,C7 22p +4 2 C9,C17 1u +5 1 C14 10u +6 2 C19,C21 4.7u +7 1 C20 10n +8 1 D6 TXLED# +9 1 D7 RXLED# +10 1 D8 LED3 +11 1 D9 LED2 +12 1 D10 LED1 +13 1 E1 CAN_T +14 1 E2 R-T +15 1 E3 SCL_PU +16 1 E4 SDA_PU +17 1 E5 BOOT0 +18 1 E6 BOOT1 +19 1 J1 CAN #1 +20 1 J2 JTAG +21 1 J3 CAN #2 +22 1 J4 I2C +23 1 J9 Con. mini USB +24 2 L1,L2 Ferrite bead +25 1 R1 330 +26 14 R2,R4,R5,R6,R7,R8,R9,R10, 10k + R11,R24,R25,R26,R36,R37 +27 1 R3 120 +28 5 R32,R33,R38,R39,R40 680 +29 2 R34,R35 4.7k +30 1 SW1 RESET +31 1 U1 SN65HVD230 +32 1 U2 STM32F103RET +33 1 U3 FT232RL +34 1 U4 LT1521-3.3/SOT +35 1 X1 32768 +36 1 X2 8 MHz diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.opj b/elec/boards/USB_CAN/Schematic/USB_CAN.opj index 710ac1d..578680d 100644 --- a/elec/boards/USB_CAN/Schematic/USB_CAN.opj +++ b/elec/boards/USB_CAN/Schematic/USB_CAN.opj @@ -16,10 +16,23 @@ (FALSE) (LAYOUT_Units "0") (FALSE) - ( "FALSE")) + (FALSE) + (BOM_Scope "0") + (BOM_Mode "0") + (BOM_Report_File "C:\KROBOT\ELEC\BOARDS\USB_CAN\ASSEMBLY\USB_CAN.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\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.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")) (Folder "Outputs" (File "..\pcb\usb_can.mnl" - (Type "LAYOUT Netlist File"))) + (Type "LAYOUT Netlist File")) + (File "..\assembly\usb_can.bom" + (Type "Report"))) (Folder "PSpice Resources" (Folder "Simulation Profiles") (Folder "Model Libraries" @@ -57,11 +70,9 @@ (Path "Design Resources") (Path "Design Resources" "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn") - (Path "Design Resources" - "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn" "SCHEMATIC1") (Path "Outputs") (Select "Design Resources" - "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn" "SCHEMATIC1")) + "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn")) (HierarchyView) (Doc (Type "COrCapturePMDoc") hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-11-06 17:01: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 2796d11c6b4bc3bc37eb124b7ec2ca6b59ff0c36 (commit) from 7214cdec71349a62fcb66414a3728898cdbc96db (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 2796d11c6b4bc3bc37eb124b7ec2ca6b59ff0c36 Author: Olivier BICHLER <oli...@cr...> Date: Sat Nov 6 18:01:17 2010 +0100 Carte USB CAN entièrement routée ! ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX index 7076bb5..482b3a9 100644 Binary files a/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX and b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX differ diff --git a/elec/lib/OrCAD/KROBOT.LLB b/elec/lib/OrCAD/KROBOT.LLB index e24f657..93aa6b6 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-11-06 11:49:51
|
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 7214cdec71349a62fcb66414a3728898cdbc96db (commit) via 4c262747504c95e41ac93eef85a39a9ef3aac247 (commit) via 274f79fbf19c4cfd0782a9755f79474b9c68ac80 (commit) from 1e7fcaba5552f08cc6282eb6e5c89be62f2059c0 (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 7214cdec71349a62fcb66414a3728898cdbc96db Author: Olivier BICHLER <oli...@cr...> Date: Sat Nov 6 12:49:29 2010 +0100 Placement-routage de la carte USB CAN > 50%, schéma normalement définitif commit 4c262747504c95e41ac93eef85a39a9ef3aac247 Author: Olivier BICHLER <oli...@cr...> Date: Sat Nov 6 12:48:42 2010 +0100 Ajout du nom de la carte commit 274f79fbf19c4cfd0782a9755f79474b9c68ac80 Author: Olivier BICHLER <oli...@cr...> Date: Sat Nov 6 12:48:25 2010 +0100 Plus grosse capa en entrée + ajout du nom de la carte ----------------------------------------------------------------------- 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 745fc49..2247d4d 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/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX index bd75523..ce379e2 100644 Binary files a/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX and b/elec/boards/H_Bridge_HIP4081_SMD/PCB/H_BRIDGE-1_0.MAX differ diff --git a/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX index 57f6d23..7076bb5 100644 Binary files a/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX and b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX differ diff --git a/elec/boards/USB_CAN/PCB/USB_CAN.MNL b/elec/boards/USB_CAN/PCB/USB_CAN.MNL index d1ab902..f6098df 100644 Binary files a/elec/boards/USB_CAN/PCB/USB_CAN.MNL and b/elec/boards/USB_CAN/PCB/USB_CAN.MNL differ diff --git a/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf b/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf index f74a3ad..d378da3 100644 Binary files a/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf and b/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.DSN b/elec/boards/USB_CAN/Schematic/USB_CAN.DSN index a85876a..8821f64 100644 Binary files a/elec/boards/USB_CAN/Schematic/USB_CAN.DSN and b/elec/boards/USB_CAN/Schematic/USB_CAN.DSN differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck b/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck deleted file mode 100644 index 1d58a19..0000000 Binary files a/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck and /dev/null differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.opj b/elec/boards/USB_CAN/Schematic/USB_CAN.opj index ddf9675..710ac1d 100644 --- a/elec/boards/USB_CAN/Schematic/USB_CAN.opj +++ b/elec/boards/USB_CAN/Schematic/USB_CAN.opj @@ -14,7 +14,9 @@ (LAYOUT_Netlist_File "C:\KROBOT\ELEC\BOARDS\USB_CAN\PCB\USB_CAN.MNL") (LAYOUT_PCB_Footprint "{PCB Footprint}") (FALSE) - (LAYOUT_Units "0")) + (LAYOUT_Units "0") + (FALSE) + ( "FALSE")) (Folder "Outputs" (File "..\pcb\usb_can.mnl" (Type "LAYOUT Netlist File"))) diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK b/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK index 6205c19..a1c7cde 100644 Binary files a/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK and b/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK differ hooks/post-receive -- krobot |
From: Olivier B. <Ba...@us...> - 2010-11-05 19:36: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 1e7fcaba5552f08cc6282eb6e5c89be62f2059c0 (commit) via 14440e7de10d11a99c840981dab006c93046101f (commit) from 7898729ca82ff893b4b5e61ed7db9400453b8e4a (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 1e7fcaba5552f08cc6282eb6e5c89be62f2059c0 Author: Olivier BICHLER <oli...@cr...> Date: Fri Nov 5 20:35:54 2010 +0100 Ajout du schéma de la carte USB CAN ainsi que d'un début du placement-routage du PCB commit 14440e7de10d11a99c840981dab006c93046101f Author: Olivier BICHLER <oli...@cr...> Date: Fri Nov 5 20:34:39 2010 +0100 Modifications de la carte Motor Controller STM32 : - Ajout d'un 2ème connecteur bus CAN - Remplacement du régulateur DC/DC par un régulateur linéaire pour le passage 5V -> 3.3V - Utilisation de jumpers CMS à souder là où ça se justifie ----------------------------------------------------------------------- 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 64c01d7..745fc49 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 7a69e2c..c8a3da0 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 0277553..ce6b8a0 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 5688433..10f63b6 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 97a7ebf..2dd1317 100644 --- a/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj +++ b/elec/boards/Controller_Motor_STM32/Schematic/Controller_Motors.opj @@ -30,7 +30,9 @@ (FALSE) (FALSE) (FALSE) - ( "FALSE")) + (FALSE) + (FALSE) + (FALSE)) (Folder "Outputs" (File "..\pcb\controller_motors.mnl" (Type "LAYOUT Netlist File"))) @@ -120,9 +122,6 @@ (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" @@ -131,7 +130,7 @@ (Doc (Type "COrCapturePMDoc") (Frame - (Placement "44 0 1 -1 -1 -1 -1 0 315 0 710")) + (Placement "44 0 1 -1 -1 -1 -1 0 315 1 711")) (Tab 0)) (Doc (Type "COrSchematicDoc") @@ -176,16 +175,5 @@ (Path "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") (Schematic "SCHEMATIC1") - (Page "Driver Interface")) - (Doc - (Type "COrSchematicDoc") - (Frame - (Placement "44 0 1 -1 -1 -1 -1 317 1883 0 1068") - (Scroll "0 0") - (Zoom "136") - (Occurrence "/")) - (Path - "C:\KROBOT\ELEC\BOARDS\CONTROLLER_MOTOR_STM32\SCHEMATIC\CONTROLLER_MOTORS.DSN") - (Schematic "SCHEMATIC1") - (Page "Communication"))) + (Page "Driver Interface"))) (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 877a710..3f75ff6 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/boards/USB_CAN/PCB/USB_CAN-1_0.MAX b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX new file mode 100644 index 0000000..57f6d23 Binary files /dev/null and b/elec/boards/USB_CAN/PCB/USB_CAN-1_0.MAX differ diff --git a/elec/boards/USB_CAN/PCB/USB_CAN.MNL b/elec/boards/USB_CAN/PCB/USB_CAN.MNL new file mode 100644 index 0000000..d1ab902 Binary files /dev/null and b/elec/boards/USB_CAN/PCB/USB_CAN.MNL differ diff --git a/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf b/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf new file mode 100644 index 0000000..f74a3ad Binary files /dev/null and b/elec/boards/USB_CAN/Schematic/PDF/USB_CAN.pdf differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.DSN b/elec/boards/USB_CAN/Schematic/USB_CAN.DSN new file mode 100644 index 0000000..a85876a Binary files /dev/null and b/elec/boards/USB_CAN/Schematic/USB_CAN.DSN differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck b/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck new file mode 100644 index 0000000..1d58a19 Binary files /dev/null and b/elec/boards/USB_CAN/Schematic/USB_CAN.DSNlck differ diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN.opj b/elec/boards/USB_CAN/Schematic/USB_CAN.opj new file mode 100644 index 0000000..ddf9675 --- /dev/null +++ b/elec/boards/USB_CAN/Schematic/USB_CAN.opj @@ -0,0 +1,120 @@ +(ExpressProject "USB_CAN" + (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 ".\usb_can.dsn" + (Type "Schematic Design")) + (BuildFileAddedOrDeleted "x") + (CompileFileAddedOrDeleted "x") + (Netlist_TAB "3") + (LAYOUT_Netlist_File "C:\KROBOT\ELEC\BOARDS\USB_CAN\PCB\USB_CAN.MNL") + (LAYOUT_PCB_Footprint "{PCB Footprint}") + (FALSE) + (LAYOUT_Units "0")) + (Folder "Outputs" + (File "..\pcb\usb_can.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") + (MPSSessionName "Olivier") + (PartMRUSelector + (LP38692MP + (FullPartName "LP38692MP.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0")) + (LM3940/TO263 + (FullPartName "LM3940/TO263.Normal") + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\REGULATOR.OLB") + (DeviceIndex "0")) + (VCC_BAR + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0")) + (OFFPAGELEFT-L + (LibraryName "C:\ORCAD\ORCAD_16.0\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0")) + (OFFPAGELEFT-R + (LibraryName "C:\ORCAD\TOOLS\CAPTURE\LIBRARY\CAPSYM.OLB") + (DeviceIndex "0")) + (FT232RL + (FullPartName "FT232RL.Normal") + (LibraryName "C:\KROBOT\ELEC\LIB\ORCAD\KROBOT.OLB") + (DeviceIndex "0"))) + (GlobalState + (FileView + (Path "Design Resources") + (Path "Design Resources" + "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn") + (Path "Design Resources" + "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn" "SCHEMATIC1") + (Path "Outputs") + (Select "Design Resources" + "C:\krobot\elec\boards\USB_CAN\Schematic\usb_can.dsn" "SCHEMATIC1")) + (HierarchyView) + (Doc + (Type "COrCapturePMDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 0 318 0 710")) + (Tab 0)) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 319 1885 2 1068") + (Scroll "0 0") + (Zoom "135") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.DSN") + (Schematic "SCHEMATIC1") + (Page "Microcontroller")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 318 1884 2 1068") + (Scroll "0 0") + (Zoom "135") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.DSN") + (Schematic "SCHEMATIC1") + (Page "CAN Interface")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 319 1885 2 1068") + (Scroll "0 0") + (Zoom "135") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.DSN") + (Schematic "SCHEMATIC1") + (Page "USB Interface")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 319 1885 1 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.DSN") + (Schematic "SCHEMATIC1") + (Page "JTAG Interface")) + (Doc + (Type "COrSchematicDoc") + (Frame + (Placement "44 0 1 -1 -1 -1 -1 318 1884 1 1068") + (Scroll "0 0") + (Zoom "136") + (Occurrence "/")) + (Path "C:\KROBOT\ELEC\BOARDS\USB_CAN\SCHEMATIC\USB_CAN.DSN") + (Schematic "SCHEMATIC1") + (Page "I2C Interface"))) + (LastUsedLibraryBrowseDirectory + "C:\OrCAD\OrCAD_16.0\tools\capture\library\pspice")) diff --git a/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK b/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK new file mode 100644 index 0000000..6205c19 Binary files /dev/null and b/elec/boards/USB_CAN/Schematic/USB_CAN_0.DBK differ diff --git a/elec/lib/OrCAD/KROBOT.LLB b/elec/lib/OrCAD/KROBOT.LLB index 57cbb94..e24f657 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 2f004f2..c8b9d86 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-10-06 19:41: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 7898729ca82ff893b4b5e61ed7db9400453b8e4a (commit) from 3707088bb448231b201a173fdbae88c14bc393c8 (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 7898729ca82ff893b4b5e61ed7db9400453b8e4a Author: Jérémie Dimino <je...@di...> Date: Wed Oct 6 21:40:15 2010 +0200 Ajout de bindings pour la manette de PS3 ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_joystick.ml b/info/control/clients/krobot_joystick.ml index bedf83e..f437da4 100644 --- a/info/control/clients/krobot_joystick.ml +++ b/info/control/clients/krobot_joystick.ml @@ -226,6 +226,22 @@ let parent_loop krobot pipe = lwt () = Lazy.force enable_claws in lwt () = robot_call "claws.open" (fun () -> Krobot_claws.open_ krobot) in loop () + | JoyButtonPressed ButtonTriangle -> + lwt () = Lazy.force enable_claws in + lwt () = robot_call "claws.close" (fun () -> Krobot_claws.close krobot) in + loop () + | JoyButtonPressed ButtonR1 -> + lwt () = robot_call "grip.up" (fun () -> Krobot_grip.up krobot >> return ()) in + loop () + | JoyButtonPressed ButtonR2 -> + lwt () = robot_call "grip.down" (fun () -> Krobot_grip.down krobot) in + loop () + | JoyButtonPressed ButtonL1 -> + lwt () = robot_call "grip.close" (fun () -> Krobot_grip.close krobot) in + loop () + | JoyButtonPressed ButtonL2 -> + lwt () = robot_call "grip.release" (fun () -> Krobot_grip.release krobot) in + loop () | _ -> loop () in hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-30 10:13:15
|
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 3707088bb448231b201a173fdbae88c14bc393c8 (commit) from c3d34e22b6736d0042ac9d5300f5bef54fba3704 (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 3707088bb448231b201a173fdbae88c14bc393c8 Author: Jérémie Dimino <je...@di...> Date: Thu Sep 30 12:12:42 2010 +0200 Change the moving mode in set_velocities ----------------------------------------------------------------------- Changes: diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 11b4c79..94c591c 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -704,6 +704,7 @@ struct lwt () = match !mode with | Mode_none | Mode_managed -> + mode := Mode_manual; (* It the first manual command, we reinit the motors and use [traj_new_velocity] *) lwt () = init card in hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-30 08:41:16
|
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 c3d34e22b6736d0042ac9d5300f5bef54fba3704 (commit) via d924e20ded8eb67ff51f7f2b9b0735c7206bccf0 (commit) via 99aae47f0e4b6ea4f3e8af1b633da7bc9e64d67a (commit) from ea9b8757d22fa96c4b3449a9448d128f3232f459 (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 c3d34e22b6736d0042ac9d5300f5bef54fba3704 Author: Jérémie Dimino <je...@di...> Date: Thu Sep 30 10:39:24 2010 +0200 send a TRAJ_INIT command each time we swtich between managed mode(move/turn) and manual mode(set_velocity) commit d924e20ded8eb67ff51f7f2b9b0735c7206bccf0 Author: Jérémie Dimino <je...@di...> Date: Wed Sep 29 23:36:57 2010 +0200 Set a velocity of 0 instead of stoppping the motors in set_velocities commit 99aae47f0e4b6ea4f3e8af1b633da7bc9e64d67a Author: Jérémie Dimino <je...@di...> Date: Wed Sep 29 23:36:49 2010 +0200 typo ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_joystick.ml b/info/control/clients/krobot_joystick.ml index a661deb..bedf83e 100644 --- a/info/control/clients/krobot_joystick.ml +++ b/info/control/clients/krobot_joystick.ml @@ -136,7 +136,6 @@ let child_loop pipe joy = let axis_coef = 6.0 let axis_coef_turn = 4.0 -let acceleration = 0.4 let duration = 0.2 let record_oc = @@ -163,10 +162,10 @@ let rec set_velocities krobot velocity_l velocity_r = lwt () = robot_call (Printf.sprintf - "set-velocities velocity-left=%f velocity-right=%f acceleration=%f duration=%f" - velocity_l velocity_r acceleration duration) + "set-velocities velocity-left=%f velocity-right=%f duration=%f" + velocity_l velocity_r duration) (fun () -> - Krobot_motors.set_velocities krobot ~velocity_l ~velocity_r ~acceleration_l:acceleration ~acceleration_r:acceleration ~duration) + Krobot_motors.set_velocities krobot ~velocity_l ~velocity_r ~duration) in if velocity_l = 0.0 && velocity_r = 0.0 then return () diff --git a/info/control/driver/krobot_driver.ml b/info/control/driver/krobot_driver.ml index 7c7cf68..11b4c79 100644 --- a/info/control/driver/krobot_driver.ml +++ b/info/control/driver/krobot_driver.ml @@ -620,6 +620,15 @@ struct let thread = ref (return ()) (* Thread waiting for movement completion or timeout expiration *) + (* Movements mode *) + type mode = + | Mode_none + (* Not moving *) + | Mode_managed + (* Movements with move/turn *) + | Mode_manual + (* Movements with set_velocities *) + let wait_for_completion card = let w = lwt _ = @@ -633,8 +642,24 @@ struct thread := w; w + let init card = + Krobot_usb.call_no_reply card + ~command:PcInterface.cmd_traj + ~i_types:uint8 + PcInterface.traj_init + + let mode = ref Mode_none + + let switch_mode card new_mode = + if new_mode <> !mode then begin + mode := new_mode; + init card + end else + return () + let move card ~distance ~velocity ~acceleration = cancel !thread; + lwt () = switch_mode card Mode_managed in lwt () = Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj @@ -646,6 +671,7 @@ struct let turn card ~angle ~velocity ~acceleration = cancel !thread; + lwt () = switch_mode card Mode_managed in lwt () = Krobot_usb.call_no_reply card ~command:PcInterface.cmd_traj @@ -672,27 +698,66 @@ struct | `Abrupt -> PcInterface.traj_stop_abrupt | `Smooth -> PcInterface.traj_stop_smooth)) - let set_velocities card ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = + let set_velocities card ~velocity_r ~velocity_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 + let direction x = if x < 0.0 then -1 else 1 in + lwt () = + match !mode with + | Mode_none | Mode_managed -> + (* It the first manual command, we reinit the motors and + use [traj_new_velocity] *) + lwt () = init card in + lwt () = + 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), 800, direction velocity_r) + and () = + 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), 800, direction velocity_l) + in + return () + | Mode_manual -> + (* We are already in manual mode, use + [traj_change_velocity] *) + lwt () = + Krobot_usb.call_no_reply card + ~command:PcInterface.cmd_traj + ~i_types:(seq4 uint8 uint8 int16 int8) + (PcInterface.traj_change_velocity, code_of_motor `Right, + abs (map_dist velocity_r), direction velocity_r) + and () = + Krobot_usb.call_no_reply card + ~command:PcInterface.cmd_traj + ~i_types:(seq4 uint8 uint8 int16 int8) + (PcInterface.traj_change_velocity, code_of_motor `Left, + abs (map_dist velocity_l), direction velocity_l) + in + return () + in lwt () = 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 () = + ~i_types:(seq2 uint8 uint8) + (PcInterface.traj_start, code_of_motor `Both) + in + (* Stop the robot after [duration] seconds *) + thread := begin + lwt () = Lwt_unix.sleep duration in + lwt () = + 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 `Both, 0, 0, 1) + in 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 - Krobot_usb.call_no_reply card - ~command:PcInterface.cmd_traj - ~i_types:(seq2 uint8 uint8) - (PcInterface.traj_start, code_of_motor `Both) + ~i_types:(seq2 uint8 uint8) + (PcInterface.traj_start, code_of_motor `Both) + end; + return () let get_current_velocities card = lwt vr, vl = @@ -747,8 +812,8 @@ struct stop (OBus_object.get obj) motor mode ); m_set_velocities = ( - fun ctx obj (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) -> - set_velocities (OBus_object.get obj) velocity_r acceleration_r velocity_l acceleration_l duration + fun ctx obj (velocity_r, velocity_l, duration) -> + set_velocities (OBus_object.get obj) velocity_r velocity_l duration ); m_get_current_velocities = ( fun ctx obj () -> @@ -1057,11 +1122,6 @@ let init bus = ~command:PcInterface.cmd_motor ~i_types:(seq2 uint8 uint8) (PcInterface.motor_enable, Motors.code_of_motor `Both) - and () = - Krobot_usb.call_no_reply motors - ~command:PcInterface.cmd_traj - ~i_types:uint8 - PcInterface.traj_init in return () | `Down -> diff --git a/info/control/lib-krobot/krobot_driver.ml b/info/control/lib-krobot/krobot_driver.ml index d93e38b..3859c48 100644 --- a/info/control/lib-krobot/krobot_driver.ml +++ b/info/control/lib-krobot/krobot_driver.ml @@ -212,8 +212,8 @@ struct let mode = cast_stop_mode mode in OBus_method.call m_stop proxy (motor, mode) - let set_velocities proxy ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = - OBus_method.call m_set_velocities proxy (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) + let set_velocities proxy ~velocity_r ~velocity_l ~duration = + OBus_method.call m_set_velocities proxy (velocity_r, velocity_l, duration) let get_current_velocities proxy = OBus_method.call m_get_current_velocities proxy () diff --git a/info/control/lib-krobot/krobot_driver.mli b/info/control/lib-krobot/krobot_driver.mli index 9552d94..00bc2cb 100644 --- a/info/control/lib-krobot/krobot_driver.mli +++ b/info/control/lib-krobot/krobot_driver.mli @@ -162,7 +162,7 @@ module Motors : sig val move : [> `Motors ] device -> distance : float -> velocity : float -> acceleration : float -> unit Lwt.t val turn : [> `Motors ] device -> angle : float -> velocity : float -> acceleration : float -> unit Lwt.t val stop : [> `Motors ] device -> motor : motor -> mode : stop_mode -> unit Lwt.t - val set_velocities : [> `Motors ] device -> velocity_r : float -> acceleration_r : float -> velocity_l : float -> acceleration_l : float -> duration : float -> unit Lwt.t + val set_velocities : [> `Motors ] device -> velocity_r : float -> velocity_l : float -> duration : float -> unit Lwt.t val get_current_velocities : [> `Motors ] device -> (float * float) Lwt.t val get_current_positions : [> `Motors ] device -> (float * float) Lwt.t val get_config : [> `Motors ] device -> (int * int * int * int * int * int * int * int) Lwt.t diff --git a/info/control/lib-krobot/krobot_motors.ml b/info/control/lib-krobot/krobot_motors.ml index 9460930..3e31f9c 100644 --- a/info/control/lib-krobot/krobot_motors.ml +++ b/info/control/lib-krobot/krobot_motors.ml @@ -30,8 +30,8 @@ let stop krobot ~mode = let mode = cast_stop_mode mode in OBus_method.call m_stop (proxy krobot) mode -let set_velocities krobot ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = - OBus_method.call m_set_velocities (proxy krobot) (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) +let set_velocities krobot ~velocity_r ~velocity_l ~duration = + OBus_method.call m_set_velocities (proxy krobot) (velocity_r, velocity_l, duration) let inhibited_forward krobot = OBus_property.make p_inhibited_forward (proxy krobot) diff --git a/info/control/lib-krobot/krobot_motors.mli b/info/control/lib-krobot/krobot_motors.mli index 5cbf4a9..2e7d034 100644 --- a/info/control/lib-krobot/krobot_motors.mli +++ b/info/control/lib-krobot/krobot_motors.mli @@ -19,7 +19,7 @@ type stop_mode = val turn : Krobot.t -> angle : float -> velocity : float -> acceleration : float -> (move_result * float) Lwt.t val move : Krobot.t -> distance : float -> velocity : float -> acceleration : float -> (move_result * float) Lwt.t val stop : Krobot.t -> mode : stop_mode -> unit Lwt.t -val set_velocities : Krobot.t -> velocity_r : float -> acceleration_r : float -> velocity_l : float -> acceleration_l : float -> duration : float -> unit Lwt.t +val set_velocities : Krobot.t -> velocity_r : float -> velocity_l : float -> duration : float -> unit Lwt.t val inhibited_forward : Krobot.t -> (bool, [ `readable ]) OBus_property.t val inhibited_backward : Krobot.t -> (bool, [ `readable ]) OBus_property.t val inhibit_forward : Krobot.t -> duration : float -> unit Lwt.t diff --git a/info/control/protocol/krobot_dbus_driver.obus b/info/control/protocol/krobot_dbus_driver.obus index db1d0c8..5676f3c 100644 --- a/info/control/protocol/krobot_dbus_driver.obus +++ b/info/control/protocol/krobot_dbus_driver.obus @@ -327,9 +327,7 @@ interface fr.krobot.LowLevel.Motors { (** * Set motors velocities for the given amount of time. *) - method set_velocities : (velocity_r : double, acceleration_r : double, - velocity_l : double, acceleration_l : double, - duration : double) -> () + method set_velocities : (velocity_r : double, velocity_l : double, duration : double) -> () (** * Returns the current velocities of the motors. diff --git a/info/control/protocol/krobot_dbus_motors.obus b/info/control/protocol/krobot_dbus_motors.obus index 6183de7..e126876 100644 --- a/info/control/protocol/krobot_dbus_motors.obus +++ b/info/control/protocol/krobot_dbus_motors.obus @@ -77,9 +77,7 @@ interface fr.krobot.Service.Motors { (** * Set motors velocities for the given amount of time. *) - method set_velocities : (velocity_r : double, acceleration_r : double, - velocity_l : double, acceleration_l : double, - duration : double) -> () + method set_velocities : (velocity_r : double, velocity_l : double, duration : double) -> () (** * Are motors currently inhibited. diff --git a/info/control/python/example.py b/info/control/python/example.py index 444231d..9b5be7d 100644 --- a/info/control/python/example.py +++ b/info/control/python/example.py @@ -27,7 +27,7 @@ time.sleep(0.5) claws.disable() # +-------------------------------------------------------------------+ -# | Move the claws | +# | Move the robot | # +-------------------------------------------------------------------+ motors = krobot.Motors() diff --git a/info/control/services/krobot_service_motors.ml b/info/control/services/krobot_service_motors.ml index ef28e6b..d353fa9 100644 --- a/info/control/services/krobot_service_motors.ml +++ b/info/control/services/krobot_service_motors.ml @@ -77,7 +77,7 @@ let stop motors ~mode = motors.state <- `Static; Motors.stop (Krobot_driver.motors motors.krobot) ~motor:`Both ~mode -let set_velocities motors ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration = +let set_velocities motors ~velocity_r ~velocity_l ~duration = let direction = match velocity_r > 0.0, velocity_l > 0.0 with | true, true -> `Forward @@ -88,7 +88,7 @@ let set_velocities motors ~velocity_r ~acceleration_r ~velocity_l ~acceleration_ motors.state <- direction; pick [(lwt _ = replace motors in return ()); - (lwt () = Motors.set_velocities (Krobot_driver.motors motors.krobot) ~velocity_r ~acceleration_r ~velocity_l ~acceleration_l ~duration in + (lwt () = Motors.set_velocities (Krobot_driver.motors motors.krobot) ~velocity_r ~velocity_l ~duration in lwt () = Lwt_unix.sleep duration in motors.state <- `Static; return ())] @@ -137,8 +137,8 @@ let interface = stop (OBus_object.get obj) mode ); m_set_velocities = ( - fun ctx obj (velocity_r, acceleration_r, velocity_l, acceleration_l, duration) -> - set_velocities (OBus_object.get obj) velocity_r acceleration_r velocity_l acceleration_l duration + fun ctx obj (velocity_r, velocity_l, duration) -> + set_velocities (OBus_object.get obj) velocity_r velocity_l duration ); m_inhibit_forward = ( fun ctx obj duration -> hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-25 23:56:46
|
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 ea9b8757d22fa96c4b3449a9448d128f3232f459 (commit) from 058b6673abaed3434a898cb54fda1948ffc4f3f3 (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 ea9b8757d22fa96c4b3449a9448d128f3232f459 Author: Jérémie Dimino <je...@di...> Date: Sun Sep 26 01:52:27 2010 +0200 typo ----------------------------------------------------------------------- Changes: diff --git a/info/control/protocol/krobot_dbus_motors.obus b/info/control/protocol/krobot_dbus_motors.obus index 8cce808..6183de7 100644 --- a/info/control/protocol/krobot_dbus_motors.obus +++ b/info/control/protocol/krobot_dbus_motors.obus @@ -71,7 +71,7 @@ interface fr.krobot.Service.Motors { *) method stop: (mode : stop_mode) -> () with { - default.mode = "smooth" + default.mode = "2" } (** diff --git a/info/control/python/krobot.py b/info/control/python/krobot.py index 926eb19..a0e84c6 100644 --- a/info/control/python/krobot.py +++ b/info/control/python/krobot.py @@ -101,7 +101,7 @@ class Motors: def move(self, distance=0.1, velocity=0.4, acceleration=0.8): return self.proxy.move(distance, velocity, acceleration) - def stop(self, mode=smooth): + def stop(self, mode=2): return self.proxy.stop(mode) def set_velocities(self, velocity_r, acceleration_r, velocity_l, acceleration_l, duration): hooks/post-receive -- krobot |
From: Jérémie D. <Ba...@us...> - 2010-09-25 23:50: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 058b6673abaed3434a898cb54fda1948ffc4f3f3 (commit) from a07b7353292c7416204a1abddec4814f74878402 (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 058b6673abaed3434a898cb54fda1948ffc4f3f3 Author: Jérémie Dimino <je...@di...> Date: Sun Sep 26 01:49:11 2010 +0200 Add default values ----------------------------------------------------------------------- Changes: diff --git a/info/control/clients/krobot_script.ml b/info/control/clients/krobot_script.ml index 1a6a614..8f9f839 100644 --- a/info/control/clients/krobot_script.ml +++ b/info/control/clients/krobot_script.ml @@ -32,6 +32,9 @@ type command = { cmd_oargs : (string * single * string list) list; (* List of output arguments, with their types and constants they accept *) + cmd_annotations : (string * string) list; + (* List of annotations of the method *) + cmd_proxy : OBus_proxy.t; (* The proxy on which the command should be executed *) @@ -94,6 +97,7 @@ let add_commands_of_interface proxy path (iface_name, members, env, annotations) { cmd_path = path; cmd_iargs = convert_arguments isig; cmd_oargs = convert_arguments osig; + cmd_annotations = annotations; cmd_proxy = proxy; cmd_method = ( OBus_member.Method.make @@ -298,7 +302,12 @@ let sequence_of_args cmd args = try match typ with | Basic typ -> - V.basic(basic_of_string typ (List.assoc name args)) + V.basic + (basic_of_string typ + (try + List.assoc name args + with Not_found -> + List.assoc ("default." ^ name) cmd.cmd_annotations)) | _ -> failwith "cannot yet parse D-Bus container values" with diff --git a/info/control/protocol/krobot_dbus_motors.obus b/info/control/protocol/krobot_dbus_motors.obus index e5f84a5..8cce808 100644 --- a/info/control/protocol/krobot_dbus_motors.obus +++ b/info/control/protocol/krobot_dbus_motors.obus @@ -40,12 +40,22 @@ interface fr.krobot.Service.Motors { * the angle the robot really turned, even if the turn failed. *) method turn : (angle : double, velocity : double, acceleration : double) -> (result : move_result, accomplished : double) + with { + default.angle = "0.785398163397448279" + default.velocity = "0.4" + default.acceleration = "0.8" + } (** * Move the robot by the given distance. [accomplished] contains * the distance the robot really moved, even if the move failed. *) method move : (distance : double, velocity : double, acceleration : double) -> (result : move_result, accomplished : double) + with { + default.distance = "0.1" + default.velocity = "0.4" + default.acceleration = "0.8" + } (** * How to stop a motor. @@ -60,6 +70,9 @@ interface fr.krobot.Service.Motors { * Stop the motors. *) method stop: (mode : stop_mode) -> () + with { + default.mode = "smooth" + } (** * Set motors velocities for the given amount of time. diff --git a/info/control/python/generate.ml b/info/control/python/generate.ml index 868136e..cf5a52f 100644 --- a/info/control/python/generate.ml +++ b/info/control/python/generate.ml @@ -25,14 +25,27 @@ let gen_symbol (name, symbol) = values; print_newline () +let arg annotations (name, typ) = + match name with + | Some name -> begin + try + name ^ "=" ^ List.assoc ("default." ^ name) annotations + with Not_found -> + name + end + | None -> + failwith "unmamed argument" + let arg_name (name, typ) = match name with - | Some name -> name - | None -> assert false + | Some name -> + name + | None -> + failwith "unmamed argument" let gen_member iface = function - | Method(name, args, _, _) -> - printf " def %s(%s):\n" name (String.concat ", " ("self" :: List.map arg_name args)); + | Method(name, args, _, annotations) -> + printf " def %s(%s):\n" name (String.concat ", " ("self" :: List.map (arg annotations) 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 diff --git a/info/control/python/krobot.py b/info/control/python/krobot.py index d5e8e62..926eb19 100644 --- a/info/control/python/krobot.py +++ b/info/control/python/krobot.py @@ -95,13 +95,13 @@ class Motors: def __init__(self): self.proxy = (get_bus ()).get_object("fr.krobot.Service.Motors", "/fr/krobot/Services/Motors") - def turn(self, angle, velocity, acceleration): + def turn(self, angle=0.785398163397448279, velocity=0.4, acceleration=0.8): return self.proxy.turn(angle, velocity, acceleration) - def move(self, distance, velocity, acceleration): + def move(self, distance=0.1, velocity=0.4, acceleration=0.8): return self.proxy.move(distance, velocity, acceleration) - def stop(self, mode): + def stop(self, mode=smooth): return self.proxy.stop(mode) def set_velocities(self, velocity_r, acceleration_r, velocity_l, acceleration_l, duration): hooks/post-receive -- krobot |