Exemple #1
0
def reset():
    ''' Resets position of car to a specific location '''
    # Same conditions as below |
    dataset = Dataset(rate=10,
                      frame=[320, 160],
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True,
                      speed=True,
                      yawRate=True,
                      time=True,
                      vehicles=True,
                      peds=True,
                      trafficSigns=True,
                      reward=True)
    #,yawRate=True,time=True,vehicles=True, peds=True, trafficSigns=True, direction=True, reward=True
    scenario = Scenario(
        weather='EXTRASUNNY',
        vehicle='blista',
        time=[12, 0],
        drivingMode=[786603, 20.0],
        location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
    client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #2
0
def reset(location):
    global FPS, show_imgwidth, show_imgheight
    ''' Resets position of car to a specific location '''
    # Same conditions as below |
    dataset = Dataset(rate=FPS,
                      frame=[show_imgwidth, show_imgheight],
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True,
                      speed=True,
                      yawRate=True,
                      time=True,
                      vehicles=True,
                      peds=True,
                      trafficSigns=True)
    #,yawRate=True,time=True,vehicles=True, peds=True, trafficSigns=True, direction=True, reward=True
    #[-1917.06640625, 4595.87255859375, 56.853]
    #-737.1954345703125, 1975.72265625, 133.54100036621094
    #[2723.626953125, 3224.170654296875, 54.402042388916016]
    #827.8175659179688, -1201.2620849609375, 45.51389694213867 街头竞速 没车
    scenario = Scenario(weather='EXTRASUNNY',
                        vehicle='blista',
                        time=[12, 0],
                        drivingMode=-1,
                        location=location)
    client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #3
0
    def startScenarios(self):
        _drivingMode = [
            786603, 11.0
        ]  # mode (0-4294967296), speed (0-20), only if auto drive
        _vehicle = 'oracle'  # "blista", "voltic", "packer", "oracle"
        _weather = 'CLEAR'  # "CLEAR", "EXTRASUNNY", "CLOUDS", "OVERCAST", "RAIN", "CLEARING", "THUNDER", "SMOG", "FOGGY", "XMAS", "SNOWLIGHT", "BLIZZARD", "NEUTRAL", "SNOW"
        _time = [10, 30]  # HH, MM
        _location = [-281.8045, -1396.085]  # [-274.2653, -1122.707]

        dataset = Dataset(throttle=True,
                          brake=True,
                          steering=True,
                          vehicles=True,
                          trafficSigns=True,
                          peds=True,
                          speed=True,
                          yawRate=True,
                          location=True,
                          time=True)
        scenario = Scenario(drivingMode=_drivingMode,
                            vehicle=_vehicle,
                            weather=_weather,
                            time=_time,
                            location=_location)
        start_msg = Start(dataset=dataset, scenario=scenario)
        jsonstr = start_msg.to_json().encode()

        c = Message(START_SCENARIOS, data=jsonstr)
        self.__sendMsg(c)
def reset():
    #Resets position of car to a specific location
    # Same conditions as below |
    dataset = Dataset(rate=60,
                      frame=[1920, 1080],
                      vehicles=True,
                      location=True)
    scenario = Scenario(weather='EXTRASUNNY',
                        vehicle='packer',
                        time=[9, 0],
                        drivingMode=[786603, 20.0])
    client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #5
0
def reset():
    ''' Resets position of car to a specific location '''
    # Same conditions as below |
    dataset = Dataset(
        rate=60,
        frame=[800, 600],
        throttle=True,
        brake=True,
        steering=True,
        location=True,
    )  # drivingMode=True)
    scenario = Scenario(weathers='EXTRASUNNY', vehicle='blista',
                        times=[12, 0])  #, drivingMode=[786603, 40.0])
    # , location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
    client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #6
0
def reset():
    dataset = Dataset(rate=rate,
                      frame=frame,
                      throttle=True,
                      brake=True,
                      steering=True,
                      speed=True,
                      drivingMode=True,
                      location=True)
    scenario = Scenario(weather='EXTRASUNNY',
                        vehicle='voltic',
                        time=[12, 0],
                        drivingMode=[1074528293, max_speed / 1.6],
                        location=[-3000, 2500])
    client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #7
0
def reset():
    # Resets position of the car to the starting location
    dataset = Dataset(rate=30,
                      frame=frame,
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True)
    scenario = Scenario(weather=weather,
                        vehicle=vehicle,
                        time=time,
                        drivingMode=drivingMode,
                        location=location)
    Client.sendMessage(Config(scenario=scenario, dataset=dataset))
Exemple #8
0
def reset(weatherIndex=0):
    ''' Resets position of car to a specific location '''
    # Same conditions as below |
    client.sendMessage(Stop())
    dataset = Dataset(rate=30,
                      frame=frame_capture_size,
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      speed=True,
                      yawRate=True,
                      direction=True)
    # dataset = Dataset(rate=30, frame=[400,300], throttle=True, brake=True, steering=True, location=True, speed=True, yawRate=True, direction=True, reward=[18.0, 0.5])
    # Automatic driving scenario
    # scenario = Scenario(weather='EXTRASUNNY',vehicle='voltic',time=[12,0],drivingMode=[786603,70.0],location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
    # scenario = Scenario(weather=weatherList[weatherIndex],vehicle='voltic',time=[12,0],drivingMode=[4294967295,70.0],location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
    scenario = Scenario(weather=weatherList[weatherIndex],
                        vehicle='voltic',
                        time=[12, 0],
                        drivingMode=[2883621, 20.0],
                        wander=False)
    client.sendMessage(Start(scenario=scenario,
                             dataset=dataset))  # Start request
	weathers = ["CLEAR", "EXTRASUNNY", "CLOUDS", "OVERCAST", "RAIN", "CLEARING", "THUNDER", "SMOG", "FOGGY", "XMAS", "SNOWLIGHT", "BLIZZARD", "NEUTRAL", "SNOW" ]
	hours = [0,4,8,12,16,20]
	## CREATE A REAL DATASET WITH WEATHER CONDITIONS IN DIRECTORY.
	for weather in weathers:
		# 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.
		for hour in hours:
			client = Client(ip=args.host, port=args.port, datasetPath=args.dataset_path, compressionLevel=9)
			infos = {}
			infos['weather'] = weather
			infos['hour'] = hour
			infos['time'] = int(time.time())

			# Configures the information that we want DeepGTAV to generate and send to us. 
			# See deepgtav/messages.py to see what options are supported
			dataset = Dataset(rate=4, frame=[1280,640], throttle=True, brake=True, steering=True, vehicles=True, peds=True, trafficSigns=True, reward=[15.0, 0.0], direction=None, speed=True, yawRate=True, location=True, time=True)
			# Send the Start request to DeepGTAV.
			scenario = Scenario(time=[hour,0],weather=weather,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))
			stoptime = time.time() + 2*60
			while time.time() < stoptime:
				try:
					message = client.recvMessage(infos)	
				except KeyboardInterrupt:
				# We tell DeepGTAV to stop
					break
		# We tell DeepGTAV to stop
	client.sendMessage(Stop())
	client.close()
