diff --git a/conf/control_panel_example.xml b/conf/control_panel_example.xml index a9a481c5c2..2b5a38be63 100644 --- a/conf/control_panel_example.xml +++ b/conf/control_panel_example.xml @@ -17,11 +17,12 @@ - + + + - diff --git a/sw/ground_segment/python/real_time_plot/messagepicker.py b/sw/ground_segment/python/real_time_plot/messagepicker.py index 97e17471bf..c700325280 100755 --- a/sw/ground_segment/python/real_time_plot/messagepicker.py +++ b/sw/ground_segment/python/real_time_plot/messagepicker.py @@ -3,14 +3,33 @@ from __future__ import absolute_import, print_function import wx -import getopt import sys -import os +import time +from os import path, getenv -sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python") +# if PAPARAZZI_SRC not set, then assume the tree containing this +# file is a reasonable substitute +PPRZ_SRC = getenv("PAPARAZZI_SRC", path.normpath(path.join(path.dirname(path.abspath(__file__)), '../../../../'))) +sys.path.append(PPRZ_SRC + "/sw/lib/python") + +from ivy_msg_interface import IvyMessagesInterface +from pprz_msg.message import PprzMessage -import messages_tool +class Message(PprzMessage): + def __init__(self, class_name, name): + super(Message, self).__init__(class_name, name) + self.field_controls = [] + self.index = None + self.last_seen = time.clock() + + +class Aircraft(object): + def __init__(self, ac_id): + self.ac_id = ac_id + self.messages = {} + self.messages_book = None + class MessagePicker(wx.Frame): def __init__(self, parent, callback, initIvy = True): @@ -24,27 +43,30 @@ class MessagePicker(wx.Frame): self.tree.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick) self.tree.Bind(wx.EVT_CHAR, self.OnKeyChar) self.Bind( wx.EVT_CLOSE, self.OnClose) - self.message_interface = messages_tool.IvyMessagesInterface(self.msg_recv, initIvy) + self.message_interface = IvyMessagesInterface(self.msg_recv, initIvy) def OnClose(self, event): - self.message_interface.Stop() + self.message_interface.shutdown() self.Destroy() - def msg_recv(self, ac_id, name, values): + def msg_recv(self, ac_id, msg): + if msg.msg_class != "telemetry": + return + self.tree.Expand(self.root) if ac_id not in self.aircrafts: ac_node = self.tree.AppendItem(self.root, str(ac_id)) - self.aircrafts[ac_id] = messages_tool.Aircraft(ac_id) + self.aircrafts[ac_id] = Aircraft(ac_id) self.aircrafts[ac_id].messages_book = ac_node aircraft = self.aircrafts[ac_id] ac_node = aircraft.messages_book - if name not in aircraft.messages: - msg_node = self.tree.AppendItem(ac_node, str(name)) + if msg.name not in aircraft.messages: + msg_node = self.tree.AppendItem(ac_node, str(msg.name)) self.tree.SortChildren(ac_node) - aircraft.messages[name] = messages_tool.Message("telemetry", name) - for field in aircraft.messages[name].field_names: + aircraft.messages[msg.name] = Message("telemetry", msg.name) + for field in aircraft.messages[msg.name].fieldnames: item = self.tree.AppendItem(msg_node, field) def OnKeyChar(self, event):