Beispiel #1
0
    def find_bluetooth_adapter(self, tty_port=None):
        if tty_port is None:
            tty_port = self.find_tty()
        if tty_port is None:
            raise ValueError('# Bluetooth adaptoru bulunamadi!\n#')

        self.ble = BLE(tty_port)
Beispiel #2
0
    def find_bluetooth_adapter(self, tty_port=None):
        if tty_port is None:
            tty_port = self.find_tty()
        if tty_port is None:
            raise ValueError('Bluetooth adapter not found!')

        self.ble = BLE(tty_port)
Beispiel #3
0
def run():
    import signal

    QtCore.QCoreApplication.setOrganizationName("productize")
    QtCore.QCoreApplication.setOrganizationDomain("productize.be")
    QtCore.QCoreApplication.setApplicationName("BTLE tool")
    app = QtGui.QApplication(["BTLE tool"])

    signal.signal(signal.SIGINT, signal.SIG_DFL)

    baud_rate = 115200
    ble = BLE(baud_rate)
    ble.start()
    ct = ActivityThread(ble)
    ble.scan_response.connect(lambda x: print_scan_response(ble, x))
    ct.start()
    return app.exec_()
Beispiel #4
0
    def __init__(self, app):
        super(MyWindow, self).__init__()
        self.setupUi(self)      #初始化GUI

        self.loop = quamash.QEventLoop(app)             # BLE协程循环
        self.ble = BLE(self)                            # 实例化BLE

        self.emit_thread = EmitThread(self)             # 实例化Emit对象
        self.emit_thread.signal.connect(self.image)     # 实时成像发射信号与槽函数连接

        self.save_thread = saveThread(self)             # 实例化save对象(连续测量10组实时数据)

        self.signal_slot()                              # 菜单栏的槽函数设置

        self.alg = 'svd'        # 默认调用灵敏度矩阵法
        self.disp = 'interp'    # 默认使用矩阵插值方式显示图像
        self.refedata = np.zeros(28)    # 空场参考值
        self.projdata = np.zeros(28)    # 历史测量值
        self.proj_d = np.zeros(28)      # 边界值差分(测量值-空场值)
        self.elem_data = np.zeros(576)  # 图像重建数值
        self.statusBar().showMessage('Ready')

        # 实例化MyFigure
        self.F = MyFigure(width=16, height=9, dpi=100)

        # ax1初始显示0
        self.cache1 = self.F.ax1.bar(range(28), np.zeros(28), color='deepskyblue')

        # 鼠标移动显示当前位置的图像重建数值大小
        plt.gcf().canvas.mpl_connect('motion_notify_event', self.motion_notify)

        # ax3初始显示为灰色
        self.cache3 = []
        for i in np.arange(8):
            for j in np.arange(i + 1, 8):
                cache, = self.F.ax3.plot([self.F.theta[i], self.F.theta[j]], [1, 1], color='dimgray')
                self.cache3.append(cache)

        plt.tight_layout()
        plt.ion()       #进入交互成像模式
        self.gridLayout.addWidget(self.F, 0, 1)     #将画布置于GUI界面中
Beispiel #5
0
env = Environment((grid_min_coord_x, grid_min_coord_y), (grid_max_coord_x,grid_max_coord_y), (agent_coord_x,agent_coord_y), (goal_coord_x,goal_coord_y))

flag = input("do you want to enter any obstacles (Y/N)? ")

while flag == "Y":
	
	bottom_left_coord_x = int(input("\t enter bottom left x coordinate: "))
	bottom_left_coord_y = int(input("\t enter bottom left y coordinate: "))
	top_right_coord_x = int(input("\t enter top right x coordinate: "))
	top_right_coord_y = int(input("\t enter top right y coordinate: "))
	
	env.add_obstacle((bottom_left_coord_x,bottom_left_coord_y), (top_right_coord_x,top_right_coord_y))

	flag = input("do you want to enter more obstacles (Y/N)? ")

agent = Agent()

ble1 = BLE(4, -73, (0,0))
ble2 = BLE(4, -73, (100,0))
ble3 = BLE(4, -73, (50,50))

wp = WaypointPlanner(env, agent)
plan = wp.plan()

print(plan)

wp.visualise(plan)