Skip to content
Snippets Groups Projects
Commit bc745e29 authored by 최정민's avatar 최정민
Browse files

navigating mode complete

parent f4fc27f2
No related branches found
No related tags found
No related merge requests found
......@@ -5,24 +5,28 @@ from numberToSpeech import NumberToSpeech
import numpy as np
import time
from fileParse import FileParse
import math
import statistics
duration = 0.1
sleepDuration = 0.1
speechDuration = 2.0
volume = 0.75
fs = 44100
duration = 0.1 # duration of the sine wave
sleepDuration = 0.1 # duration of waiting for sine wave to play
speechDuration = 2.0 # duration of waiting for the speech to end
volume = 0.75 #volume
fs = 44100 #DONT CHANGE
flc = MaxMinConverter(10,300,220,880)
fdc = derivativeConverter(2,200,110,220,440,880)
tts = NumberToSpeech()
player = pyaudioPlayer(fs)
sg = sineGenerator(fs)
fp = FileParse("./test")
fpDistance = FileParse("./distanceData") #place folder path here
fpAngle = FileParse("./angleData") #place folder path here
player.play()
meanRadian = 0
if(fp.fileCount()>0):
if(fpDistance.fileCount()>0):
try:
datas = fp.read()
datas = fpDistance.read()
for data in datas:
print(data)
distance = int(data[1])
......@@ -40,6 +44,16 @@ if(fp.fileCount()>0):
tts.say(distance)
time.sleep(speechDuration)
if mode == '3':
print("not made")
distance2 = int(data[2])
print(fpAngle.fileCount())
if fpAngle.fileCount()>0:
angleDatas = [angle for angle in fpAngle.read() if angle[1]=='4']
meanRadian = math.radians(statistics.mean([float(a) for a in angleDatas[5]]))
height = distance*math.cos(meanRadian) + distance2*math.sin(meanRadian)
width = distance2*math.cos(meanRadian)
print("Height: ", height, " Width: ", width)
except KeyboardInterrupt: # Ctrl+C
del player
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
2,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,100,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
0,200,0
2,100,0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment