mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-19 10:34:28 +08:00
Added exact timing control in telemety.xml for optimizing data flow and packetting in low datarate modems like the xbee868
This commit is contained in:
@@ -13,4 +13,5 @@
|
||||
<!ATTLIST message
|
||||
name CDATA #REQUIRED
|
||||
period CDATA #REQUIRED
|
||||
phase CDATA #IMPLIED
|
||||
>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE telemetry SYSTEM "telemetry.dtd">
|
||||
<telemetry>
|
||||
<process name="Ap">
|
||||
<mode name="default">
|
||||
<message name="ESTIMATOR" period="0.5" phase="0."/>
|
||||
<message name="NAVIGATION" period="0.5" phase="0."/>
|
||||
|
||||
<message name="ATTITUDE" period="1" phase="0.25"/>
|
||||
<message name="DL_VALUE" period="1." phase="0.25"/>
|
||||
<message name="WP_MOVED" period="1." phase="0.25"/>
|
||||
|
||||
<message name="DESIRED" period="2." phase="0.25"/>
|
||||
<message name="SEGMENT" period="2." phase="1.25"/>
|
||||
<message name="CIRCLE" period="2." phase="1.25"/>
|
||||
<message name="SURVEY" period="2." phase="1.25"/>
|
||||
|
||||
<message name="ALIVE" period="4." phase="0.75"/>
|
||||
<message name="BAT" period="4." phase="0.75"/>
|
||||
<message name="CALIBRATION" period="4." phase="1.75"/>
|
||||
<message name="DOWNLINK" period="4." phase="1.75"/>
|
||||
<message name="GPS_SOL" period="4." phase="2.75"/>
|
||||
<message name="NAVIGATION_REF" period="4." phase="2.75"/>
|
||||
<message name="PPRZ_MODE" period="4." phase="0.75"/>
|
||||
</mode>
|
||||
</process>
|
||||
<process name="Fbw">
|
||||
<mode name="default">
|
||||
<message name="FBW_STATUS" period="4." phase="3.75"/>
|
||||
<message name="COMMANDS" period="4." phase="3.75"/>
|
||||
<message name="ACTUATORS" period="4." phase="3.75"/>
|
||||
</mode>
|
||||
</process>
|
||||
</telemetry>
|
||||
@@ -58,6 +58,9 @@
|
||||
#include "link_mcu.h"
|
||||
#endif
|
||||
|
||||
#ifdef MILLIAMP_PER_PERCENT
|
||||
# warning "deprecated MILLIAMP_PER_PERCENT --> Please use MILLIAMP_AT_FULL_THROTTLE
|
||||
#endif
|
||||
#ifndef MILLIAMP_AT_FULL_THROTTLE
|
||||
#define MILLIAMP_AT_FULL_THROTTLE 0
|
||||
#endif
|
||||
@@ -227,9 +230,6 @@ void periodic_task_fbw( void ) {
|
||||
#endif
|
||||
|
||||
#ifndef ADC_CHANNEL_CURRENT
|
||||
# ifdef MILLIAMP_PER_PERCENT
|
||||
# warning "deprecated MILLIAMP_PER_PERCENT --> Please use MILLIAMP_AT_FULL_THROTTLE
|
||||
# endif
|
||||
fbw_current_milliamp = Min(((float)commands[COMMAND_THROTTLE]) * ((float)MILLIAMP_AT_FULL_THROTTLE) / ((float)MAX_PPRZ), 65000);
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ let output_modes = fun avr_h process_name modes ->
|
||||
let p = float_of_string (ExtXml.attrib x "period") in
|
||||
if p < min_period || p > max_period then
|
||||
fprintf stderr "Warning: period is bound between %.3fs and %.3fs for message %s\n%!" min_period max_period (ExtXml.attrib x "name");
|
||||
(x, min 65535 (max 1 (int_of_float (p*.float_of_int !freq)))))
|
||||
(x, min 65536 (max 1 (int_of_float (p*.float_of_int !freq)))))
|
||||
(Xml.children mode)
|
||||
in
|
||||
let modulos = remove_dup (List.map snd messages) in
|
||||
@@ -73,21 +73,25 @@ let output_modes = fun avr_h process_name modes ->
|
||||
(fun m ->
|
||||
let v = sprintf "i%d" m in
|
||||
let _type = if m >= 256 then "uint16_t" else "uint8_t" in
|
||||
lprintf avr_h "static %s %s; %s++; if (%s>=%d) %s=0;\\\n" _type v v v m v;
|
||||
lprintf avr_h "static %s %s = 0; %s++; if (%s>=%d) %s=0;\\\n" _type v v v m v;
|
||||
)
|
||||
modulos;
|
||||
|
||||
(** For each message in this mode *)
|
||||
let messages = List.sort (fun (_,p) (_,p') -> compare p p') messages in
|
||||
let i = ref 0 in (** Basic balancing:1 message every 10Hz *)
|
||||
let phase = ref 0 in
|
||||
let l = ref [] in
|
||||
List.iter
|
||||
(fun (message, p) ->
|
||||
let message_name = ExtXml.attrib message "name" in
|
||||
i := !i mod p;
|
||||
let else_ = if List.mem_assoc p !l && not (List.mem (p, !i) !l) then "else " else "" in
|
||||
lprintf avr_h "%sif (i%d == %d) {\\\n" else_ p !i;
|
||||
l := (p, !i) :: !l;
|
||||
(* if phase attribute is present, use it, otherwise shedule at 10Hz *)
|
||||
let message_phase = try int_of_float (float_of_string (ExtXml.attrib message "phase")*.float_of_int !freq) with _ -> !i in
|
||||
phase := message_phase;
|
||||
let else_ = if List.mem_assoc p !l && not (List.mem (p, !phase) !l) then "else " else "" in
|
||||
lprintf avr_h "%sif (i%d == %d) {\\\n" else_ p !phase;
|
||||
l := (p, !phase) :: !l;
|
||||
i := !i + !freq/10;
|
||||
right ();
|
||||
lprintf avr_h "PERIODIC_SEND_%s();\\\n" message_name;
|
||||
|
||||
Reference in New Issue
Block a user