Advertisement
hfreni

GeneratorV2.py

May 15th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. import json
  2. import urllib2
  3. import math
  4.  
  5. METRES_PER_INCH = 0.0254
  6. LAUNCH_ANGLE = input('Enter the Launch Angle in Degrees: ')
  7. LAUNCH_HEIGHT = input('Enter your Launch Height in Inches: ')
  8. INCREMENT = input('Enter a Distance Increment in Inches: ')
  9. FIELD_SIZE = 140.5
  10. GOAL_X = 4.0941
  11. GOAL_Y = 139.9059
  12.  
  13. i = 0
  14. l = ''
  15.  
  16. for length in xrange(0, 195, INCREMENT):
  17.     y = length + GOAL_Y
  18.     data = json.load(urllib2.urlopen('http://vex.us.nallen.me/exec/extras/nbn_shooting?x=' + str(GOAL_X*METRES_PER_INCH) + '&y=' + str(y*METRES_PER_INCH) + '&z='+ str(LAUNCH_HEIGHT * METRES_PER_INCH) +'&angle='+ str(LAUNCH_ANGLE)))
  19.     basic = '{' + str(round(data['incident'],2)) + ',' + str(round(data['speed'],2)) + ',' + str(length) + '}'
  20.  
  21.     if data['speed'] == -1:
  22.         i = i+1
  23.     else:
  24.         l = l + basic + ',\n'
  25.  
  26. print 'float fiedlPOSLaunch[' + str(round(195/INCREMENT) - i) + '] [3] = {'
  27. print l[:-2]
  28. print '};'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement