def __init__(self): # left depth, center depth, right depth, steering self.low = np.array([0.0, 0.0, 0.0, 0]) self.high = np.array([100.0, 100.0, 100.0, 5]) #self.high = np.array([100.0, 100.0, 100.0, 21]) self.observation_space = spaces.Box(self.low, self.high) self.action_space = spaces.Discrete(5) #self.action_space = spaces.Discrete(21) self.state = (100, 100, 100, random.uniform(-1.0, 1.0)) self.episodeN = 0 self.stepN = 0 self.allLogs = {'speed': [0]} self.dist = 0 self.last_pos = [0, 0] self._seed() self.stallCount = 0 self.last_collision = None global airsimClient airsimClient = myAirSimCarClient() self.dirname = time.strftime("%Y_%m_%d_%H_%M") + '_rl' os.mkdir(self.dirname) self.f = open(self.dirname + '/log.txt', 'w') firstline = 'x,y,reward,collision\n' self.f.write(firstline)
def __init__(self): # left depth, center depth, right depth, steering self.low = np.array([0.0, 0.0, 0.0, 0]) self.high = np.array([100.0, 100.0, 100.0, 5]) self.observation_space = spaces.Box(self.low, self.high) self.action_space = spaces.Discrete(5) self.state = (100, 100, 100, random.uniform(-1.0, 1.0)) self.episodeN = 0 self.stepN = 0 self.allLogs = {'speed':[0]} self.dist = 0 self.last_pos = [0,0] self._seed() self.stallCount = 0 self.last_collision = None global airsimClient airsimClient = myAirSimCarClient() ''' self.LABELS = open("../AirSim/PythonClient/car/yolo/coco.names").read().strip().split("\n") self.path_weights = "../AirSim/PythonClient/car/yolo/yolov3.weights" self.path_config = "../AirSim/PythonClient/car/yolo/yolov3.cfg" ''' self.LABELS = open("../Yolo-Fastest/data/coco.names").read().strip().split("\n") self.path_weights = "../Yolo-Fastest/Yolo-Fastest/COCO/yolo-fastest.weights" self.path_config = "../Yolo-Fastest/Yolo-Fastest/COCO/yolo-fastest.cfg" np.random.seed(42) self.net = cv2.dnn.readNetFromDarknet(self.path_config, self.path_weights)
def __init__(self): # left depth, center depth, right depth, steering self.low = np.array([0.0, 0.0, 0.0, 0]) self.high = np.array([100.0, 100.0, 100.0, 21]) self.observation_space = spaces.Box(self.low, self.high) self.action_space = spaces.Discrete(21) self.state = (100, 100, 100, random.uniform(-1.0, 1.0)) self.episodeN = 0 self.stepN = 0 self.allLogs = { 'speed':[0] } self._seed() self.stallCount = 0 global airsimClient airsimClient = myAirSimCarClient()
def __init__(self): # left depth, center depth, right depth, steering self.low = np.array([0.0, 0.0, 0.0, 0, 0, 0]) self.high = np.array([100.0, 100.0, 100.0, 5, 5000.0, 5000.0]) self.observation_space = spaces.Box(self.low, self.high) self.action_space = spaces.Discrete(5) self.state = (100, 100, 100, random.uniform(-1.0, 1.0)) self.episodeN = 0 self.stepN = 0 self.allLogs = {'speed': [0]} self.dist = 0 self.last_pos = [0, 0] self.collision = False self.close_l, self.close_r = 5000, 5000 self._seed() self.stallCount = 0 self.last_collision = None global airsimClient airsimClient = myAirSimCarClient() self.LABELS = open( "../Yolo-Fastest/data/coco.names").read().strip().split("\n") self.path_weights = "../Yolo-Fastest/Yolo-Fastest/COCO/yolo-fastest.weights" self.path_config = "../Yolo-Fastest/Yolo-Fastest/COCO/yolo-fastest.cfg" np.random.seed(42) self.net = cv2.dnn.readNetFromDarknet(self.path_config, self.path_weights) self.dirname = time.strftime("%Y_%m_%d_%H_%M") + '_yolo' os.mkdir(self.dirname) self.f = open(self.dirname + '/log.txt', 'w') firstline = 'x,y,reward,collision\n' self.f.write(firstline)