当前位置: 首页>>代码示例>>Python>>正文


Python Plot.start方法代码示例

本文整理汇总了Python中plot.Plot.start方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.start方法的具体用法?Python Plot.start怎么用?Python Plot.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plot.Plot的用法示例。


在下文中一共展示了Plot.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: mainWindow

# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import start [as 别名]
class mainWindow(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        setVerbosity("debug")

        #Button actions
        self.ui.pushButton_en_server.clicked.connect(self.pushButton_serverEnable_onClicked)
        self.ui.pushButton_en_client.clicked.connect(self.pushButton_clientEnable_onClicked)
        self.ui.pushButton_chart_orientation.clicked.connect(self.pushButton_chartOrientation_onClicked)
        self.ui.pushButton_3d_model.clicked.connect(self.pushButton_3D_Model_onClicked)
        self.ui.pushButton_angle_set.clicked.connect(self.pushButton_angleSetPID_onClicked)
        self.ui.pushButton_speed_set.clicked.connect(self.pushButton_speedSetPID_onClicked)
        self.ui.pushButton_angle_zero.clicked.connect(self.pushButton_angleZeroPID_onClicked)
        self.ui.pushButton_speed_zero.clicked.connect(self.pushButton_speedZeroPID_onClicked)
        self.ui.pushButton_control_set.clicked.connect(self.pushButton_controlSet_onClicked)

        #Initial value
        self.ui.doubleSpinBox_angle_kp.setValue(ANGLE_KP_CONS)
        self.ui.doubleSpinBox_angle_ki.setValue(ANGLE_KI_CONS)
        self.ui.doubleSpinBox_angle_kd.setValue(ANGLE_KD_CONS)
        self.ui.doubleSpinBox_angle_kp_Aggr.setValue(ANGLE_KP_AGGR)
        self.ui.doubleSpinBox_angle_ki_Aggr.setValue(ANGLE_KI_AGGR)
        self.ui.doubleSpinBox_angle_kd_Aggr.setValue(ANGLE_KD_AGGR)
        self.ui.doubleSpinBox_angle_setpoint.setValue(CALIBRATED_ZERO_ANGLE)
        self.ui.doubleSpinBox_angle_max.setValue(ANGLE_LIMIT)
        self.ui.doubleSpinBox_speed_kp.setValue(SPEED_KP)
        self.ui.doubleSpinBox_speed_ki.setValue(SPEED_KI)
        self.ui.doubleSpinBox_speed_kd.setValue(SPEED_KD)

        self.serverUDPQueue = queue.Queue(4)
        self.threads = []
        self.worker = None
        self.clientUDP = None
        self.serverUDP = None

    def pushButton_serverEnable_onClicked(self):
        #Create and start UDP server thread
        port = int(self.ui.lineEdit_port_server.text())

        if self.serverUDP != None and self.worker != None:
            self.worker.terminate()
            self.serverUDP.join(timeout=1)

        self.worker = Worker(self)
        self.serverUDP = UDP_ServerThread(name=SERVER_UDP_NAME, queue=self.serverUDPQueue, UDP_PORT=port)
        self.serverUDP.daemon = True
        self.threads.append(self.serverUDP)

        self.serverUDP.start()
        self.worker.start()

    def pushButton_clientEnable_onClicked(self):
        #Create and start UDP client thread
        ip = self.ui.lineEdit_ip_client.text()
        port = int(self.ui.lineEdit_port_client.text())

        if self.clientUDP != None:
            self.clientUDP.join(timeout=1)

        self.clientUDP = UDP_ClientThread(name=CLIENT_UDP_NAME, UDP_IP=ip, UDP_PORT=port)
        self.clientUDP.daemon = True
        self.threads.append(self.clientUDP)
        self.clientUDP.start()

    def pushButton_chartOrientation_onClicked(self):
        self.plot = Plot(self)
        self.plot.start()

    def pushButton_3D_Model_onClicked(self):
        self.triModel = TriModel(self)
        self.triModel.start()

    def pushButton_angleSetPID_onClicked(self):
        angleKpCons = self.ui.doubleSpinBox_angle_kp.value()
        angleKiCons = self.ui.doubleSpinBox_angle_ki.value()
        angleKdCons = self.ui.doubleSpinBox_angle_kd.value()

        angleKpAggr = self.ui.doubleSpinBox_angle_kp_Aggr.value()
        angleKiAggr = self.ui.doubleSpinBox_angle_ki_Aggr.value()
        angleKdAggr = self.ui.doubleSpinBox_angle_kd_Aggr.value()

        angleSetpoint = self.ui.doubleSpinBox_angle_setpoint.value()
        angleMax = self.ui.doubleSpinBox_angle_max.value()

        #(module),(data1)(data2),(data3)(...)(#)
        msg = CMD_PID_ANGLE + "," + \
              str(angleKpCons) + "," + \
              str(angleKiCons) + "," + \
              str(angleKdCons) + "," + \
              str(angleKpAggr) + "," + \
              str(angleKiAggr) + "," + \
              str(angleKdAggr) + "," + \
              str(angleSetpoint) + "," + \
              str(angleMax) + "#"

        # Sending UDP packets...
        if (self.clientUDP != None):
#.........这里部分代码省略.........
开发者ID:gchinellato,项目名称:Self-Balance-Robot,代码行数:103,代码来源:UI.py

示例2: Capp

# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import start [as 别名]
class Capp(threading.Thread):

  ##
  # Constructor
  # 
  # Parameters
  # master = root Tk object
  # robot = robot object
  #
  # Initiates the visible frame
  def __init__(self, master, robot):

    self.robot=robot # Save robot-object

    threading.Thread.__init__(self)

    self.frame = Frame(master, width=400, height=400) # Initiate main frame
    self.frame.grid()
    master.title("Plogen")

    self.bRight = Button(self.frame, text="Right")  # Initiate "Right" button
    self.bRight.grid(column=2, row=1) 		# Where
    self.bRight.bind("<Button-1>", self.right)	# Set event-handler for left mouse-button down
    self.bRight.bind("<ButtonRelease-1>", self.up)	# Set event-handler for left mouse-button up

    self.bLeft = Button(self.frame, text="Left") 	# Again with "Left"
    self.bLeft.grid(column=0, row=1)
    self.bLeft.bind("<Button-1>", self.left)
    self.bLeft.bind("<ButtonRelease-1>", self.up)

    self.bForward = Button(self.frame, text="Forward") # ...
    self.bForward.grid(column=1, row=0)
    self.bForward.bind("<Button-1>", self.forward)
    self.bForward.bind("<ButtonRelease-1>", self.up)

    self.bBackward = Button(self.frame, text="Backward") # ...
    self.bBackward.grid(column=1, row=1)
    self.bBackward.bind("<Button-1>", self.backward)
    self.bBackward.bind("<ButtonRelease-1>", self.up)

    self.bLock = Button(self.frame, text="Start Auto", command=self.setAuto)
    self.bLock.grid(column=4, row=0)

    self.bPlot = Button(self.frame, text="Start Reg Plot", command=self.startPlot)
    self.bPlot.grid(column=4, row=1)

    self.bOpen = Button(self.frame, text="Öppna", command=self.gripOpen)
    self.bOpen.grid(column=3, row=0)

    self.bClose = Button(self.frame, text="Stäng", command=self.gripClose)
    self.bClose.grid(column=3, row=1)

    self.input = StringVar()      # Text-field used to read input from user
    self.input.set("")
    self.eInput = Entry(self.frame, textvariable = self.input, bg="white")
    self.eInput.grid(column=1, row=7, columnspan=2, pady=10)

    self.sensordata = ThreadSafeLabel(self.frame, self.robot)			# Our custom label which should update itself
    self.sensordata.grid(column=0, columnspan=3, row=2, rowspan=4)


    self.lRegulator = Label(self.frame, text = "Regulator:")
    self.lRegulator.grid(column=0, row=8, pady=0, padx=0)

    self.lRegP = Label(self.frame, text = "P:")
    self.lRegP.grid(column=0, row=9, pady=0, padx=0)

    self.sRegP = StringVar()
    self.sRegP.set("2")
    self.eRegP = Entry(self.frame, textvariable=self.sRegP, bg="white")
    self.eRegP.grid(column=1, row=9, pady=0, padx=0)

    self.lRegD = Label(self.frame, text = "D:")
    self.lRegD.grid(column=0, row=10, pady=0, padx=0)

    self.sRegD = StringVar()
    self.sRegD.set("14")
    self.eRegD = Entry(self.frame, textvariable=self.sRegD, bg="white")
    self.eRegD.grid(column=1, row=10, pady=0, padx=0)

    self.lSpeed = Label(self.frame, text = "Speed:")
    self.lSpeed.grid(column=2, row=9, pady=0, padx=0)

    self.sSpeed = StringVar()
    self.sSpeed.set("250")
    self.eSpeed = Entry(self.frame, textvariable=self.sSpeed, bg="white")
    self.eSpeed.grid(column=3, row=9, pady=0, padx=0)

    self.lTimer = Label(self.frame, text = "Crossing Timer:")
    self.lTimer.grid(column=2, row=10, pady=0, padx=0)

    self.sTimer = StringVar()
    self.sTimer.set("3")
    self.eTimer = Entry(self.frame, textvariable=self.sTimer, bg="white")
    self.eTimer.grid(column=3, row=10, pady=0, padx=0)

    self.bSendRegParams = Button(self.frame, text="Send", command=self.sendRegParams)
    self.bSendRegParams.grid(column=2, row=14, pady=0, padx=0)

  def up(self, event):		# Some of event handlers.  
#.........这里部分代码省略.........
开发者ID:aelg,项目名称:plogen,代码行数:103,代码来源:app.py


注:本文中的plot.Plot.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。