tier4 / scenario_simulator_v2

A scenario-based simulation framework for Autoware
Apache License 2.0
114 stars 54 forks source link

How to specify the state of traffic lights in the scenario? #1236

Open hcn1519 opened 2 months ago

hcn1519 commented 2 months ago

I am running a scenario using the scenario test runner, and I wonder how to specify the state of traffic lights in the TIER IV Scenario Format Version 2.0. It seems that the scenario simulator v2 does not follow the OpenScenario v1.2 specification.

Below are my scenario and map files, which I used to test traffic light behaviors. The scenario includes a simple ego routing story and sets all traffic lights to red. (I have checked the syntax against other scenario files, though there might be an error.) I expected the ego car to stop at the junction because of the traffic light, but it ignores it and reaches the destination.

The code below is the part related to traffic lights in the scenario file.

RoadNetwork:
  LogicFile:
    filepath: lanelet2_map.osm
  SceneGraphFile:
    filepath: point_cloud.pcd
  TrafficSignals:
      TrafficSignalController:
      - name: test_signals
        Phase:
        - duration: INF
          name: Stop
          TrafficSignalState:
          - state: red solidOn circle
            trafficSignalId: '494'
          - state: red solidOn circle
            trafficSignalId: '520'
          - state: red solidOn circle
            trafficSignalId: '586'
          - state: red solidOn circle
            trafficSignalId: '553'
Storyboard:
    Init:
      Actions:
        GlobalAction:
        - InfrastructureAction:
            TrafficSignalAction:
              TrafficSignalControllerAction:
                phase: Stop
                trafficSignalControllerRef: test_signals
HansRobo commented 2 months ago

@hcn1519

Hi, thank you for reporting!

Since the traffic light message type differs depending on the version of autoware, it is necessary to appropriately switch the traffic light topic output from the scenario_simulator_v2 side.

You can switch it by switching the architecture_type of scenario_test_runner. For older Autoware, awf/universe is appropriate, and for newer Autoware, awf/universe/20230906 is appropriate.

If nothing is specified, awf/universe will be used, so the traffic light will not connect to new autoware.

We are aware of this issue and are working on #1232 .

HansRobo commented 2 months ago

It seems that the scenario simulator v2 does not follow the OpenScenario v1.2 specification.

The user guide provides a scenario for specifying a traffic light using OpenDRIVE as an example. However, in reality, as shown below, the content of state is just an example, and it is not stipulated in the standard that it must be followed.

description of TrafficSignalState::state

State of the signal, e.g. the visual information "off;off;on". The number of values in the state depends on the traffic signal in the roadnetwork , e.g. type and subtype in OpenDRIVE

Autoware uses lanelet2 as its map format instead of OpenDRIVE, so please understand that although it is within the scope of the OpenSCENARIO standard, the specifications are different from the scenario in the user guide, which assumes OpenDRIVE.

hcn1519 commented 2 months ago

Thank you for your answer @HansRobo I test to use awf/universe/20230906, and it works. Also, I appreciate your additional answer regarding specification.