{% import "partials/fields.html" as f %} {% import "partials/lanelet_search.html" as ls %} {% import "partials/icons.html" as ic %} {%- set spawn_slot = document.lanelet_slot(target.id ~ '.spawn') -%} {%- set goal_slot = document.lanelet_slot(target.id ~ '.goal') -%}

{{ 'Ego vehicle' if target.kind == 'ego' else 'Vehicle' }}

{{ target.display_name }}

{{ ic.icon('target', 12) }} Spawn

{# The field here, the map -- and with it the choice between a pinned lanelet and a constraint search -- behind Edit: a constraint is a statement about the map, and this column is 384px wide. #} {{ f.lanelet_field('spawn_lanelet_id', target.spawn.lanelet_id, draft) }}

{% if target.spawn.deriving %} Derived from the search ({{ target.spawn.binding_title or 'no binding yet' }}, this ID the default a non-swept run uses), {% elif not target.spawn.searching %} Pinned, {% else %} Searched ({{ target.spawn.constraints|length }} constraint{{ '' if target.spawn.constraints|length == 1 else 's' }}, this ID the default a non-swept run uses), {% endif %} {% if target.spawn.s.mode == 'fixed' %} {{ target.spawn.s.value }} m along it. {% else %} offset derived from the map. {% endif %} Edit opens the map, where all of that is chosen.

{% if target.kind == 'ego' %} {% set autoware = target.driven_by == 'autoware' %}

{{ ic.icon('car', 12) }} Driven by

Which stack drives the ego, exported as ego.entity. Autoware plans its own route, so it needs a goal below; an ego the TrafficManager drives reads none.

{# The goal sits with the spawn because it is the other end of the same thing: where the run starts and where it is meant to get to. It is not a card, because a card happens *during* a run and a goal is what the ego needs before one can start -- Autoware plans its route from the spawn to the goal and only then engages. #}

{{ ic.icon('target', 12) }} Goal

{# The readout only; the map -- and the same Fixed / Constraint search choice the spawn has -- is below, outside this form. #} {{ f.lanelet_field('goal_lanelet_id', target.goal.lanelet_id if target.goal else none, draft) }}

{% if target.goal and target.goal.searching %} Searched: the sweeper runs the scenario once per matching lanelet. {% elif target.goal and target.goal.deriving %} Derived from the lanelet the search picks. {% endif %} {% if autoware %} Required: Autoware plans its route to it and will not move without one. {% else %} Optional: the TrafficManager drives this ego and reads no goal. Give one to say where the run was meant to end. {% endif %}

{% if target.goal and not autoware %} {% endif %}
{% if target.goal %}
{% endif %} {% endif %}
{# Outside the form above, because the search built in here is made of forms and a form cannot nest. The two halves find each other by id. #} {% call f.lanelet_modal('spawn_lanelet_id', target.spawn.lanelet_id, draft, 'spawn lanelet') %} {{ ls.chooser(spawn_slot, draft, document, selected) }} {# Where along the lanelet, under the same heading as which lanelet: it is one question -- where does this vehicle start -- and one panel answering it. Its own form, because the panel is shown outside the inspector's. #}
{% if target.spawn.s.mode == 'derived' %}

The value a run falls back to when nothing derives it.

{% endif %}
{% if target.spawn.s.mode == 'derived' %}
{{ f.binding_picker('s', target.spawn.s.binding, 'stop_line_offset', 'Derived from', document, draft) }}
{% endif %} {% if target.kind != 'ego' %} {# Off the centreline and turned: a pedestrian waiting at the kerb to cross. A vehicle is snapped back onto the road, so for one these mostly read zero. The ego spawns from its own Hydra keys, which have neither. #}
{% endif %}
{% endcall %} {% if target.kind == 'ego' %} {# The goal's map, outside the form for the same reason the spawn's is. A goal that has not been chosen yet still gets the panel: a search is *how* a goal is chosen, so it cannot be made to wait until one has been pinned. #} {% call f.lanelet_modal('goal_lanelet_id', target.goal.lanelet_id if target.goal else none, draft, 'Goal lanelet') %} {{ ls.chooser(goal_slot, draft, document, selected) }} {% endcall %} {% endif %} {% if target.kind != 'ego' or document.entities|length > 1 %} {% endif %}