Exemple #10
0
    '''
    try:
        #client.sendMessage(Stop()) # Stops DeepGTAV
        client.close()
    except Exception as e:
        pass

    client = Client(ip='localhost', port=8000, datasetPath="self_driving.pz", compressionLevel=9) # Default interface
    '''
    dataset = Dataset(rate=FPS,
                      frame=[show_imgwidth, show_imgheight],
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True,
                      speed=True,
                      yawRate=True,
                      time=True,
                      vehicles=True,
                      peds=True,
                      trafficSigns=True)
    #dataset = None
    #blista { "blista", "voltic", "packer" };
    #隧道[-2573.13916015625, 3292.256103515625, 13.241103172302246]
    #[-3048.73486328125, 736.7617797851562, 21.694440841674805]
    #[1037.0552978515625, -2099.537353515625, 30.54058837890625]
    #{ "CLEAR", "EXTRASUNNY", "CLOUDS", "OVERCAST", "RAIN", "CLEARING", "THUNDER", "SMOG", "FOGGY", "XMAS", "SNOWLIGHT", "BLIZZARD", "NEUTRAL", "SNOW" };
    scenario = Scenario(
        weather='EXTRASUNNY',
        vehicle='voltic',
Exemple #11
0
    frame = [350, 205 + 20]

    logger.info(
        'Rate %s hz, frame %s, max_stop_time %s, max_wall_time %s, max_speed %s, dataset_path %s.'
        % (str(rate), str(frame), str(max_stop_time), str(max_wall_time),
           str(max_speed), str(dataset_path)))

    client = Client(ip=host,
                    port=port,
                    datasetPath=dataset_path,
                    compressionLevel=0)

    dataset = Dataset(rate=rate,
                      frame=frame,
                      throttle=True,
                      brake=True,
                      steering=True,
                      speed=True,
                      drivingMode=True,
                      location=True)

    scenario = Scenario(weather='EXTRASUNNY',
                        vehicle='voltic',
                        time=[12, 0],
                        drivingMode=[1074528293, max_speed / 1.6],
                        location=[500, 500])

    client.sendMessage(Start(scenario=scenario, dataset=dataset))

    count = 0
    old_location = [0, 0, 0]
Exemple #12
0
    args = parser.parse_args()

    # Creates a new connection to DeepGTAV using the specified ip and port
    client = Client(ip=args.host,
                    port=args.port,
                    datasetPath=args.dataset_path,
                    compressionLevel=9,
                    divideByTrip=True)

    dataset = Dataset(
        rate=20,
        frame=[320, 180],
        throttle=True,
        brake=True,
        steering=True,
        speed=True,
        acceleration=True,
        yaw=True,
        yawRate=True,
        isCollide=True,
        location=True,
        drivingModeMsg=True
    )  # lidar=[3, True, 100.0, 1000, 60.0, 300.0, 20, 85.0, 115.0], , vehicles=True, peds=True
    # Automatic driving scenario
    scenario = Scenario(weather='EXTRASUNNY',vehicle='blista', time=[12,0], drivingMode=[-2, 3, 25.0, 1.0, 1.0],
        route=[	\
      -1989.000000, -468.250000, 10.562500,
      1171.351563, -1925.791748, 36.220097
      ])

    client.sendMessage(Start(scenario=scenario,
                             dataset=dataset))  # Start request
Exemple #13
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)
    client = Client(ip=args.host, port=args.port, compressionLevel=9)

    # Configures the information that we want DeepGTAV to generate and send to us.
    # See deepgtav/messages.py to see what options are supported
    #rate = 30 kong
    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.
    #kong driveingmode = 786603
    #location=[209,228] traffic light
    scenario = Scenario(
        location=[2835, 3478], 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(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))
    args = parser.parse_args()

    #remove old dataset if exists
    try:
        os.remove(dataset_path)
    except OSError:
        pass

    # Creates a new connection to DeepGTAV using the specified ip and port
    client = Client(ip=args.host,
                    port=args.port,
                    datasetPath=args.dataset_path,
                    compressionLevel=9)
    # Dataset options
    dataset = Dataset(rate=60,
                      frame=[1920, 1080],
                      vehicles=True,
                      location=True)
    # Automatic driving scenario
    scenario = Scenario(
        weather='EXTRASUNNY',
        vehicle='packer',
        time=[9, 0],
        drivingMode=[786603, 20.0]
    )  #, location=[-661.9974975585938, -1932.245849609375, 27.170656204223633])
    client.sendMessage(Start(scenario=scenario,
                             dataset=dataset))  # Start request

    count = 0
    old_location = [0, 0, 0]

    # Main loop stops when dataset.size < N GB
