class wecar_planner():
    def __init__(self):
			self.global_path=path_reader.read_txt(self.path_name+".txt") ## 출력할 경로의 이름
	    ##### 구현 파트 ####
	    self.global_path_2 = Path() # 부분 global path
	    self.global_path_2.header.frame_id='/map'
	    self.local_path = Path() # local path
	    self.local_path.header.frame_id='/map'
			# use x
	    self.local_path_2 = Path() # 사용 X, 단순히 return 값 저장 용
	    self.local_path_2.header.frame_id='/map'
	    self.current_waypoint_2 = 0 # 사용 X, 단순히 return 값 저장 용
	    self.current_waypoint = 0 # 사용 X, 단순히 return 값 저장 용

			while not rospy.is_shutdown():
		
				if self.is_status==True: ## 차량의 상태, 장애물 상태 점검
			    ## global_path와 차량의 status_msg를 이용해 현제 waypoint와 local_path를 생성
			    self.local_path_2,self.current_waypoint=findLocalPath(self.global_path,self.status_msg) 
			    self.wp_mission() # 웨이포인트 기반 분할 주행
			    self.local_path,self.current_waypoint_2=findLocalPath(self.global_path_2,self.status_msg)
			    ########################  lattice  ########################
			    vehicle_status=[self.status_msg.position.x,self.status_msg.position.y,(self.status_msg.heading)/180*pi,self.status_msg.velocity.x/3.6]
			    lattice_path,selected_lane=latticePlanner(self.local_path,vehicle_status,self.lattice_current_lane, self.second_weight, self.third_weight)
					pure_pursuit.getPath(self.local_path) ## pure_pursuit 알고리즘에 Local path 적용
	        pure_pursuit.getEgoStatus(self.status_msg) ## pure_pursuit 알고리즘에 차량의 status 적용
	        self.steering=pure_pursuit.steering_angle() ## steering

		def wp_mission(self): # waypoint 기반 course 분할 및 mission 수행 / course 분할 이유 : index가 비슷하거나 같은 길을 지나오는 경우 인식이 제대로 안되기 때문
        if self.current_waypoint >= 0 and self.current_waypoint <= 10: # course 1 / 시작
            self.global_path_2.poses = self.global_path.poses[:90]
				if self.current_waypoint >= 85 and self.current_waypoint <= 95: # course 2
            self.global_path_2.poses = self.global_path.poses[85:220]
				if self.current_waypoint >= 215 and self.current_waypoint <= 220: # course 3 & mission 3-1 / trafficlight == 33 일 때 진행, 아니면 stop
            self.global_path_2.poses = self.global_path.poses[210:370]
				if self.current_waypoint >= 358 and self.current_waypoint <= 363: # course 4 & mission 3-2
            self.global_path_2.poses = self.global_path.poses[360:630]
				if self.current_waypoint >= 620 and self.current_waypoint <= 630 and self.lap_switch == 0: # course 5 / switch 사용 이유는 두바퀴 돌기 위해
            self.global_path_2.poses = self.global_path.poses[610:910]
            self.lap_switch = 1
				if self.current_waypoint >= 900 and self.current_waypoint <= 910 and self.lap_switch == 1: # course 6
            self.global_path_2.poses = self.global_path.poses[900:1300]
            self.lap_switch = 2
        if self.current_waypoint >= 1290 and self.current_waypoint <= 1300 and self.lap_switch == 2: # course 7
            self.global_path_2.poses = self.global_path.poses[1300:]
            self.lap_switch = 3