Skip to content

Commit ddc6121

Browse files
committed
Added configuration file
1 parent f1797cf commit ddc6121

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

drive_server.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import wheels
66
import speaker
77
import autonomous
8+
import os
89

910
app = Flask(__name__)
1011

@@ -78,6 +79,8 @@ def drive():
7879

7980

8081
autonomous.autodrive(time)
82+
83+
return ''
8184

8285
@app.route('/say')
8386
def say():
@@ -96,10 +99,12 @@ def data():
9699
f = open(filename, 'r')
97100
data = f.read()
98101
return data
99-
102+
100103
@app.route('/img_rec')
101104
def img_rec():
102-
os.system('python image.py')
105+
wheels.stop()
106+
# os.system('python image.py')
107+
return ''
103108

104109
def gen(camera):
105110
"""Video streaming generator function."""

sonar.py

+19-12
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import atexit
55
import sys
66
from subprocess import call
7+
import configure
78

8-
if (os.path.exists("configure.sh")):
9-
print "Loading configuation file"
10-
call(["bash", "configure.sh"])
119

1210
def setup():
1311
for i in range(3):
@@ -17,16 +15,25 @@ def setup():
1715

1816
print "Waiting For Sensor To Settle"
1917

20-
if ('LTRIG' in os.environ):
21-
TRIG = [int(os.environ['LTRIG']),
22-
int(os.environ['CTRIG']),
23-
int(os.environ['RTRIG'])]
24-
ECHO = [int(os.environ['LECHO']),
25-
int(os.environ['CECHO']),
26-
int(os.environ['RECHO'])]
18+
#if ('LTRIG' in os.environ):
19+
# TRIG = [int(os.environ['LTRIG']),
20+
# int(os.environ['CTRIG']),
21+
# int(os.environ['RTRIG'])]
22+
# ECHO = [int(os.environ['LECHO']),
23+
# int(os.environ['CECHO']),
24+
# int(os.environ['RECHO'])]
2725

28-
GPIO.setmode(GPIO.BCM)
29-
setup()
26+
27+
if ('LTRIG' in configure.data):
28+
TRIG = [int(configure.data['LTRIG']),
29+
int(configure.data['CTRIG']),
30+
int(configure.data['RTRIG'])]
31+
ECHO = [int(configure.data['LECHO']),
32+
int(configure.data['CECHO']),
33+
int(configure.data['RECHO'])]
34+
35+
GPIO.setmode(GPIO.BCM)
36+
setup()
3037

3138
def turnOffGPIO():
3239
GPIO.cleanup()

0 commit comments

Comments
 (0)