collab/igvc2018

git clone https://git.julia.blue/collab/igvc2018

rickyc106Clean up comments and call gps function469e5be

imu
2.0 KiB108 linesraw
1#!/usr/bin/python
2
3import random
4
5eps = 0.1
6
7mag_2dlist = [[] for i in range(3)]
8loop = 1
9counter = [0,0,0]
10adding = 1
11finish = 1000
12
13mag = [0,0,0]
14mag_max = [0,0,0]
15mag_min = [0,0,0]
16previous_max = [0,0,0]
17previous_min = [0,0,0]
18
19
20while(loop):
21	for j in range(3):
22		mag[j] = random.uniform(-1,5)
23
24	for j in range(3):
25		mag_2dlist[j].append(mag[j])
26
27		mag_max[j] = max(mag_2dlist[j])
28		mag_min[j] = min(mag_2dlist[j])
29
30		#eps_max.insert(j,mag_2dlist[j][-1] - mag_max[j])
31		#eps_min.insert(j,mag_2dlist[j][-1] - mag_min[j])
32
33		#if abs(eps_max[0]) < eps and abs(eps_max[1]) < eps and abs(eps+max[2]) < eps and abs(eps_min[0]) < eps and abs(eps_min[1]) < eps and abs(eps_min[2]) < eps:
34		#if abs(eps_max[0]) < eps:
35		#	loop = 0
36
37		#print(mag_2dlist)
38	#print(mag_max[2] - previous_max[2])
39
40	for j in range(3):
41		if(mag_max[j] - previous_max[j]) == 0.0:
42			counter[j] = counter[j] + 1
43		elif(mag_max[j] - previous_max[j] != 0.0):
44			counter[j] = 0
45		previous_max[j] = mag_max[j]
46
47	#print(counter)
48
49	if counter[0] > 1000 and counter[1] > 1000 and counter[2] > 1000:
50		loop = 0
51
52print(mag_max)
53
54
55
56#print mag_max
57#print mag_min
58
59#def func():
60	#sample = 20
61	#x = 0
62	#for i in range(sample):
63		#x = x + 1
64		#print(x)
65
66# 	eps = 0.1
67
68# 	mag_2dlist = [[] for i in range(3)]
69# 	loop = 1
70
71# 	mag = []
72# 	mag.insert(0,random.uniform(-1,5))
73# 	mag.insert(1,random.uniform(-1,5))
74# 	mag.insert(2,random.uniform(-1,5))
75
76# 	mag_max = []
77# 	mag_min = []
78# 	eps_max = []
79# 	eps_min = []
80
81# 	while(loop):
82# 		for j in range(3):
83# 			mag_2dlist[j].append(mag[j])
84
85# 			mag_max.insert(j,max(mag_2dlist[j]))
86# 			mag_min.insert(j,min(mag_2dlist[j]))
87
88# 			eps_max.insert(j,mag_2dlist[j][-1] - mag_max[j])
89# 			eps_min.insert(j,mag_2dlist[j][-1] - mag_min[j])
90
91# 			if abs(eps_max[0]) < eps and abs(eps_max[1]) < eps and abs(eps+max[2]) < eps and abs(eps_min[0]) < eps and abs(eps_min[1]) < eps and abs(eps_min[2]) < eps:
92# 				loop = 0
93
94# 			print(mag_max)
95
96# 	print mag_max
97# 	print mag_min
98
99# 	#x = random.uniform(-1.0,5.0)
100
101# 	#print(x)
102
103
104# if __name__ == '__main__':
105# 	try:
106# 		func()
107# 	except:
108# 		pass