mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-24 05:45:59 +08:00
Adding support for displaying link status information when multiple aircraft are connected through the same link. Also added support for recording link status information in flight logs and displaying it during a replay.
This commit is contained in:
+14
-14
@@ -559,7 +559,20 @@
|
||||
<field name="rssi_fade_margin" type="uint8" unit="dB"/>
|
||||
<field name="duty" type="uint8" unit="%"/>
|
||||
</message>
|
||||
<!-- 71 is free -->
|
||||
|
||||
<message name="LINK_STATUS" id="71">
|
||||
<field name="link_id" type="uint8"/>
|
||||
<field name="time_since_last_msg" type="float" unit="s"/>
|
||||
<field name="run_time" type="uint32" unit="s"/>
|
||||
<field name="rx_bytes" type="uint32"/>
|
||||
<field name="rx_msgs" type="uint32"/>
|
||||
<field name="rx_err" type="uint32"/>
|
||||
<field name="rx_bytes_rate" type="float" format="%.1f"/>
|
||||
<field name="rx_msgs_rate" type="float" format="%.1f"/>
|
||||
<field name="ping_time" type="float" format="%.2f" unit="ms"/>
|
||||
</message>
|
||||
|
||||
|
||||
<!-- 72 is free -->
|
||||
<!-- 73 is free -->
|
||||
<!-- 74 is free -->
|
||||
@@ -2474,19 +2487,6 @@
|
||||
<field name="message" type="string" format=";sv"/>
|
||||
</message>
|
||||
|
||||
<message name="LINK_STATUS" id="36">
|
||||
<field name="link_id" type="uint8"/>
|
||||
<field name="ac_id" type="string"/>
|
||||
<field name="time_since_last_msg" type="float" unit="s"/>
|
||||
<field name="run_time" type="uint32" unit="s"/>
|
||||
<field name="rx_bytes" type="uint32"/>
|
||||
<field name="rx_msgs" type="uint32"/>
|
||||
<field name="rx_err" type="uint32"/>
|
||||
<field name="rx_bytes_rate" type="float" format="%.1f"/>
|
||||
<field name="rx_msgs_rate" type="float" format="%.1f"/>
|
||||
<field name="ping_time" type="float" format="%.2f" unit="ms"/>
|
||||
</message>
|
||||
|
||||
<message name="PLUMES" id="100">
|
||||
<field name="ids" type="string" format="csv"/>
|
||||
<field name="lats" type="string" format="csv"/>
|
||||
|
||||
@@ -118,7 +118,7 @@ let find_ac = fun ac_id ->
|
||||
let active_ac = ref ""
|
||||
let get_ac = fun vs ->
|
||||
let ac_id = Pprz.string_assoc "ac_id" vs in
|
||||
find_ac ac_id
|
||||
find_ac ac_id
|
||||
|
||||
let show_fp = fun ac ->
|
||||
ac.fp_group#show ();
|
||||
@@ -825,8 +825,8 @@ let get_fbw_msg = fun alarm _sender vs ->
|
||||
log_and_say alarm ac.ac_name (sprintf "%s, mayday, AP Failure. Switch to manual." ac.ac_speech_name)
|
||||
end
|
||||
|
||||
let get_link_status_msg = fun alarm _sender vs ->
|
||||
let ac = get_ac vs in
|
||||
let get_link_status_msg = fun alarm sender vs ->
|
||||
let ac = find_ac sender in
|
||||
let link_id = Pprz.int_assoc "link_id" vs in
|
||||
let time_since_last_msg = Pprz.float_assoc "time_since_last_msg" vs in
|
||||
let rx_msgs_rate = Pprz.float_assoc "rx_msgs_rate" vs in
|
||||
@@ -869,7 +869,7 @@ let listen_if_calib_msg = fun () ->
|
||||
safe_bind "INFLIGH_CALIB" get_if_calib_msg
|
||||
|
||||
let listen_link_status_msg = fun a ->
|
||||
safe_bind "LINK_STATUS" (get_link_status_msg a)
|
||||
tele_bind "LINK_STATUS" (get_link_status_msg a)
|
||||
|
||||
let list_separator = Str.regexp ","
|
||||
|
||||
|
||||
@@ -121,9 +121,9 @@ class Link:
|
||||
def __init__(self, name, ac_id, buffer_size=10, verbose=0):
|
||||
self.buffer = Circular_Buffer(buffer_size)
|
||||
self.name = name
|
||||
self.ac_id = ac_id
|
||||
self.time_of_last_message = time()
|
||||
self.verbose = verbose
|
||||
self.acs = [ac_id] #Storing a list of the aircrafts that use this link. Usually it's just one.
|
||||
|
||||
# The following are stored values from the DOWNLINK_STATUS message:
|
||||
self.run_time = 0
|
||||
@@ -153,22 +153,26 @@ class Link:
|
||||
def timeSinceLastMessage(self):
|
||||
return time() - self.time_of_last_message
|
||||
|
||||
def acAc(self, ac_id):
|
||||
self.acs = self.acs + [ac_id]
|
||||
|
||||
def aircrafts(self):
|
||||
return self.acs
|
||||
|
||||
def sendLinkStatusMessage(self):
|
||||
values = ( self.name,
|
||||
self.ac_id,
|
||||
self.timeSinceLastMessage(),
|
||||
self.run_time,
|
||||
self.rx_bytes,
|
||||
self.rx_msgs,
|
||||
self.rx_err,
|
||||
self.rx_bytes_rate,
|
||||
self.rx_msgs_rate,
|
||||
self.ping_time)
|
||||
|
||||
IvySendMsg("ground LINK_STATUS %s %s %f %s %s %s %s %s %s %s" % values)
|
||||
threading.Timer(LINK_STATUS_PERIOD, self.sendLinkStatusMessage).start()
|
||||
|
||||
for ac_id in self.acs:
|
||||
values = ( self.name,
|
||||
self.timeSinceLastMessage(),
|
||||
self.run_time,
|
||||
self.rx_bytes,
|
||||
self.rx_msgs,
|
||||
self.rx_err,
|
||||
self.rx_bytes_rate,
|
||||
self.rx_msgs_rate,
|
||||
self.ping_time)
|
||||
|
||||
IvySendMsg("%s LINK_STATUS %s %f %s %s %s %s %s %s %s" % ((ac_id,) + values))
|
||||
threading.Timer(LINK_STATUS_PERIOD, self.sendLinkStatusMessage).start()
|
||||
|
||||
def updateStatus(self, downlink_status_message):
|
||||
|
||||
@@ -220,12 +224,15 @@ class Link_Combiner:
|
||||
self.repeatSendLinkStatusMessage(message)
|
||||
|
||||
#Processing messages from an already added link
|
||||
sent = self.sendMessage(message)
|
||||
link = self.links[message.linkName()]
|
||||
self.sendMessage(message)
|
||||
self.bufferMessage(message)
|
||||
if message.name() != "DOWNLINK_STATUS":
|
||||
self.links[message.linkName()].updateTimeOfLastMessage()
|
||||
link.updateTimeOfLastMessage()
|
||||
else:
|
||||
self.links[message.linkName()].updateStatus(message)
|
||||
link.updateStatus(message)
|
||||
if message.sender() not in link.aircrafts():
|
||||
link.addAc(message.sender())
|
||||
|
||||
|
||||
def sendMessage(self, message):
|
||||
|
||||
@@ -597,7 +597,7 @@ module MessagesOfXml(Class:CLASS_Xml) = struct
|
||||
formatted_string_of_value field.fformat v)
|
||||
msg.fields)
|
||||
|
||||
let message_send = fun ?timestamp sender msg_name values ->
|
||||
let message_send = fun ?timestamp ?link_id sender msg_name values ->
|
||||
let m = snd (message_of_name msg_name) in
|
||||
let s = string_of_message m values in
|
||||
let timestamp_string =
|
||||
|
||||
Reference in New Issue
Block a user