diff --git a/main_test.py b/main_test.py new file mode 100644 index 0000000000000000000000000000000000000000..682b4eeb71ea051989c8ae1a7578e004ce96563e --- /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