diff --git a/.gitignore b/.gitignore index 722d5e7..fcedc30 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ .vscode +planning/Config.py + +*.pyc +__pycache__ diff --git a/__pycache__/alpha.cpython-35.pyc b/__pycache__/alpha.cpython-35.pyc deleted file mode 100644 index e5fa2d4..0000000 Binary files a/__pycache__/alpha.cpython-35.pyc and /dev/null differ diff --git a/__pycache__/pathfinding.cpython-35.pyc b/__pycache__/pathfinding.cpython-35.pyc deleted file mode 100644 index 4f5e12a..0000000 Binary files a/__pycache__/pathfinding.cpython-35.pyc and /dev/null differ diff --git a/__pycache__/video.cpython-35.pyc b/__pycache__/video.cpython-35.pyc deleted file mode 100644 index 1f31460..0000000 Binary files a/__pycache__/video.cpython-35.pyc and /dev/null differ diff --git a/analysis/WallDetector.pyc b/analysis/WallDetector.pyc deleted file mode 100644 index 61f2ed3..0000000 Binary files a/analysis/WallDetector.pyc and /dev/null differ diff --git a/analysis/__init__.pyc b/analysis/__init__.pyc deleted file mode 100644 index 22c1556..0000000 Binary files a/analysis/__init__.pyc and /dev/null differ diff --git a/analysis/__pycache__/Camera.cpython-35.pyc b/analysis/__pycache__/Camera.cpython-35.pyc deleted file mode 100644 index e827624..0000000 Binary files a/analysis/__pycache__/Camera.cpython-35.pyc and /dev/null differ diff --git a/analysis/__pycache__/PathDetector.cpython-35.pyc b/analysis/__pycache__/PathDetector.cpython-35.pyc deleted file mode 100644 index 1b38622..0000000 Binary files a/analysis/__pycache__/PathDetector.cpython-35.pyc and /dev/null differ diff --git a/analysis/__pycache__/RobotDetector.cpython-35.pyc b/analysis/__pycache__/RobotDetector.cpython-35.pyc deleted file mode 100644 index 5592777..0000000 Binary files a/analysis/__pycache__/RobotDetector.cpython-35.pyc and /dev/null differ diff --git a/analysis/__pycache__/TargetDetector.cpython-35.pyc b/analysis/__pycache__/TargetDetector.cpython-35.pyc deleted file mode 100644 index e296164..0000000 Binary files a/analysis/__pycache__/TargetDetector.cpython-35.pyc and /dev/null differ diff --git a/analysis/__pycache__/WallDetector.cpython-35.pyc b/analysis/__pycache__/WallDetector.cpython-35.pyc deleted file mode 100644 index 2edb6fa..0000000 Binary files a/analysis/__pycache__/WallDetector.cpython-35.pyc and /dev/null differ diff --git a/analysis/__pycache__/__init__.cpython-35.pyc b/analysis/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index e2a958b..0000000 Binary files a/analysis/__pycache__/__init__.cpython-35.pyc and /dev/null differ diff --git a/planning/Config.example.py b/planning/Config.example.py new file mode 100644 index 0000000..6d02e75 --- /dev/null +++ b/planning/Config.example.py @@ -0,0 +1,2 @@ +class Config: + BASE_URL = "http://18.219.63.23" diff --git a/planning/Controller.py b/planning/Controller.py index 975e71e..5ae54ca 100644 --- a/planning/Controller.py +++ b/planning/Controller.py @@ -5,10 +5,11 @@ import json import math from math import sqrt +from Config import Config -base = 'http://18.219.63.23/edge' - -post = 'http://18.219.63.23/post' +conf = Config +base = conf.BASE_URL + '/edge' +post = conf.BASE_URL + '/post' class Controller: @@ -34,18 +35,18 @@ def run(self): def deliver(self, delivery): id = delivery['id'] data = {'state': 'IN_PROGRESS'} - r = requests.patch("http://18.219.63.23/development/delivery/" + str(id), json=data) + r = requests.patch(conf.BASE_URL + "/development/delivery/" + str(id), json=data) self.toTarget(delivery['from']['name'].lower()) data = {'state': 'AWAITING_PICKUP'} - r = requests.patch("http://18.219.63.23/development/delivery/" + str(id), json=data) + r = requests.patch(conf.BASE_URL + "/development/delivery/" + str(id), json=data) data = {'state': 'IN_PROGRESS'} - r = requests.patch("http://18.219.63.23/development/delivery/" + str(id), json=data) + r = requests.patch(conf.BASE_URL + "/development/delivery/" + str(id), json=data) self.toTarget(delivery['to']['name'].lower()) data = {'state': 'COMPLETED'} - r = requests.patch("http://18.219.63.23/development/delivery/" + str(id), json=data) + r = requests.patch(conf.BASE_URL + "/development/delivery/" + str(id), json=data) - r = requests.delete('http://18.219.63.23/development/delivery/' + str(id)) + r = requests.delete(conf.BASE_URL + '/development/delivery/' + str(id)) def toTarget(self, name): @@ -125,7 +126,7 @@ def drawPath(self,frame): return frame def getDelivery(self): - url = "http://18.219.63.23/development/deliveries" + url = conf.BASE_URL + "/development/deliveries" r = requests.get(url) queue = json.loads(r.text) return queue[0] @@ -136,7 +137,7 @@ def sendInstructions(self): self.plan = self.toTarget(fro) #self.plan = self.planner.plan('YELLOW') instructions = self.pointConversion(self.plan) - url = "http://ec2-18-219-63-23.us-east-2.compute.amazonaws.com/edge/instructions" + url = conf.BASE_URL + "/edge/instructions" r = requests.post(url, json = instructions) print(r.text) diff --git a/planning/Tracker.py b/planning/Tracker.py index 017f6a2..5cef5fe 100644 --- a/planning/Tracker.py +++ b/planning/Tracker.py @@ -2,7 +2,9 @@ import numpy as np import requests import math +from Config import Config +conf = Config class Tracker: def __init__(self, rd): self.robotDetector = rd @@ -85,17 +87,17 @@ def checkOrientation(self,frame): def go(self,correction): print("correction",correction) - post = 'http://18.219.63.23/flaskapp/post?onOff=1&turnAngle=0.0&correction='+str(correction) + post = conf.BASE_URL + '/flaskapp/post?onOff=1&turnAngle=0.0&correction='+str(correction) r = requests.get(post) #print("go",r.text) def stop(self): - post = 'http://18.219.63.23/flaskapp/post?onOff=0&turnAngle=0.0&correction=0' + post = conf.BASE_URL + '/flaskapp/post?onOff=0&turnAngle=0.0&correction=0' r = requests.get(post) #print("stop",r.text) def turn(self, d): - post = 'http://18.219.63.23/flaskapp/post?onOff=1&turnAngle='+str(d)+'&correction=0' + post = conf.BASE_URL + '/flaskapp/post?onOff=1&turnAngle='+str(d)+'&correction=0' r = requests.get(post) #print("turn",r.text) diff --git a/planning/__pycache__/Controller.cpython-35.pyc b/planning/__pycache__/Controller.cpython-35.pyc deleted file mode 100644 index 3f911b9..0000000 Binary files a/planning/__pycache__/Controller.cpython-35.pyc and /dev/null differ diff --git a/planning/__pycache__/Planner.cpython-35.pyc b/planning/__pycache__/Planner.cpython-35.pyc deleted file mode 100644 index 0106903..0000000 Binary files a/planning/__pycache__/Planner.cpython-35.pyc and /dev/null differ diff --git a/planning/__pycache__/Tracker.cpython-35.pyc b/planning/__pycache__/Tracker.cpython-35.pyc deleted file mode 100644 index 9570eb4..0000000 Binary files a/planning/__pycache__/Tracker.cpython-35.pyc and /dev/null differ diff --git a/planning/__pycache__/__init__.cpython-35.pyc b/planning/__pycache__/__init__.cpython-35.pyc deleted file mode 100644 index f92b03e..0000000 Binary files a/planning/__pycache__/__init__.cpython-35.pyc and /dev/null differ