def main(): global window if platform.system() == 'Linux': connected = deepdrive.reset('/tmp/deepdrive_shared_memory', 157286400) elif platform.system() == 'Windows': connected = deepdrive.reset('Local\DeepDriveCapture', 157286400) if connected: glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE) glutInitWindowSize(1200, 800) glutInitWindowPosition(0, 0) window = glutCreateWindow(b'DeepDrive viewer') glutDisplayFunc(Render) # Uncomment this line to get full screen. #glutFullScreen() glutIdleFunc(Idle) glutReshapeFunc(Resize) glutKeyboardFunc(onKeyPressed) InitGL(640, 480) glutMainLoop()
def connect(): clientId = deepdrive_client.create('127.0.0.1', 9876) if clientId > 0: print('Connected ...', clientId) sharedMem = deepdrive_client.get_shared_memory(clientId) print('SharedMemName:', sharedMem[0], "Size", sharedMem[1]) deepdrive_client.register_camera(clientId, 60, 1024, 1024, [0.0, 0.0, 200.0]) connected = deepdrive.reset(sharedMem[0], sharedMem[1]) return clientId
def connect(): if platform.system() == 'Linux': connected = deepdrive.reset('/tmp/deepdrive_shared_memory', 157286400) elif platform.system() == 'Windows': connected = deepdrive.reset('Local\DeepDriveCapture', 157286400) return connected
import argparse import deepdrive import time import platform if platform.system() == 'Linux': connected = deepdrive.reset('/tmp/deepdrive_shared_memory', 157286400) elif platform.system() == 'Windows': connected = deepdrive.reset('Local\DeepDriveCapture', 157286400) def test_loop(): parser = argparse.ArgumentParser(description='Example of how to access Unreal data') parser.add_argument('-v', '--verbose', action='count', dest='verbosity', default=0, help='Set verbosity.') parser.add_argument('-s', '--show', action='store_true', help='Show images - useful for debugging') args = parser.parse_args() print(connected) if 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) print(snapshot.position) print(snapshot.rotation) print(snapshot.velocity) print(snapshot.acceleration) for cc in snapshot.cameras: print(' Camera:', cc.type, cc.id, cc.capture_width, 'x', cc.capture_height) print(' image size', len(cc.image_data), cc.image_data[0], cc.image_data[1], cc.image_data[2])
import deepdrive_client clientId = deepdrive_client.create('127.0.0.1', 19876) if clientId > 0: print('Connected ...', clientId) sharedMem = deepdrive_client.get_shared_memory(clientId) print('Connected ...', deepdrive_client.get_shared_memory(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: