mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-23 04:45:37 +08:00
kill_mode attribute
This commit is contained in:
+2
-1
@@ -80,7 +80,7 @@
|
||||
<field name="desired_gaz" type="int16" unit="pprz"></field>
|
||||
<field name="voltage" type="uint8" unit="1e-1V"></field>
|
||||
<field name="flight_time" type="uint16" unit="s"></field>
|
||||
<field name="status_battery" type="uint8" values="LOW|OK"></field>
|
||||
<field name="kill_auto_throttle" type="uint8" unit="bool"></field>
|
||||
<field name="block_time" type="uint16" unit="s"></field>
|
||||
<field name="stage_time" type="uint16" unit="s"></field>
|
||||
<field name="energy" type="uint16" unit="mAh"/>
|
||||
@@ -466,6 +466,7 @@
|
||||
<field name="horiz_mode" type="string" values="WAYPOINT|ROUTE|CIRCLE"/>
|
||||
<field name="gaz_mode" type="string" values="MANUAL|GAZ|CLIMB|ALT"/>
|
||||
<field name="gps_mode" type="string" values="NOFIX|DRO|2D|3D|GPSDRO"/>
|
||||
<field name="kill_mode" type="string" values="OFF|ON"/>
|
||||
<field name="flight_time" type="uint32" />
|
||||
</message>
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ OCAMLLIB = ../../lib/ocaml
|
||||
INCLUDES= -I $(OCAMLLIB) -I ../multimon -I +lablgtk2 -I +xml-light
|
||||
LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma
|
||||
|
||||
SERVERCMO = aircraft.cmo wind.cmo airprox.cmo server.cmo
|
||||
SERVERCMX = $(SERVERCMO:.cmo=.cmx)
|
||||
|
||||
$(VAR)/boa.conf :$(CONF)/boa.conf
|
||||
mkdir -p $(VAR)
|
||||
sed 's|PAPARAZZI_HOME|$(PAPARAZZI_HOME)|' < $< > $@
|
||||
@@ -49,10 +52,14 @@ messages : messages.cmo
|
||||
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $^
|
||||
|
||||
|
||||
server : aircraft.cmo wind.cmo airprox.cmo server.cmo
|
||||
server : $(SERVERCMO)
|
||||
@echo OL $@
|
||||
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $^
|
||||
|
||||
server.opt : $(SERVERCMX)
|
||||
@echo OOL $@
|
||||
$(Q)$(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa lablgtk.cmxa glibivy-ocaml.cmxa lib-pprz.cmxa $^
|
||||
|
||||
link : modem.cmo link.cmo
|
||||
@echo OL $@
|
||||
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $^
|
||||
@@ -62,6 +69,10 @@ link : modem.cmo link.cmo
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLC) $(INCLUDES) -c $<
|
||||
|
||||
%.cmx : %.ml
|
||||
@echo OOC $<
|
||||
$(Q)$(OCAMLOPT) $(INCLUDES) -c $<
|
||||
|
||||
%.cmi : %.mli $(LIBPPRZCMA)
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLC) $(INCLUDES) $<
|
||||
|
||||
@@ -93,6 +93,7 @@ type aircraft = {
|
||||
mutable cur_block : int;
|
||||
mutable cur_stage : int;
|
||||
mutable throttle : float;
|
||||
mutable kill_mode : bool;
|
||||
mutable throttle_accu : float;
|
||||
mutable rpm : float;
|
||||
mutable temp : float;
|
||||
|
||||
@@ -80,6 +80,7 @@ type aircraft = {
|
||||
mutable cur_block : int;
|
||||
mutable cur_stage : int;
|
||||
mutable throttle : float;
|
||||
mutable kill_mode : bool;
|
||||
mutable throttle_accu : float;
|
||||
mutable rpm : float;
|
||||
mutable temp : float;
|
||||
|
||||
@@ -191,6 +191,7 @@ let log_and_parse = fun logging ac_name a msg values ->
|
||||
| "BAT" ->
|
||||
a.last_bat_msg_date <- U.gettimeofday ();
|
||||
a.throttle <- fvalue "desired_gaz" /. 9600. *. 100.;
|
||||
a.kill_mode <- ivalue "kill_auto_throttle" <> 0;
|
||||
a.flight_time <- ivalue "flight_time";
|
||||
a.rpm <- a.throttle *. 100.;
|
||||
a.bat <- fvalue "voltage" /. 10.;
|
||||
@@ -512,14 +513,17 @@ let send_aircraft_msg = fun ac ->
|
||||
let gaz_mode = get_indexed_value gaz_modes a.gaz_mode in
|
||||
let lat_mode = get_indexed_value lat_modes a.lateral_mode in
|
||||
let horiz_mode = get_indexed_value horiz_modes a.horizontal_mode in
|
||||
let gps_mode = get_indexed_value gps_modes a.gps_mode in
|
||||
let gps_mode = get_indexed_value gps_modes a.gps_mode
|
||||
and kill_mode = if a.kill_mode then "ON" else "OFF" in
|
||||
let values = ["ac_id", Pprz.String ac;
|
||||
"flight_time", Pprz.Int a.flight_time;
|
||||
"ap_mode", Pprz.String ap_mode;
|
||||
"gaz_mode", Pprz.String gaz_mode;
|
||||
"lat_mode", Pprz.String lat_mode;
|
||||
"horiz_mode", Pprz.String horiz_mode;
|
||||
"gps_mode", Pprz.String gps_mode] in
|
||||
"gps_mode", Pprz.String gps_mode;
|
||||
"kill_mode", Pprz.String kill_mode
|
||||
] in
|
||||
Ground_Pprz.message_send my_id "AP_STATUS" values;
|
||||
|
||||
send_cam_status a;
|
||||
@@ -551,7 +555,7 @@ let new_aircraft = fun id ->
|
||||
nav_ref = None;
|
||||
cam = { phi = 0.; theta = 0. ; target=(0.,0.)};
|
||||
inflight_calib = { if_mode = 1 ; if_val1 = 0.; if_val2 = 0.};
|
||||
infrared = infrared_init;
|
||||
infrared = infrared_init; kill_mode = false;
|
||||
fbw = { rc_status = "???"; rc_mode = "???" };
|
||||
svinfo = Array.create gps_nb_channels svinfo_init;
|
||||
dl_setting_values = Array.create max_nb_dl_setting_values 42.;
|
||||
@@ -564,8 +568,9 @@ let new_aircraft = fun id ->
|
||||
|
||||
let check_alerts = fun a ->
|
||||
let send = fun level ->
|
||||
let vs =
|
||||
["ac_id", Pprz.String a.id; "level", Pprz.String level; "value", Pprz.Float a.bat] in
|
||||
let vs = [ "ac_id", Pprz.String a.id;
|
||||
"level", Pprz.String level;
|
||||
"value", Pprz.Float a.bat] in
|
||||
Alerts_Pprz.message_send my_id "BAT_LOW" vs in
|
||||
if a.bat < 9. then send "CATASTROPHIC"
|
||||
else if a.bat < 10. then send "CRITIC"
|
||||
|
||||
Reference in New Issue
Block a user