Exemple #15
0
url = "https://www.pixeldesert.com/compare"  # 设置远程遥控器的地址。
txt_position = "../state.config"
tongji_position = "tongji/" + str(i) + ".txt"  # 设置统计文件的位置。统计文件的作用是

CAP_IMG_W, CAP_IMG_H = 320, 240  # 设置要采集的数据集中图像的尺寸

rate = 10  # 设置图像采集的频率,即每秒钟采集多少组数据
client = None
scenario = None

dataset = Dataset(rate=10,
                  frame=[CAP_IMG_W, CAP_IMG_H],
                  throttle=True,
                  brake=True,
                  steering=True,
                  location=True,
                  drivingMode=True,
                  speed=True,
                  time=True)


def state():
    while True:
        response = requests.request("POST", url)
        fo = open(txt_position, "w")
        if response.text[1] == '0':
            fo.write("0")
        elif response.text[1] == '1':
            fo.write("1")
        fo.close()
Exemple #16
0
        client.renewTarget(
            datasetPath=data_full_path,
            compressionLevel=args.comp_level)  # Rename

        # Configures the information that we want DeepGTAV to generate and
        # send to us.
        # See deepgtav/messages.py to see what options are supported
        dataset = Dataset(
            rate=args.record_rate,
            frame=args.frame_resolution,
            throttle=args.throttle,
            brake=args.brake,
            steering=args.steering,
            vehicles=args.vehicles,
            trafficSigns=args.trafficSigns,
            peds=args.peds,
            reward=args.reward,
            speed=args.speed,
            yawRate=args.yawRate,
            location=args.if_location,
            time=args.dataset_time,
            roadinfo=args.roadinfo,
            direction=args.des
        )

        if args.auto_drive:
            scenario = Scenario(
                drivingMode=args.driving_mode,
                vehicle=args.vehicle,
                weather=weather,
                time=args.time,
Exemple #17
0
                        help='Place to store the dataset')
    args = parser.parse_args()

    # Creates a new connection to DeepGTAV using the specified ip and port
    client = Client(ip=args.host,
                    port=args.port,
                    datasetPath=args.dataset_path,
                    compressionLevel=9)
    # Dataset options
    dataset = Dataset(rate=10,
                      frame=[320, 160],
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True,
                      speed=True,
                      yawRate=True,
                      time=True,
                      vehicles=True,
                      peds=True,
                      trafficSigns=True,
                      reward=True)
    #peds=True, trafficSigns=True, direction=True, reward=True
    # Automatic driving scenario
    #
    scenario = Scenario(
        weather='EXTRASUNNY',
        vehicle='blista',
        time=[12, 0],
        drivingMode=[786603, 20.0],
        location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
Exemple #18
0
                        help='Place to store the dataset')
    args = parser.parse_args()

    # Create a new connection to DeepGTAV using the specified IP and Port
    client = Client(ip=args.host,
                    port=args.port,
                    datasetPath=args.dataset_path,
                    compressionLevel=9)
    # Dataset options
    dataset = Dataset(rate=20,
                      frame=frame,
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True,
                      peds=True,
                      reward=[15.0, 0.0],
                      direction=None,
                      speed=True,
                      yawRate=True,
                      time=True)

    # Automatic driving scenario - Dataset 을 구성할 Driving scenario 를 정의한다.
    scenario = Scenario(weather=weather,
                        vehicle=vehicle,
                        time=time,
                        drivingMode=drivingMode,
                        location=location)

    # GTAV 에 dataset path 와 scenario 를 전달하여 dataset 을 모으기 위한 환경을 실행한다.
