Пример #1
0
def setup():
	pi.set_mode(22,pigpio.OUTPUT)
	pi.write(22,0)
	pi.write(17,0)
	time.sleep(1)
	BMX055.bmx055_setup()
	GPS.openGPS()
Пример #2
0
def setup():
	global phaseChk
	pi.write(22,1)
	pi.write(24,0)
	BME280.bme280_setup()
	BME280.bme280_calib_param()
	BMX055.bmx055_setup()
	TSL2561.tsl2561_setup()
	GPS.openGPS()

	with open(phaseLog, 'a') as f:
		pass
Пример #3
0
def setup():
    global phaseChk
    pi.set_mode(17, pigpio.OUTPUT)
    pi.set_mode(22, pigpio.OUTPUT)
    pi.write(22, 1)
    pi.write(17, 0)
    time.sleep(1)
    BME280.bme280_setup()
    BME280.bme280_calib_param()
    BMX055.bmx055_setup()
    GPS.openGPS()

    with open(phaseLog, 'a') as f:
        pass

    phaseChk = int(Other.phaseCheck(phaseLog))
def stuck_confirm():
    BMX055.bmx055_setup()
    get_accdata()
    accdata = np.array([[accx, accy, accz]])
    global cond
    #--- use Timer ---#
    cond = True
    thread = Thread(target=timer, args=([3]))
    thread.start()
    #--- note start time ---#
    start = time.time()
    time_base = start
    global time_array
    time_array = np.array([[0]])
    try:
        while cond:
            #--- escape by run faster ---#
            run = pwm_control.Run()
            run.straight_h()
            time_count = time.time() - time_base
            if time_count >= 0.2:
                get_accdata()
                #--- multi dimention accdata matrix ---#
                accdata = np.append(accdata, np.array([[accx, accy, accz]]))
                #--- multi dimention time_array matrix ---#
                passed_time = time.time() - start
                time_array = np.append(time_array, np.array([[passed_time]]))
                #--- initialize time_base ---#
                time_base = time.time()

    except KeyboardInterrupt:
        run = pwm_control.Run()
        run.stop()

    finally:
        run = pwm_control.Run()
        run.stop()

    global accx_data
    accx_data = accdata[:, 0]

    #--- escape detection ---#
    move_judge = cor(accx_data, time_array)
    print(move_judge)
    return move_judge
Пример #5
0
def setup():
    global phaseChk
    pi.set_mode(17, pigpio.OUTPUT)
    pi.set_mode(22, pigpio.OUTPUT)
    pi.write(22, 1)  #IM920	Turn On
    pi.write(17, 0)  #Outcasing Turn Off
    time.sleep(1)
    BME280.bme280_setup()
    BME280.bme280_calib_param()
    BMX055.bmx055_setup()
    GPS.openGPS()

    with open(phaseLog, 'a') as f:
        pass

    #if it is End to End Test, then
    phaseChk = int(Other.phaseCheck(phaseLog))
    #if it is debug
    phaseChk = 8
Пример #6
0
def setup():
	global phaseChk
	global startPosStatus
	pi.set_mode(17,pigpio.OUTPUT)
	pi.set_mode(22,pigpio.OUTPUT)
	pi.write(22,1)					#IM920	Turn On
	IM920.Strt("2")					#distance mode
	pi.write(17,0)					#Outcasing Turn Off
	time.sleep(1)
	BME280.bme280_setup()
	BME280.bme280_calib_param()
	BMX055.bmx055_setup()
	TSL2561.tsl2561_setup()
	GPS.openGPS()

	with open(phaseLog, 'a') as f:
		pass

	#if it is End to End Test, then
	try:
		phaseChk = int(Other.phaseCheck(phaseLog))
	except:
		phaseChk = 0
	#if it is debug
	#phaseChk = 8

	if phaseChk == 0:
		Other.saveLog(positionLog, "Goal", gLat, gLon, "\t")
		startPosStatus = 1
	else:
		Other.saveLog(positionLog, "\t")
		if(Other.positionCheck(positionLog) == [0.0, 0.0]):
			print("Not Logged Start Position")
			startPosStatus = 1
		else:
			rsLat, rsLon = Other.positionCheck(positionLog)
			print(rsLat, rsLon)
			startPosStatus = 0
Пример #7
0
#--- default module ---#
#import difflib
import time
import traceback
from threading import Thread

GPS_data = [0.0,0.0,0.0,0.0,0.0]

def timer(t):
	global cond
	time.sleep(t)
	cond = False

if __name__ == "__main__":
	BMX055.bmx055_setup()
	GPS.openGPS()
	print('Run Phase Start!')
	#--- difine goal latitude and longitude ---#
	lon2 = 139.9060815
	lat2 = 35.9143235
	#------------- program start -------------#
	direction = Calibration.calculate_direction(lon2,lat2)
	goal_distance = direction["distance"]
	print('goal distance = '+str(goal_distance))
	#------------- GPS navigate -------------#
	while goal_distance >= 15:
		#------------- Calibration -------------#
		print('Calibration Start')
		#--- calculate offset ---#
		magdata = Calibration.magdata_matrix()