Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.vscode
planning/Config.py

*.pyc
__pycache__
Binary file removed __pycache__/alpha.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/pathfinding.cpython-35.pyc
Binary file not shown.
Binary file removed __pycache__/video.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/WallDetector.pyc
Binary file not shown.
Binary file removed analysis/__init__.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/Camera.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/PathDetector.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/RobotDetector.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/TargetDetector.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/WallDetector.cpython-35.pyc
Binary file not shown.
Binary file removed analysis/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions planning/Config.example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Config:
BASE_URL = "http://18.219.63.23"
21 changes: 11 additions & 10 deletions planning/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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):
Expand Down Expand Up @@ -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]
Expand All @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions planning/Tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
Binary file removed planning/__pycache__/Controller.cpython-35.pyc
Binary file not shown.
Binary file removed planning/__pycache__/Planner.cpython-35.pyc
Binary file not shown.
Binary file removed planning/__pycache__/Tracker.cpython-35.pyc
Binary file not shown.
Binary file removed planning/__pycache__/__init__.cpython-35.pyc
Binary file not shown.