-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtutorial1.py
executable file
·34 lines (28 loc) · 1.05 KB
/
tutorial1.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
#!/usr/bin/env python3
import asyncio
import os
from pyrevolve import parser
from pyrevolve.gazebo.manage import WorldManager as World
from pyrevolve.util.supervisor.supervisor_multi import DynamicSimSupervisor
from pyrevolve.custom_logging.logger import logger
async def run():
logger.info('Hello World!')
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)
await asyncio.sleep(0.1)
connection = await World.create()
if connection:
logger.info("Connected to the simulator world.")
await connection.pause(True)
while True:
await asyncio.sleep(10.0)