-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathonly_gazebo.py
32 lines (27 loc) · 1.1 KB
/
only_gazebo.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
#!/usr/bin/env python3
import asyncio
import os
from pyrevolve import parser
from pyrevolve.tol.manage import World
from pyrevolve.util.supervisor.supervisor_multi import DynamicSimSupervisor
async def run():
# Parse command line / file input arguments
settings = parser.parse_args()
# Start Simulator
if settings.simulator_cmd != 'debug':
simulator_supervisor = DynamicSimSupervisor(
world_file=settings.world,
simulator_cmd=settings.simulator_cmd,
simulator_args=["--verbose"],
plugins_dir_path=os.path.join('.', 'build', 'lib'),
models_dir_path=os.path.join('.', 'models'),
simulator_name='gazebo'
)
await simulator_supervisor.launch_simulator(port=settings.port_start)
# let there be some time to sync all initial output of the simulator
await asyncio.sleep(5)
# Connect to the simulator and pause
connection = await World.create(settings, world_address=('127.0.0.1', settings.port_start))
await asyncio.sleep(1)
await connection.disconnect()
print("SIMULATOR STARTED")