write로만 하니까 마지막 데이터가 없어버리면, 아무것도 기록되지 않아있다...
cnt = 0
InsideWayptCSV=open('Waypoints_inside_Rect_points(x,y)123123.csv','a', encoding='utf-8', newline='') ####MKADD3
MK_wr12=csv.writer(InsideWayptCSV) ####MKADD3
print('g_set_waypoints_meter_range len : ', len(g_set_waypoints_meter_range)) ###MKADD 559
# print('g_min_x_meter, g_max_x_meter, g_min_y_meter, g_max_y_meter', g_min_x_meter, g_max_x_meter, g_min_y_meter, g_max_y_meter)
# print('g_set_waypoints_meter_range : ', g_set_waypoints_meter_range)
for i in range(0,len(g_set_waypoints_meter_range)):
# print('22222')
min_y_meter = g_set_waypoints_meter_range[i][0]
min_x_meter = g_set_waypoints_meter_range[i][1]
max_y_meter = g_set_waypoints_meter_range[i][2]
max_x_meter = g_set_waypoints_meter_range[i][3]
cnt += 1
print('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
print('max_y_meter > g_min_y_meter ?', max_y_meter , ' ', g_min_y_meter)
print('g_max_y_meter > min_y_meter ?', g_max_y_meter , ' ', min_y_meter )
print('max_x_meter > g_min_x_meter ?', max_x_meter ,' ', g_min_x_meter )
print('g_max_x_meter > min_x_meter ?', g_max_x_meter , ' ', min_x_meter )
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
# print('min_x, min_y, max_x, max_y : ', min_x_meter, min_y_meter, max_x_meter, max_y_meter)
# print('g_set_waypoints[i] : ', g_set_waypoints[i])
if(g_min_y_meter < max_y_meter and g_max_y_meter > min_y_meter and g_min_x_meter < max_x_meter and g_max_x_meter > min_x_meter): ###g_set_watpoints
print('111111111111111111111111')
wayptlist = g_set_waypoints[i] ###MKADD wayptlist = [waypoint, waypoint, ..., waypoint] 즉, 여기부터는 한 줄을 보는것임.
# print(wayptlist)
E8_inside_waypoint_meter_list = [] ###MKADD 네모 사각형 안에 들어가는 waypoint들을 담을것임 [waypoint, waypoint, waypoint , ..., waypoint]
for j in range(0,len(wayptlist)): ###MKADD 한 줄의 원소 하나하나 본다. 즉, waypoint 하나하나 본다.
E8coordi = MK_W_to_E8(wayptlist[j].transform.location.y, wayptlist[j].transform.location.x) ###MKADD wayptlist[j] = j번째 waypoint점. wayptlist[j]=waypoint
# print('E8coordi : ' , E8coordi)
if(E8coordi[0] > 0 and E8coordi[0] < 800 and E8coordi[1] > 0 and E8coordi[1] < 112): ###MKADD E8coordi[0] : y, E8coordi[1] : x
# print('33')
E8_inside_waypoint_meter_list.append(wayptlist[j]) ###MKADD E8_inside_waypoint_meter_list=[waypoint, waypoint, ..., waypoint]
# print('wayptlist[j].transform.location.x, wayptlist[j].transform.location.y : ', wayptlist[j].transform.location.x, wayptlist[j].transform.location.y)
temp_list12=[wayptlist[j].transform.location.x, wayptlist[j].transform.location.y] ####MKADD3
# temp_list12 = [1,2]
print('haha==============================')
MK_wr12.writerow(temp_list12) ####MKADD3
# print('E8_inside_waypoint_meter_list : ', E8_inside_waypoint_meter_list) ###MKADD 점점 양이 늘어야 함.
if(len(E8_inside_waypoint_meter_list) > 2):
_inside_waypoints_meter.append(E8_inside_waypoint_meter_list) ###MKADD g_inside_waypoints_meter = [ [waypoint, waypoint, ... waypoint], [], ... , [] ]
# print('g_inside_waypoints_meter : ', g_inside_waypoints_meter)
InsideWayptCSV.close() ####MKADD3
print('hoho1')
'Programming > 코딩 실수' 카테고리의 다른 글
다음 waypoint 찾는데 local minima에 빠지는 문제 (0) | 2021.07.28 |
---|---|
디버깅 하는방법 (0) | 2021.07.20 |
global 변수를 만들어놓고, class 앞에 global 이라고 안씀... (0) | 2021.07.15 |
And와 Or( &&와 ||) 헷갈리지 마라 (0) | 2021.03.26 |
Segmentation fault (0) | 2021.03.26 |
댓글