Skip to content

Get omega-prime files from CARLA simulations #14

@MichaelSchuldes

Description

@MichaelSchuldes

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

  1. Create recording from scenario: python scenario_runner.py --scenario <scenario_name> --record <path/to/save/the/recorder/file>
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions