Skip to main content

Class ProsocialMetricCalculator

Calculates the prosocial yield score between pairs of actors crossing a trigger zone, combining geometric safety and relative effort into a per-time-step metric.

public class ProsocialMetricCalculator : MonoBehaviour, IFeedbackMetricCalculator, IDataLoggable

Inheritance​

Implements​

Remarks​

The prosocial metric quantifies how much an autonomous vehicle (Actor A) yields to a pedestrian (Actor B) at an interaction point. The composite score ysi accounts for the inter-actor angle (gi), the proximity angle (ei), the instantaneous safety margin (si), and the integrated effort (Ei). The composite score differentiates polite slowing from a near-miss, reflecting both the safety margin maintained and the integrated effort expended by the yielding actor.

Properties​

Metric​

Get the prosocial feedback metric

public float Metric { get; }

Property Value​

float

Methods​

Collect()​

Captures a snapshot of this component's current state and returns it as a DataLog subclass.

public DataLog Collect()

Returns​

DataLog — A DataLog subclass populated with the component's current readings, or null if no data is available.

Remarks​

Return null when the component has no meaningful data to contribute (e.g., it is disabled or in an initialising state). The collector ignores null returns and excludes them from the analysis output, so implementations never need to allocate a placeholder.