From 295cdf8a29bae1aae5e217415d54a0cfac18d379 Mon Sep 17 00:00:00 2001 From: IanKirwan Date: Fri, 29 Dec 2017 15:36:31 +0000 Subject: [PATCH] Mod to select working random locations in GTAV DeepGTAV currently chooses a random start location numerically, but if the location is not possible it defaults to a fixed location. The proposed code selects a working random location from a csv of 350 random working locations. The project will not allow me to upload the csv file or make a pull request so I'll have to send you the csv separately to add to the project. Message me on how best to do that or give me pull request/upload proposal rights and I'll do it myself. Cheers e. --- dataset | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dataset b/dataset index df1324d..3393678 100644 --- a/dataset +++ b/dataset @@ -7,6 +7,8 @@ from deepgtav.client import Client import argparse import time import cv2 +import pandas as pd +import random # Stores a dataset file with data coming from DeepGTAV if __name__ == '__main__': @@ -16,6 +18,15 @@ if __name__ == '__main__': parser.add_argument('-d', '--dataset_path', default='dataset.pz', help='Place to store the dataset') args = parser.parse_args() + # Get a random start location + df = pd.read_csv("gtav.rand.locations.csv", header=None) + randIdx = random.randint(0,349) + startLocation = [0,0,0] + startLocation = df.iloc[randIdx].tolist() + + # If you want a specific location specify it here: + # startLocation = [0,0,0] + # Creates a new connection to DeepGTAV using the specified ip and port. # If desired, a dataset path and compression level can be set to store in memory all the data received in a gziped pickle file. client = Client(ip=args.host, port=args.port, datasetPath=args.dataset_path, compressionLevel=9) @@ -24,7 +35,7 @@ if __name__ == '__main__': # See deepgtav/messages.py to see what options are supported dataset = Dataset(rate=30, frame=[320,160], throttle=True, brake=True, steering=True, vehicles=True, peds=True, reward=[15.0, 0.0], direction=None, speed=True, yawRate=True, location=True, time=True) # Send the Start request to DeepGTAV. - scenario = Scenario(drivingMode=[786603,15.0]) # Driving style is set to normal, with a speed of 15.0 mph. All other scenario options are random. + scenario = Scenario(location=startLocation, drivingMode=[786603,15.0]) # Driving style is set to normal, with a speed of 15.0 mph. All other scenario options are random. client.sendMessage(Start(dataset=dataset,scenario=scenario)) # Start listening for messages coming from DeepGTAV. We do it for 80 hours