Exemple #19
0
    parser.add_argument('-d', '--dataset_path', default='dataset.pz',
                     help='Place to store the dataset')
    parser.add_argument('-s', '--save_data', default=False,
                     help='Record data?')
    args = parser.parse_args()

    # Creates a new connection to DeepGTAV using the specified ip and port

    client = Client(ip=args.host, port=args.port)
    # Dataset options
    dataset = Dataset(
            rate=10, 
            frame=[640, 320],
            throttle=True, 
            brake=True, 
            steering=True,
            location=True, 
            speed=True, 
            yawRate=True,
            vehicles=True,
            direction=[-2573.13916015625, 2000, 13.241103172302246]
            )

    # Automatic driving scenario
    scenario = Scenario(
            weather='EXTRASUNNY',
            vehicle='blista',
            time=[12,0],
            drivingMode=[1,123],
            location=[-2573.13916015625, 3292.256103515625, 13.241103172302246]
            )
    client.sendMessage(Start(scenario=scenario,dataset=dataset)) # Start request
Exemple #20
0
    lidar_U_FOV = 85
    lidar_D_FOV = 100
    lidar_para = [
        2, False, lidar_range, lidar_X_res, lidar_L_FOV, lidar_R_FOV,
        lidar_Y_res, lidar_U_FOV, lidar_D_FOV
    ]

    dataset = Dataset(rate=None,
                      frame=[1280, 720],
                      throttle=True,
                      brake=True,
                      steering=True,
                      speed=True,
                      acceleration=True,
                      yaw=True,
                      pitch=True,
                      roll=True,
                      yawRate=True,
                      pitchRate=True,
                      rollRate=True,
                      isCollide=False,
                      location=False,
                      drivingModeMsg=False,
                      time=False,
                      lidar=lidar_para)  # , vehicles=True, peds=True)

    # Send the Start request to DeepGTAV. Dataset is set as default, we only receive frames at 10Hz (320, 160)
    client.sendMessage(Start(scenario=scenario, dataset=dataset))

    # parameters
    Camera_height_FOV = 60
    focus = 719 / 2 / math.tan(
Exemple #21
0
                            help='The port where DeepGTAV is running')
        parser.add_argument('-d',
                            '--dataset_path',
                            default=np_filename,
                            help='Place to store the dataset')
        args = parser.parse_args()
        # Creates a new connection to DeepGTAV using the specified ip and port
        print(np_filename)
        client = Client(ip=args.host,
                        port=args.port,
                        datasetPath=np_filename,
                        compressionLevel=9)
        # Dataset options
        dataset = Dataset(rate=60,
                          frame=[800, 600],
                          throttle=True,
                          brake=True,
                          steering=True,
                          location=True)  #, drivingMode=True)
        # Automatic driving scenario
        scenario = Scenario(weathers='EXTRASUNNY',
                            vehicle='blista',
                            times=[12, 0])  #, drivingMode=[6, 30.0])
        # ,location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])

        # FLAGS - CONVERTED
        # INTEGER - NAME / DESC
        # OF
        # THE
        # DRIVING
        # STYLE
        # 01000000000011000000000000100101 - 1074528293 - "Rushed"
