예제 #1
0
 def change_viewpoint(self, cameras, use_sim_start_command):
     self.use_sim_start_command = use_sim_start_command
     deepdrive_capture.close()
     deepdrive_client.close(self.client_id)
     self.client_id = 0
     self.close_sim()  # Need to restart process now to change cameras
     self.open_sim()
     self.connect(cameras)
예제 #2
0
 def close(self):
     if self.dashboard_queue is not None:
         self.dashboard_queue.put({'should_stop': True})
         self.dashboard_queue.close()
     if self.dashboard_process is not None:
         self.dashboard_process.join()
     deepdrive_capture.close()
     deepdrive_client.release_agent_control(self.client_id)
     deepdrive_client.close(self.client_id)
     self.client_id = 0
     if self.sess:
         self.sess.close()
     self.close_sim()
예제 #3
0
def cleanUp(clientId):
    deepdrive_client.release_agent_control(clientId)
    deepdrive.close()
    deepdrive_client.close(clientId)
	deepdrive_client.register_camera(clientId, 60, 1024, 1024, [1.0,2,3])

	ctrlAcquired = deepdrive_client.request_agent_control(clientId)
	print('Control acquired', ctrlAcquired)

	connected = deepdrive.reset(sharedMem[0], sharedMem[1])
	if connected:
		print('Capture connected')
		try:
			while True:
				snapshot = deepdrive.step()
				if snapshot:
					print(snapshot.capture_timestamp, snapshot.sequence_number, snapshot.speed, snapshot.is_game_driving, snapshot.camera_count, len(snapshot.cameras) )
					for c in snapshot.cameras:
						print('Id', c.id, c.capture_width, 'x', c.capture_height)

						deepdrive_client.set_control_values(clientId, 1.0, 1.0, 0.0, 0)

				time.sleep(0.001)

		except KeyboardInterrupt:
			deepdrive_client.release_agent_control(clientId)
			deepdrive.close()
			deepdrive_client.close(clientId)
			clientId = 0


if clientId > 0:
	deepdrive_client.close(clientId)