本文整理匯總了Python中receiver.Receiver.stop方法的典型用法代碼示例。如果您正苦於以下問題:Python Receiver.stop方法的具體用法?Python Receiver.stop怎麽用?Python Receiver.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類receiver.Receiver
的用法示例。
在下文中一共展示了Receiver.stop方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import stop [as 別名]
class GCS:
def __init__(self):
# No communications or arming yet
self.comms = None
self.armed = False
# Do basic Tk initialization
self.root = Tk()
self.root.configure(bg=BACKGROUND_COLOR)
self.root.resizable(False, False)
self.root.title('Hackflight Ground Control Station')
left = (self.root.winfo_screenwidth() - DISPLAY_WIDTH) / 2
top = (self.root.winfo_screenheight() - DISPLAY_HEIGHT) / 2
self.root.geometry('%dx%d+%d+%d' % (DISPLAY_WIDTH, DISPLAY_HEIGHT, left, top))
self.frame = Frame(self.root)
self.root.wm_iconbitmap(bitmap = "@media/icon.xbm")
self.root.tk.call('wm', 'iconphoto', self.root._w, PhotoImage('icon.png'))
self.root.protocol('WM_DELETE_WINDOW', self.quit)
# Create panes for two rows of widgets
self.pane1 = self._add_pane()
self.pane2 = self._add_pane()
# Add a buttons
self.button_connect = self._add_button('Connect', self.pane1, self._connect_callback)
self.button_setup = self._add_button('Setup', self.pane2, self._setup_callback)
self.button_motors = self._add_button('Motors', self.pane2, self._motors_button_callback)
self.button_receiver = self._add_button('Receiver', self.pane2, self._receiver_button_callback)
self.button_messages = self._add_button('Messages', self.pane2, self._messages_button_callback)
#self.button_maps = self._add_button('Maps', self.pane2, self._maps_button_callback, disabled=False)
# Prepare for adding ports as they are detected by our timer task
self.portsvar = StringVar(self.root)
self.portsmenu = None
self.connected = False
self.ports = []
# Finalize Tk stuff
self.frame.pack()
self.canvas = Canvas(self.root, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, background='black')
self.canvas.pack()
# Add widgets for motor-testing dialog; hide them immediately
self.motors = Motors(self)
self.motors.stop()
# Create receiver dialog
self.receiver = Receiver(self)
# Create messages dialog
self.messages = Messages(self)
# Create setup dialog
self.setup = Setup(self)
self._schedule_connection_task()
# Create a maps dialog
#self.maps = Maps(self, yoffset=-30)
# Create a splash image
self.splashimage = PhotoImage(file='media/splash.png')
self._show_splash()
# Create a message parser
self.parser = MSP_Parser()
# Set up parser's request strings
self.attitude_request = self.parser.serialize_ATTITUDE_Request()
self.rc_request = self.parser.serialize_RC_Request()
# No messages yet
self.yaw_pitch_roll = 0,0,0
self.rxchannels = 0,0,0,0,0
# A hack to support display in Setup dialog
self.active_axis = 0
def quit(self):
self.motors.stop()
self.root.destroy()
def hide(self, widget):
widget.place(x=-9999)
def getChannels(self):
return self.rxchannels
def getYawPitchRoll(self):
# configure button to show connected
self._enable_buttons()
#.........這裏部分代碼省略.........
示例2: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import stop [as 別名]
receiver = Receiver()
transmitter = Transmitter()
receiver.connect()
td1 = threading.Thread(target=handler.run)
td2 = threading.Thread(target=receiver.run)
td3 = threading.Thread(target=transmitter.run)
td1.start()
td2.start()
td3.start()
# main loop
while True:
if handler.is_runing() and receiver.is_runing() and transmitter.is_runing():
msg = receiver.fetch()
while msg != None:
handler.push(msg)
msg = receiver.fetch()
msg = handler.fetch_to_send()
while msg != None:
transmitter.push(msg)
msg = handler.fetch_to_send()
else:
break
handler.stop()
receiver.stop()
transmitter.stop()
td1.join()
td2.join()
td3.join()