-
Notifications
You must be signed in to change notification settings - Fork 32
/
test_robots.py
executable file
·45 lines (33 loc) · 1.14 KB
/
test_robots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import asyncio
from pyrevolve import parser
from pyrevolve.revolve_bot import RevolveBot
from pyrevolve.tol.manage import World
async def run():
settings = parser.parse_args()
yaml_file = 'experiments/'+ settings.experiment_name +'/data_fullevolution/phenotypes/'+'phenotype_'+settings.test_robot+'.yaml'
r = RevolveBot(_id=settings.test_robot)
r.load_file(yaml_file, conf_type='yaml')
#r.save_file('experiments/'+ settings +'/data_fullevolution/phenotype_35.sdf.xml', conf_type='sdf')
#r.render_body('experiments/'+ settings +'/data_fullevolution/phenotypes/phenotype_35.body.png')
connection = await World.create(settings, world_address=("127.0.0.1", settings.port_start))
await connection.insert_robot(r)
def main():
import traceback
def handler(_loop, context):
try:
exc = context['exception']
except KeyError:
print(context['message'])
return
traceback.print_exc()
raise exc
try:
loop = asyncio.get_event_loop()
loop.set_exception_handler(handler)
loop.run_until_complete(run())
except KeyboardInterrupt:
print("Got CtrlC, shutting down.")
if __name__ == '__main__':
print("STARTING")
main()
print("FINISHED")