示例#1
0
def delay_pwmchan():
    global xpfloat, ypfloat, alarm_flag, target_id
    for delay_times in range(0, 4):
        if (alarm_flag == -1):
            pwm.pwm_chan(xpfloat, ypfloat)
            time.sleep(0.5)
        else:
            break
    if (alarm_flag == -1):
        alarm_flag = joint(target_id, 4)
        print('alarm_flag', alarm_flag)
        threading.Thread(target=TCPClient).start()
    else:
        pass
示例#2
0
def delay_pwmchan():
    global xpfloat, ypfloat, alarm_flag, target_id
    for delay_times in range(0, 4):
        if (alarm_flag == -1):
            print('人体x坐标为', xpfloat)  # AX = convert(targets[num3][20:24])
            print('人体y坐标为', ypfloat)  # VX = convert(targets[num3][12:16])
            pwm.pwm_chan(xpfloat, ypfloat)
            time.sleep(0.5)
        else:
            break
    if (alarm_flag == -1):
        alarm_flag = joint(target_id, 4)
        print('alarm_flag', alarm_flag)
        #time.sleep(0.5)
        threading.Thread(target=TCPClient).start()
示例#3
0
             target_id = []
             target_id = targets[num2][0:4]
             #print('target_id is')
             #print(target_id)
             alarm_flag = joint(target_id, 4)
             #print(alarm_flag)
             xy = targets[num2][4:12]
             xp = targets[num2][4:8]
             yp = targets[num2][8:12]
             xpfloat = convert(xp)
             #print(xp)
             print('人体x坐标为', xpfloat)
             ypfloat = convert(yp)
             #print(yp)
             print('人体y坐标为', ypfloat)
             pwm.pwm_chan(xpfloat, ypfloat)
             #TCPPoint()
             #tcpServPoint = threading.Thread(target=TCPPoint, args=(sockPoint,))
             #tcpServPonit.start()
             threading.Thread(target=TCPClient).start()
             break  #判断到第一个物体异常物体结束循环
 else:  #有异常物体
     #if numtargets == 0:
     #    alarm_flag = -1
     #else :
     # for num3 in range(0,numtargets):  #获取报警target最新位置
     # #print ('numtargets')
     # #print (numtargets)
     # if targets[num3][0:4] == target_id:
     # xp = targets[num3][4:8]
     # yp = targets[num3][8:12]