Exemple #1
0
    help="What degree of interpolation to use when selecting labels",
    default=1,
    type=int,
    required=False)
args = parser.parse_args()
argdict = vars(args)
spline_degree = args.spline_degree
with open(os.path.join(args.db_path, "f1_dataset_config.yaml"), "r") as f:
    dset_config = yaml.load(f, Loader=yaml.SafeLoader)
use_json = dset_config["use_json"]
image_folder = os.path.join(args.db_path, dset_config["images_folder"])
udp_folder = os.path.join(args.db_path, dset_config["udp_folder"])

telemetry_folder = os.path.join(udp_folder, "car_telemetry_packets")
session_folder = os.path.join(udp_folder, "session_packets")
session_packets = getAllSessionPackets(session_folder, use_json)

spectating_flags = [
    bool(packet.udp_packet.m_isSpectating) for packet in session_packets
]
spectating = False
for flag in spectating_flags:
    spectating = spectating or flag
car_indices = [
    int(packet.udp_packet.m_spectatorCarIndex) for packet in session_packets
]
print(spectating_flags)
print(car_indices)
print(spectating)
car_indices_set = set(car_indices)
car_index = 0
Exemple #2
0
    shutil.rmtree(output_dir)
    time.sleep(1.0)
if os.path.isdir(output_dir):
    s = 'asdf'
    while not ((s == 'y') or (s == 'n')):
        s = input("Directory %s already exists. overwrite it? (y\\n)" %
                  (output_dir, ))
    if s == 'y':
        shutil.rmtree(output_dir)
        time.sleep(1.0)
    else:
        print("Thanks for playing!")
        exit(0)
os.makedirs(output_dir)

session_tags = sorted(getAllSessionPackets(session_folder, use_json),
                      key=udpPacketKey)
trackId = session_tags[0].udp_packet.m_trackId
trackName = trackNames[trackId]
searchFile = trackName + "_racingline.json"
racelineFile = searchForFile(searchFile,
                             os.getenv("F1_TRACK_DIRS").split(os.pathsep))
if racelineFile is None:
    raise ValueError("Could not find trackfile %s" % searchFile)
racelinetimes_, racelinedists_, raceline_ = loadRaceline(racelineFile)
Nsamp = int(15E3)
racelinedists = np.linspace(racelinedists_[0].item(),
                            racelinedists_[-1].item(), Nsamp)
racelinetimes = np.linspace(racelinetimes_[0].item(),
                            racelinetimes_[-1].item(), Nsamp)
rlfit_t = racelinetimes_.numpy()