Exemple #22
0
    parser.add_argument('-d',
                        '--dataset_path',
                        default='dataset_test.pz',
                        help='Place to store the dataset')
    args = parser.parse_args()

    # Creates a new connection to DeepGTAV using the specified ip and port
    client = Client(ip=args.host,
                    port=args.port,
                    datasetPath=args.dataset_path,
                    compressionLevel=9)
    # Dataset options
    dataset = Dataset(rate=30,
                      frame=[320, 160],
                      throttle=True,
                      brake=True,
                      steering=True,
                      location=True,
                      drivingMode=True)
    # Automatic driving scenario
    scenario = Scenario(
        weather='EXTRASUNNY',
        vehicle='blista',
        time=[12, 0],
        drivingMode=[786603, 20.0],
        location=[-2573.13916015625, 3292.256103515625, 13.241103172302246])
    client.sendMessage(Start(scenario=scenario,
                             dataset=dataset))  # Start request

    count = 0
    old_location = [0, 0, 0]
Exemple #23
0
 def __prepare_datasets(self, open_=True, fps=20, throttle_=True, brake_=True, steering_=True, vehicles_=True, peds_=True, speed_=True, location_=True, detection_file_name_='detection1.pickle'):
     self.__dataset = Dataset(rate=fps, frame=self.__frame_size, throttle=throttle_, brake=brake_,
                       steering=steering_, vehicles=vehicles_, time=True, peds=peds_, speed=speed_, location=location_)
     if open_:
         self.__detection_pickleFile = open(detection_file_name_, mode='wb')
         self.__labels_csv = open('labels.csv', 'wb')