本文整理汇总了Python中ivy_msg_interface.IvyMessagesInterface.bind_raw方法的典型用法代码示例。如果您正苦于以下问题:Python IvyMessagesInterface.bind_raw方法的具体用法?Python IvyMessagesInterface.bind_raw怎么用?Python IvyMessagesInterface.bind_raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ivy_msg_interface.IvyMessagesInterface
的用法示例。
在下文中一共展示了IvyMessagesInterface.bind_raw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlotPanel
# 需要导入模块: from ivy_msg_interface import IvyMessagesInterface [as 别名]
# 或者: from ivy_msg_interface.IvyMessagesInterface import bind_raw [as 别名]
#.........这里部分代码省略.........
return
for field in self.plots[ac_id][message]:
plot = self.plots[ac_id][message][field]
ix = messages_xml_map.message_dictionary["telemetry"][message].index(field)
point = float(data[ix + 2])
if self.x_axis is None or self.x_axis.id != plot.id:
if self.auto_scale:
scaled_point = (point + plot.offset) * plot.scale
self.max = max(self.max, scaled_point)
self.min = min(self.min, scaled_point)
if self.x_axis is not None:
plot.index = self.x_axis.index
plot.AddPoint(point, self.x_axis)
def BindCurve(self, ac_id, message, field, color=None, use_as_x=False, scale=1.0):
# -- add this telemetry to our list of things to plot ...
message_string = _IVY_STRING % (ac_id, message)
# print('Binding to %s' % message_string)
if ac_id not in self.plots:
self.plots[ac_id] = {}
if message not in self.plots[ac_id]:
self.plots[ac_id][message] = {}
if field in self.plots[ac_id][message]:
self.plots[ac_id][message][field].color = wx.Color(random.randint(0, 255), random.randint(0, 255),
random.randint(0, 255))
return
ivy_id = self.ivy_interface.bind_raw(self.OnIvyMsg, str(message_string))
title = '%i:%s:%s' % (ac_id, message, field)
self.plots[ac_id][message][field] = PlotData(ivy_id, title, self.plot_size, color, scale)
self.frame.AddCurve(ivy_id, title, use_as_x)
if use_as_x:
self.x_axis = self.plots[ac_id][message][field]
def CalcMinMax(self, plot):
if not self.auto_scale: return
for x in plot.data:
self.max = max(self.max, x)
self.min = min(self.min, x)
self.frame.SetMinMax(self.min, self.max)
def FindPlotName(self, ivy_id):
for ac_id in self.plots:
for msg in self.plots[ac_id]:
for field in self.plots[ac_id][msg]:
if self.plots[ac_id][msg][field].id == ivy_id:
return (ac_id, msg, field)
return (None, None, None)
def FindPlot(self, ivy_id):
(ac_id, msg, field) = self.FindPlotName(ivy_id)
if ac_id is None:
return None
return self.plots[ac_id][msg][field]
def RemovePlot(self, ivy_id):
(ac_id, msg, field) = self.FindPlotName(ivy_id)
if ac_id is None:
return