From 89bdaebb0150ff6e11ae1ba12eb134b033e3f7ea Mon Sep 17 00:00:00 2001 From: Theo Brockmann <theo.brockmann@stud.hs-bochum.de> Date: Mon, 8 Mar 2021 12:39:01 +0000 Subject: [PATCH] Upload New File --- main_test.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 main_test.py diff --git a/main_test.py b/main_test.py new file mode 100644 index 0000000..682b4ee --- /dev/null +++ b/main_test.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Jan 12 17:17:49 2021 + +@author: theob +""" + +import asyncio +import Gym_new +import time +import nest_asyncio +import show_image as si + + + +async def main(): + image_mode = 'L' + + + env = Gym_new.Gym() + await env.connect_websocket() + + # Resets the enviroment + observation, reward, done, info = await env.reset("",0.01) + print(observation) + print(reward) + print(done) + + # Makes 1 step only driving straight + observation, reward, done, info = await env.step("accelerate,screen_on", 0.17) + print(observation) + print(reward) + print(done) + + try: + # Test show Image + si.show_image(image_mode,info['thumbnail']['width'],info['thumbnail']['height'],info['thumbnail']['image']) + except Exception as e: + print("failed showing image: " + str(e)) + +if __name__ == "__main__": + nest_asyncio.apply() + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) \ No newline at end of file -- GitLab