paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] 24c3-telemetry-protocoll


From: Pascal Brisset
Subject: Re: [Paparazzi-devel] 24c3-telemetry-protocoll
Date: Fri, 25 Jan 2008 21:17:43 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071022)

Hi,

second questions:
Pascal: Did you write some ivy2udp?
File is attached. Option "-h" to list the options.
I saw you updating the flight-plan remotely.
How did you do that?

All communications went through a server:
- on the field, "ivy_tcp_aircraft" sent the telemetry from the Ivy bus to the server though tcp - on the server, "broadcaster" listened on 4242 and forwarded telemetry messages from TCP clients to an Ivy bus and datalink messages from the Ivy bus back to the connected TCP clients - on the server "broadcaster -f TM -t DL -p 4243" listened on 4243, forwarded datalink messages from TCP clients to the Ivy bus and telemetry messages from the Ivy bus to the connected TCP clients - in Berlin, "ivy_tcp_controller" connected to the server, got the telemetry messages and sent the datalink messages This architecture work with several "ivy_tcp_aircraft" and several "ivy_tcp_controller"

It probably should be documented in the wiki ...

--Pascal
(* -*-compile-command: "ocamlc -custom -I ../../lib/ocaml -I +lablgtk2 -I 
+xml-light -o udp2ivy unix.cma str.cma xml-light.cma lablgtk.cma 
glibivy-ocaml.cma lib-pprz.cma ivy2udp.ml"; -*- *)

let my_id = 0
module Tm_Pprz = Pprz.Messages(struct let name = "telemetry" end)
module Ground_Pprz = Pprz.Messages(struct let name = "ground" end)
open Printf
let () =
  let ivy_bus = ref "127.255.255.255:2010" in
  let host = ref "10.31.1.89"
  and port = ref 4242
  and id = ref "6" in

  let options = [
    "-b", Arg.Set_string ivy_bus, (sprintf "<ivy bus> Default is %s" !ivy_bus);
    "-h", Arg.Set_string host, (sprintf "<remote host> Default is %s" !host);
    "-id", Arg.Set_string id , (sprintf "<id> Default is %s" !host);
    "-p", Arg.Set_int port, (sprintf "<remote port> Default is %d" !port)
  ] in
  Arg.parse
    options
    (fun x -> fprintf stderr "Warning: Discarding '%s'" x)
    "Usage: ";
  
  let addr = Unix.inet_addr_of_string !host in
  let sockaddr = Unix.ADDR_INET (addr, !port) in
  let socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in

  Ivy.init "Link" "READY" (fun _ _ -> ());
  Ivy.start !ivy_bus;

  let get_ivy_message = fun _ args ->
    try
      let (msg_id, vs) = Tm_Pprz.values_of_string args.(0) in
      let payload = Tm_Pprz.payload_of_values msg_id (int_of_string !id) vs in
      let buf = Pprz.Transport.packet payload in
      let n = String.length buf in
      let n' = Unix.sendto socket buf 0 n [] sockaddr in
      assert (n = n')
    with _ -> () in

  let _b = Ivy.bind get_ivy_message (sprintf "^%s (.*)" !id) in
  
  (* Main Loop *)
  GMain.main () 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]