sight = fc.get_car_sight(name) wight = len(sight[0]) hight = len(sight) r, ti = 0, fc.get_ti(name) mid = ti['mid'] if sight[mid[0][1]][mid[0][0]] < 0.5: r = -35 else: r = -np.abs(mid[0][0] - wight / 2) return r FRAME_SPACING = 20 fc.game_init('FCMAP0.PNG') fc.add_car('0', (90, 255)) fc.set_car('0', (90, 255), np.pi / 2, 0) #fc.show_car_sight('0') wight = len(fc.get_car_sight('0')[0]) fc.set_time_speed(0) ddpg = MDDPG.DDPG(11, 2, 2, np.array([np.pi / 3, 256])) var = np.array([np.pi / 3, 100]) times = 1 fc.start() while times: start_time = fc.get_time() normal_working = 0
batch_size=64, name='target_ctrl', op_name='ctrl_model') value_model = tfl.regression(value, placeholder=y, optimizer='adam', loss=value_loss, trainable_vars=value_vars, batch_size=64, name='target_value', op_name='value_model') model = tfl.DNN(tf.concat([ctrl, value], 1)) fc.game_init("FCMAP0.PNG") fc.add_car("0", (430, 240)) fc.set_car("0", (430, 240), np.pi / 2, 0) fc.show_car_sight("0") wight = len(fc.get_car_sight("0")[0]) train_sight = [] train_degree = [] train_velocity = [] train_y = [] degree = 0 velocity = 100 times = 1 fc.set_time_speed(1)