forked from shihchengyen/auto_nav
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemp.py
103 lines (87 loc) · 8.3 KB
/
temp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
istr = str(raw_input('Keys:'))
if istr.isnumeric()
display('this')
else:
display('that')
def isnumber(value):
try:
val = int(value)
return True
except ValueError:
return False
if var1 == 'm':
print var1
elif var1 == 'w':
print('else')
import numpy as np
laser_range = np.array([0.6370000243186951, 0.6380000114440918, 0.6420000195503235,
0.6430000066757202, 0.6439999938011169, 0.6449999809265137,
0.6460000276565552, 0.6510000228881836, 0.6510000228881836,
0.6539999842643738, 0.656000018119812, 0.6600000262260437,
0.6629999876022339, 0.6660000085830688, 0.6700000166893005,
0.6740000247955322, 0.6759999990463257, 0.6800000071525574,
0.6830000281333923, 0.6859999895095825, 0.6940000057220459,
0.6990000009536743, 0.703000009059906, 0.7070000171661377,
0.7089999914169312, 0.7049999833106995, 0.7020000219345093,
0.718999981880188, 0.718999981880188, 0.718999981880188,
0.7319999933242798, 0.7369999885559082, 0.7620000243186951,
0.7720000147819519, 0.7820000052452087, 0.7889999747276306,
0.777999997138977, 0.7250000238418579, 0.699999988079071,
0.652999997138977, 0.6079999804496765, 0.6069999933242798,
0.6060000061988831, 0.6069999933242798, 0.609000027179718,
0.6100000143051147, 0.6100000143051147, 0.6060000061988831,
0.6039999723434448, 0.597000002861023, 0.593999981880188,
0.5799999833106995, 0.5720000267028809, 0.5619999766349792,
0.5490000247955322, 0.5490000247955322, 0.34200000762939453,
0.3400000035762787, 0.33799999952316284, 0.33799999952316284,
0.33899998664855957, 0.3400000035762787, 0.3449999988079071,
0.3709999918937683, 0.4429999887943268, 0.4390000104904175,
0.4359999895095825, 0.4309999942779541, 0.4269999861717224,
0.42399999499320984, 0.42100000381469727, 0.4180000126361847,
0.41600000858306885, 0.414000004529953, 0.4129999876022339,
0.41200000047683716, 0.41100001335144043, 0.4099999964237213,
0.4099999964237213, 0.4090000092983246, 0.40799999237060547,
0.40700000524520874, 0.4059999883174896, 0.4059999883174896,
0.40700000524520874, 0.4090000092983246, 0.41200000047683716,
0.41600000858306885, 0.42100000381469727, 0.4259999990463257,
0.4309999942779541, 0.43799999356269836, 0.4449999928474426,
0.4519999921321869, 0.460999995470047, 0.4699999988079071,
0.47999998927116394, 0.492000013589859, 0.503000020980835,
0.5210000276565552, 0.0, 0.0, 0.0, 1.8109999895095825,
1.7059999704360962, 2.3529999256134033])
def read_pgm(pgmf):
"""Return a raster of integers from a PGM as a list of lists."""
assert pgmf.readline() == 'P5\n'
(width, height) = [int(i) for i in pgmf.readline().split()]
depth = int(pgmf.readline())
assert depth <= 255
raster = []
for y in range(height):
row = []
for y in range(width):
row.append(ord(pgmf.read(1)))
raster.append(row)
return raster
f = open('/home/nus/map.pgm', 'rb')
data = read_pgm(f)
occdata = np.array([-1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 100, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 100, 0, 0, 0, 0, 0, 0, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ])
import cmath
import math
a = complex(math.cos(math.radians(50)),math.sin(math.radians(50)))
b = complex(math.cos(math.radians(80)),math.sin(math.radians(80)))
c = a / b
from random import randint
print(randint(1, 247))
# commands to work with images
from PIL import Image
a = np.random.randint(0,255,(600,600),dtype=np.uint8)
a = np.zeros((600,600), dtype=np.uint8)
img = Image.fromarray(a)
img.show()
rotated = img.rotate(45)
rotated.show()