forked from augcog/ROAR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner_sim.py
46 lines (38 loc) · 1.99 KB
/
runner_sim.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
46
import logging
from pathlib import Path
from ROAR_Sim.configurations.configuration import Configuration as CarlaConfig
from ROAR_Sim.carla_client.carla_runner import CarlaRunner
from ROAR.agent_module.pure_pursuit_agent import PurePursuitAgent
from ROAR.configurations.configuration import Configuration as AgentConfig
from ROAR.agent_module.special_agents.recording_agent import RecordingAgent
from ROAR.agent_module.potential_field_agent import PotentialFieldAgent
from ROAR.agent_module.occupancy_map_agent import OccupancyMapAgent
from ROAR.agent_module.michael_pid_agent import PIDAgent
# from ROAR.agent_module.special_agents.waypoint_generating_agent import WaypointGeneratigAgent
from pydantic import BaseModel, Field
class PitStop(BaseModel):
carla_config: CarlaConfig = Field(default=CarlaConfig())
agent_config: AgentConfig = Field(default=AgentConfig())
def main():
"""Starts game loop"""
agent_config = AgentConfig.parse_file(Path("./ROAR_Sim/configurations/agent_configuration.json"))
carla_config = CarlaConfig.parse_file(Path("./ROAR_Sim/configurations/configuration.json"))
carla_runner = CarlaRunner(carla_settings=carla_config,
agent_settings=agent_config,
npc_agent_class=PurePursuitAgent)
try:
my_vehicle = carla_runner.set_carla_world()
agent = PIDAgent(vehicle=my_vehicle, agent_settings=agent_config)
carla_runner.start_game_loop(agent=agent, use_manual_control=True)
except Exception as e:
logging.error(f"Something bad happened during initialization: {e}")
carla_runner.on_finish()
logging.error(f"{e}. Might be a good idea to restart Server")
if __name__ == "__main__":
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(name)s '
'- %(message)s',
datefmt="%H:%M:%S",
level=logging.DEBUG)
import warnings
warnings.filterwarnings("ignore", module="carla")
main()