the RC status in the GCS shows the quality of signal reception with green over orange

This commit is contained in:
Gautier Hattenberger
2010-10-20 11:48:18 +00:00
parent 747fff36e3
commit c09e55dc60
12 changed files with 86 additions and 43 deletions
+22 -14
View File
@@ -30,9 +30,9 @@
</message>
<message name="ATTITUDE" id="6">
<field name="phi" type="float" unit="rad" alt_unit="deg" alt_unit_coef="57.3"/>
<field name="psi" type="float" unit="rad" alt_unit="deg" alt_unit_coef="57.3"/>
<field name="theta" type="float" unit="rad" alt_unit="deg" alt_unit_coef="57.3"/>
<field name="phi" type="float" unit="rad" alt_unit="deg"/>
<field name="psi" type="float" unit="rad" alt_unit="deg"/>
<field name="theta" type="float" unit="rad" alt_unit="deg"/>
</message>
<message name="IR_SENSORS" id="7">
@@ -45,12 +45,12 @@
<message name="GPS" id="8">
<field name="mode" type="uint8" unit="byte_mask"/>
<field name="utm_east" type="int32" unit="cm" alt_unit="m" alt_unit_coef="0.01"/>
<field name="utm_north" type="int32" unit="cm" alt_unit="m" alt_unit_coef="0.01"/>
<field name="course" type="int16" unit="decideg" alt_unit="deg" alt_unit_coef="0.1"/>
<field name="alt" type="int32" unit="cm" alt_unit="m" alt_unit_coef="0.01"/>
<field name="speed" type="uint16" unit="cm/s" alt_unit="m/s" alt_unit_coef="0.01"/>
<field name="climb" type="int16" unit="cm/s" alt_unit="m/s" alt_unit_coef="0.01"/>
<field name="utm_east" type="int32" unit="cm" alt_unit="m"/>
<field name="utm_north" type="int32" unit="cm" alt_unit="m"/>
<field name="course" type="int16" unit="decideg" alt_unit="deg"/>
<field name="alt" type="int32" unit="cm" alt_unit="m"/>
<field name="speed" type="uint16" unit="cm/s" alt_unit="m/s"/>
<field name="climb" type="int16" unit="cm/s" alt_unit="m/s"/>
<field name="week" type="uint16" unit="weeks"></field>
<field name="itow" type="uint32" unit="ms"/>
<field name="utm_zone" type="uint8"/>
@@ -85,7 +85,7 @@
<message name="BAT" id="12">
<field name="throttle" type="int16" unit="pprz"/>
<field name="voltage" type="uint16" unit="1e-1V" alt_unit="V" alt_unit_coef="0.1"/>
<field name="voltage" type="uint8" unit="1e-1V" alt_unit="V" alt_unit_coef="0.1"/>
<field name="amps" type="int16" unit="A" alt_unit="A" />
<field name="flight_time" type="uint16" unit="s"/>
<field name="kill_auto_throttle" type="uint8" unit="bool"/>
@@ -374,8 +374,6 @@
<field name="ir1" type="int16" unit="adc"/>
<field name="ir2" type="int16" unit="adc"/>
<field name="top" type="int16" unit="adc"/>
<field name="phi" type="float" unit="rad" alt_unit="deg" alt_unit_coef="57.3"/>
<field name="theta" type="float" unit="rad" alt_unit="deg" alt_unit_coef="57.3"/>
</message>
<message name="AIRSPEED" id="54">
@@ -430,8 +428,16 @@
<field name="scaled" type="float"/>
</message>
<!-- 58 is free -->
<!-- 59 is free -->
<message name="PBN" id="58">
<field name="airspeed_adc" type="uint16"></field>
<field name="altitude_adc" type="uint16"></field>
<field name="airspeed" type="float"></field>
<field name="altitude" type="float"></field>
<field name="airspeed_offset" type="uint16"></field>
<field name="altitude_offset" type="uint16"></field>
</message>
<!-- 59 is free -->
<message name="H_CTL_A" id="60">
<field name="roll_sum_err" type="float"/>
@@ -646,6 +652,7 @@
<message name="FBW_STATUS" id="103">
<field name="rc_status" type="uint8" values="OK|LOST|REALLY_LOST"/>
<field name="frame_rate" type="uint8" unit="Hz"/>
<field name="mode" type="uint8" values="MANUAL|AUTO|FAILSAFE"/>
<field name="vsupply" type="uint8" unit="decivolt"/>
<field name="current" type="int32" unit="mA"/>
@@ -2085,6 +2092,7 @@
<field name="ac_id" type="string"/>
<field name="rc_status" type="string" values="OK|LOST|REALLY_LOST"/>
<field name="rc_mode" type="string" values="MANUAL|AUTO|FAILSAFE"/>
<field name="rc_rate" type="uint8" unit="Hz"/>
</message>
<message name="INFLIGH_CALIB" id="19">
+2 -2
View File
@@ -53,7 +53,7 @@
#define PERIODIC_SEND_COMMANDS(_chan) DOWNLINK_SEND_COMMANDS(_chan, COMMANDS_NB, commands)
#ifdef RADIO_CONTROL
#define PERIODIC_SEND_FBW_STATUS(_chan) DOWNLINK_SEND_FBW_STATUS(_chan, &(radio_control.status), &fbw_mode, &fbw_vsupply_decivolt, &fbw_current_milliamp)
#define PERIODIC_SEND_FBW_STATUS(_chan) DOWNLINK_SEND_FBW_STATUS(_chan, &(radio_control.status), &(radio_control.frame_rate), &fbw_mode, &fbw_vsupply_decivolt, &fbw_current_milliamp)
#ifdef RADIO_CONTROL_TYPE_PPM
#define PERIODIC_SEND_PPM(_chan) DOWNLINK_SEND_PPM(_chan, &(radio_control.frame_rate), PPM_NB_CHANNEL, ppm_pulses)
#else
@@ -61,7 +61,7 @@
#endif
#define PERIODIC_SEND_RC(_chan) DOWNLINK_SEND_RC(_chan, RADIO_CONTROL_NB_CHANNEL, radio_control.values)
#else // RADIO_CONTROL
#define PERIODIC_SEND_FBW_STATUS(_chan) { uint8_t dummy = 0; DOWNLINK_SEND_FBW_STATUS(_chan, &dummy, &fbw_mode, &fbw_vsupply_decivolt, &fbw_current_milliamp); }
#define PERIODIC_SEND_FBW_STATUS(_chan) { uint8_t dummy = 0; DOWNLINK_SEND_FBW_STATUS(_chan, &dummy, &dummy, &fbw_mode, &fbw_vsupply_decivolt, &fbw_current_milliamp); }
#define PERIODIC_SEND_PPM(_chan) {}
#define PERIODIC_SEND_RC(_chan) {}
#endif // RADIO_CONTROL
+2 -6
View File
@@ -87,6 +87,7 @@
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="spacing">2</property>
<property name="homogeneous">True</property>
<child>
<widget class="GtkEventBox" id="eventbox_mode">
<property name="visible">True</property>
@@ -94,7 +95,6 @@
<child>
<widget class="GtkLabel" id="label_mode">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;AUTO2&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
@@ -109,11 +109,8 @@
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Radio Command status</property>
<child>
<widget class="GtkLabel" id="label_rc">
<widget class="GtkDrawingArea" id="drawingarea_rc">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">NO RC</property>
<property name="use_markup">True</property>
</widget>
</child>
</widget>
@@ -128,7 +125,6 @@
<child>
<widget class="GtkLabel" id="label_gps">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">3D</property>
<property name="use_markup">True</property>
<property name="justify">center</property>
+5 -7
View File
@@ -771,14 +771,12 @@ let get_wind_msg = fun (geomap:G.widget) _sender vs ->
let get_fbw_msg = fun _sender vs ->
let ac = get_ac vs in
let status = Pprz.string_assoc "rc_status" vs in
ac.strip#set_label "RC" status;
ac.strip#set_color "RC"
(match status with
"OK" -> ok_color
| _ -> warning_color)
let status = Pprz.string_assoc "rc_status" vs
and rate = (Pprz.int_assoc "rc_rate" vs) / 5 in
(* divide by 5 to have normal values between 0 and 10 *)
(* RC rate max approx. 50 Hz *)
ac.strip#set_rc rate status
let get_engine_status_msg = fun _sender vs ->
let ac = get_ac vs in
+9 -1
View File
@@ -47,6 +47,7 @@ type t =
set_climb : float -> unit;
set_color : string -> string -> unit;
set_label : string -> string -> unit;
set_rc : int -> string -> unit;
connect : (unit -> unit) -> unit;
hide_buttons : unit -> unit;
show_buttons : unit -> unit >
@@ -263,8 +264,12 @@ let add = fun config strip_param ->
add_label "telemetry_status_value" (eb, ts);
ts#set_width_chars 3;
(* RC *)
strip#drawingarea_rc#misc#realize ();
let rc = new hgauge strip#drawingarea_rc 0. 10. in
rc#request_width "NONE";
(* Labels *)
add_label "RC_value" (strip#eventbox_rc, strip#label_rc);
add_label "AP_value" (strip#eventbox_mode, strip#label_mode);
add_label "GPS_value" (strip#eventbox_gps, strip#label_gps);
@@ -322,6 +327,9 @@ let add = fun config strip_param ->
method set_label name value = set_label !strip_labels name value
method set_color name value = set_color !strip_labels name value
method set_rc rate status = rc#set (float_of_int rate) status
(* add a button widget in a vertical box if it belongs to a group (create new group if needed) *)
method add_widget ?(group="") w =
let (vbox, pack) = match String.length group with
+1
View File
@@ -47,6 +47,7 @@ type t = <
set_climb : float -> unit;
set_color : string -> string -> unit;
set_label : string -> string -> unit;
set_rc : int -> string -> unit;
hide_buttons : unit -> unit;
show_buttons : unit -> unit;
connect : (unit -> unit) -> unit
+2 -1
View File
@@ -35,6 +35,7 @@ type rc_mode = string (** MANUAL, AUTO, FAILSAFE *)
type fbw = {
mutable rc_status : rc_status;
mutable rc_mode : rc_mode;
mutable rc_rate : int;
}
let gps_nb_channels = 16
@@ -164,7 +165,7 @@ let new_aircraft = fun id name fp airframe ->
gaz_mode= -1; lateral_mode= -1;
gps_mode =0; gps_Pacc = 0; periodic_callbacks = [];
cam = { phi = 0.; theta = 0. ; target=(0.,0.)};
fbw = { rc_status = "???"; rc_mode = "???" };
fbw = { rc_status = "???"; rc_mode = "???"; rc_rate=0 };
svinfo = svsinfo_init;
dl_setting_values = Array.create max_nb_dl_setting_values 42.;
nb_dl_setting_values = 0;
+1 -1
View File
@@ -32,7 +32,7 @@ type ac_cam = {
type rc_status = string
type rc_mode = string
type fbw = { mutable rc_status : rc_status; mutable rc_mode : rc_mode; }
type fbw = { mutable rc_status : rc_status; mutable rc_mode : rc_mode; mutable rc_rate : int }
val gps_nb_channels : int
type svinfo = {
svid : int;
+2 -1
View File
@@ -185,7 +185,8 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
a.block_time <- ivalue "block_time";
a.energy <- ivalue "energy"
| "FBW_STATUS" ->
a.bat <- fvalue "vsupply" /. 10.
a.bat <- fvalue "vsupply" /. 10.;
a.fbw.rc_rate <- ivalue "frame_rate"
| "PPRZ_MODE" ->
a.ap_mode <- check_index (ivalue "ap_mode") ap_modes "AP_MODE";
a.gaz_mode <- check_index (ivalue "ap_gaz") gaz_modes "AP_GAZ";
+36 -9
View File
@@ -30,6 +30,7 @@ open Printf
open Server_globals
let enabled = ref false
let no_http = ref false
let port = ref 8889
let el = fun t a c -> Xml.Element (t, a, c)
@@ -211,7 +212,12 @@ let update_waypoints =
Hashtbl.iter (fun wp_id wp -> if wp_id > 0 then l := (wp_id, wp) :: !l) ac.waypoints;
if !l <> !last_state then begin
last_state := !l;
let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in
let url_flight_plan =
if !no_http then
sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name
else
sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name
in
let changes = List.map (fun (wp_id, wp) -> change_waypoint ac.name wp_id wp.wp_geo wp.altitude) !l in
let kml_update = link_update url_flight_plan changes in
print_xml ac.name "wp_changes.kml" kml_update
@@ -223,7 +229,13 @@ let update_horiz_mode =
fun ac ->
if ac.horiz_mode <> !last_horiz_mode then begin
last_horiz_mode := ac.horiz_mode;
let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in
(*let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in*)
let url_flight_plan =
if !no_http then
sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name
else
sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name
in
let alt = ac.desired_altitude in
match ac.horiz_mode with
Segment (p1, p2) ->
@@ -240,7 +252,13 @@ let update_horiz_mode =
let update_ac = fun ac ->
try
let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in
(*let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in*)
let url_flight_plan =
if !no_http then
sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name
else
sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name
in
let blocks = ExtXml.child ac.flight_plan "blocks" in
let block = ExtXml.child blocks (string_of_int ac.cur_block) in
let block_name = ExtXml.attrib block "name" in
@@ -257,9 +275,18 @@ let build_files = fun a ->
let kml_fp = flight_plan a.name xml_fp in
print_xml a.name "flight_plan.kml" kml_fp;
let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port a.name in
let url_ac_changes = sprintf "http://%s:%d/var/%s/ac_changes.kml" !hostname !port a.name in
let url_wp_changes = sprintf "http://%s:%d/var/%s/wp_changes.kml" !hostname !port a.name in
let url_route_changes = sprintf "http://%s:%d/var/%s/route_changes.kml" !hostname !port a.name in
let kml_ac = aircraft a.name url_flight_plan [url_ac_changes; url_wp_changes; url_route_changes] in
print_xml a.name "FollowMe.kml" kml_ac;;
if !no_http then begin
let url_flight_plan = sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home a.name in
let url_ac_changes = sprintf "%s/var/%s/ac_changes.kml" Env.paparazzi_home a.name in
let url_wp_changes = sprintf "%s/var/%s/wp_changes.kml" Env.paparazzi_home a.name in
let url_route_changes = sprintf "%s/var/%s/route_changes.kml" Env.paparazzi_home a.name in
let kml_ac = aircraft a.name url_flight_plan [url_ac_changes; url_wp_changes; url_route_changes] in
print_xml a.name "FollowMe.kml" kml_ac
end else begin
let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port a.name in
let url_ac_changes = sprintf "http://%s:%d/var/%s/ac_changes.kml" !hostname !port a.name in
let url_wp_changes = sprintf "http://%s:%d/var/%s/wp_changes.kml" !hostname !port a.name in
let url_route_changes = sprintf "http://%s:%d/var/%s/route_changes.kml" !hostname !port a.name in
let kml_ac = aircraft a.name url_flight_plan [url_ac_changes; url_wp_changes; url_route_changes] in
print_xml a.name "FollowMe.kml" kml_ac
end;;
+1
View File
@@ -25,6 +25,7 @@
*)
val enabled : bool ref
val no_http : bool ref
val port : int ref
val build_files : Aircraft.aircraft -> unit
val update_waypoints : Aircraft.aircraft -> unit
+3 -1
View File
@@ -164,7 +164,8 @@ let send_cam_status = fun a ->
let send_fbw = fun a ->
let values = [ "ac_id", Pprz.String a.id;
"rc_mode", Pprz.String a.fbw.rc_mode;
"rc_status", Pprz.String a.fbw.rc_status ] in
"rc_status", Pprz.String a.fbw.rc_status;
"rc_rate", Pprz.Int a.fbw.rc_rate ] in
Ground_Pprz.message_send my_id "FLY_BY_WIRE" values
let send_dl_values = fun a ->
@@ -661,6 +662,7 @@ let () =
"-hostname", Arg.Set_string hostname, "<hostname> Set the address for the http server";
"-http", Arg.Set http, "Send http: URLs (default is file:)";
"-kml", Arg.Set Kml.enabled, "Enable KML file updating";
"-kml_no_http", Arg.Set Kml.no_http, "KML without web server (local files only)";
"-kml_port", Arg.Set_int Kml.port, (sprintf "Port for KML files (default is %d)" !Kml.port);
"-n", Arg.Clear logging, "Disable log";
"-no_md5_check", Arg.Set no_md5_check, "Disable safety matching of live and current configurations";