[Top][All Lists]
[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: |
Mon, 14 Jan 2008 13:10:06 +0100 |
User-agent: |
Icedove 1.5.0.14pre (X11/20071018) |
Hi Marcus,
On the 24c3 I saw telemetry being passed via TCP/IP
ove the internet. Where can I find the protocoll-specification
and the ground-station -code for it, so I can use the existing
ground-station-code and just implement the airborne-code
to directly speak this protocoll?
You cannot directly use this code which was designed to route the
messages through a server.
What kind of message do you plan to use ? TCP or UDP ?
The attached code (to be compiled in the sw/ground_segment/tmtc
directory) forwards binary paparazzi telemetry messages received on port
4242 to the ivy bus.
--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 udp2ivy.ml"; -*- *)
open Printf
module Tm_Pprz = Pprz.Messages(struct let name = "telemetry" end)
let () =
let ivy_bus = ref "127.255.255.255:2010" in
let port = ref 4242 in
let options = [
"-b", Arg.Set_string ivy_bus, (sprintf "<ivy bus> Default is %s" !ivy_bus);
"-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 sockaddr = Unix.ADDR_INET (Unix.inet_addr_any, !port)
and socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in
Unix.bind socket sockaddr;
Ivy.init "udp2ivy" "READY" (fun _ _ -> ());
Ivy.start !ivy_bus;
let buffer_size = 256 in
let buffer = String.create buffer_size in
let get_udp_message = fun _ ->
let (n, _from) = Unix.recvfrom socket buffer 0 buffer_size [] in
let payload = Pprz.Transport.payload (String.sub buffer 0 n) in
Debug.trace 'x' (Debug.xprint (Serial.string_of_payload payload));
begin
try
let (msg_id, ac_id, values) = Tm_Pprz.values_of_payload payload in
let msg = Tm_Pprz.message_of_id msg_id in
Tm_Pprz.message_send (string_of_int ac_id) msg.Pprz.name values
with
exc ->
prerr_endline (Printexc.to_string exc)
end;
true in
ignore (Glib.Io.add_watch [`IN] get_udp_message (GMain.Io.channel_of_descr
socket));
(* Main Loop *)
GMain.main ()