The srunner has a metrics module that can turn carla recordings and compute metrics on those. We could use the module to create omega-prime files from the recordings. The steps to do so would be
- Create recording from scenario:
python scenario_runner.py --scenario <scenario_name> --record <path/to/save/the/recorder/file>
- Run Metrics Module:
python metrics_manager.py --metric recording2omega_prime.py --log <path/to/save/the/recorder/file> (simulation has to be running in carla for srunner to be able to access map information. in recording itself only the name of the map is stored see)
Detailed information of how to implement the Metric Module recording2omega_prime.py can be found here
# recording2omega_prime.py
import omega_prime
import json
from srunner.metrics.examples.basic_metric import BasicMetric
class Recording2OmegaPrime(BasicMetric):
"""
Metric class Recording2OmegaPrime
"""
def _create_metric(self, town_map, log, criteria):
xodr_content_string = town_map.to_opendrive() # See https://carla.readthedocs.io/en/latest/python_api/#carla.Map
ego_id = log.get_ego_vehicle_id()
start, end = log.get_actor_alive_frames(ego_id)
...
relevant functions of log
- get_actor_bounding_box
- get_actor_alive_frames
- get_actor_ids_with_role_name
- get_elapsed_time
- get_all_actor_accelerations
- get_all_actor_angular_velocities
- get_walker_speed
- get_all_actor_transforms
- get_all_actor_velocities
Alternatively, the ScenarioManager could be subclassed and the function _tick_scenario could be extended to do the logging to osi live https://github.com/carla-simulator/scenario_runner/blob/master/srunner/scenariomanager/scenario_manager.py#L150
The srunner has a metrics module that can turn carla recordings and compute metrics on those. We could use the module to create omega-prime files from the recordings. The steps to do so would be
python scenario_runner.py --scenario <scenario_name> --record <path/to/save/the/recorder/file>python metrics_manager.py --metric recording2omega_prime.py --log <path/to/save/the/recorder/file>(simulation has to be running in carla for srunner to be able to access map information. in recording itself only the name of the map is stored see)Detailed information of how to implement the Metric Module
recording2omega_prime.pycan be found hererelevant functions of log
Alternatively, the
ScenarioManagercould be subclassed and the function_tick_scenariocould be extended to do the logging to osi live https://github.com/carla-simulator/scenario_runner/blob/master/srunner/scenariomanager/scenario_manager.py#L150