Advertisement
hfreni

GetJSON.py

May 13th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import json
  2. import urllib2
  3. import math
  4.  
  5. METRES_PER_INCH = 0.0254
  6. LAUNCH_ANGLE = 44
  7. LAUNCH_HEIGHT = 12
  8. FIELD_SIZE = 140.5
  9. GOAL_X = 4.0941
  10. GOAL_Y = 139.9059
  11.  
  12.  
  13. for y in range(0, 144):
  14.     x = 140.5 - y
  15.     data = json.load(urllib2.urlopen('http://vex.us.nallen.me/exec/extras/nbn_shooting?x=' + str(x*METRES_PER_INCH) + '&y=' + str(y*METRES_PER_INCH) + '&z='+ str(LAUNCH_HEIGHT * METRES_PER_INCH) +'&angle='+ str(LAUNCH_ANGLE)))
  16.     print json.dumps(data, sort_keys=True,indent=4, separators=(',', ': '))
  17.  
  18.     r = math.sqrt(math.pow(GOAL_X - x, 2) + math.pow(GOAL_Y - y, 2))
  19.     print 'Currently At XPos: ' + str(x) + ' and YPos: '+str(y) + ' and Length: ' + str(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement