Cooperative Driving

The emergency-braking scenario runs end to end: Tutorial 2: CARLA Braking Experiment. V2V and V2I scenarios are documented in Tutorial 7: V2V and V2I Experiments.

Research question

How much does vehicle-to-vehicle or vehicle-to-infrastructure communication improve safety outcomes under varying network conditions?

Layers involved

  • Data Source — CARLA 0.9.10 simulator with ScenarioRunner

  • Processing Core — braking pipeline (detect → ROI-gate → brake decision)

  • NetWaggle — link between the client and server nodes

  • Analysis — per-frame latency, braking reaction time, collision outcome

What to configure

The V2V experiment uses a constant 20 ms delay for the DSRC 802.11p baseline:

DSRC baseline link — docs/snippets/v2v-constant-link.yaml
# V2V DSRC baseline: constant 20 ms message-level delay (802.11p).
# Passes cadet validate.
extends: ../../configs/base.yaml

experiment: {name: snippet_v2v_constant, app: reference, repetitions: 1}
source: {kind: synthetic, count: 8, width: 64, height: 48}
nodes:
  - {name: client, host: localhost, role: client, device: cpu}
  - {name: server, host: 127.0.0.1, port: 15013, role: server, device: cpu}
links:
  - name: ego_to_server
    from: client
    to: server
    network:
      mode: delay
      distribution:
        kind: constant
        value_ms: 20.0     # DSRC 802.11p baseline
      loss: 0.0
app: {plugin: reference, params: {model_kind: stub}}

For the lognormal 5G model (p50 = 30 ms, p99 = 100 ms), see docs/snippets/v2v-lognormal-link.yaml:

Lognormal 5G link — docs/snippets/v2v-lognormal-link.yaml
# Lognormal link snippet for V2V experiments: 5G p50 = 30 ms, p99 = 100 ms.
# The lognormal link states two percentiles: p50_ms is the median (the scale
# parameter, e^mu) and p99_ms is the tail, so sigma = ln(p99/p50) / 2.3263.
# For p50 = 30 ms, p99 = 100 ms that is sigma = log(100/30) / 2.3263 = 0.5176.
# Only mode: delay can render this spread (p99/p50 = 3.3x > 2x limit for netem).
extends: ../../configs/base.yaml

experiment: {name: snippet_v2v_lognormal, app: reference, repetitions: 1}
source: {kind: synthetic, count: 8, width: 64, height: 48}
nodes:
  - {name: client, host: localhost, role: client, device: cpu}
  - {name: server, host: 127.0.0.1, port: 15012, role: server, device: cpu}
links:
  - name: ego_to_server
    from: client
    to: server
    network:
      mode: delay
      distribution:
        kind: lognormal
        p50_ms: 30.0     # median
        p99_ms: 100.0    # tail; sigma = ln(100/30) / 2.3263 = 0.5176
      loss: 0.0
app: {plugin: reference, params: {model_kind: stub}}

The full V2V experiment config is at examples/v2v/v2v_braking.yaml. Key fields:

  • source.scenario.ego_speed — follower starting speed

  • links[0].network.distribution.value_ms — link delay in ms

  • source.weather — weather preset: clear, light, or high

How to run

Emergency-braking baseline:

cadet run examples/braking/flat/atspeed_braking.yaml \
    --set source.carla.host=$(hostname -I | awk '{print $1}') \
    --app-module examples.braking.flat.app

V2V scenario:

cadet run examples/v2v/v2v_braking.yaml \
    --set source.carla.host=$(hostname -I | awk '{print $1}') \
    --app-module examples.v2v.app

Where results land

outputs/{experiment}/{app}/{run_id}/:

  • {run_id}_latency_location_log.csv — per-frame brake reaction latency

  • run.json — run metadata and outcome

  • config.yaml — resolved config for the run

The column brake_reaction_latency_s is the primary metric.

How to extend

  • Change the link model: replace mode: delay with mode: netem (packet-level, docs/snippets/netem-link.yaml) or mode: netwaggle (Mininet-WiFi, docs/snippets/netwaggle-wired.yaml).

  • Sweep over link delay and ego speed using links[0].network.distribution.value_ms and source.scenario.ego_speed as sweep axes.

  • Write a new app: see Tutorial 6: Write an App Plugin.

See also