Skip to content

bagx.scenario

bagx.scenario

Scenario/dangerous scene extraction from rosbag files.

Identifies and extracts time segments where interesting or dangerous scenarios occur, such as GNSS loss, sensor dropouts, high dynamics, etc.

detect_scenarios(bag_path, gnss_lost_threshold_sec=2.0, dropout_threshold_sec=2.0, accel_threshold_mps2=15.0, sync_delay_threshold_ms=100.0, output_json=None)

Detect interesting/dangerous scenarios in a bag file.

Parameters:

Name Type Description Default
bag_path str

Path to the bag file.

required
gnss_lost_threshold_sec float

Duration of no-fix to consider GNSS lost.

2.0
dropout_threshold_sec float

Duration of topic silence to consider a dropout.

2.0
accel_threshold_mps2 float

Acceleration magnitude threshold for high dynamics.

15.0
sync_delay_threshold_ms float

Inter-topic delay threshold for sync degradation.

100.0
output_json TextIO | None

Optional file handle for JSON output.

None

Returns:

Type Description
ScenarioReport

ScenarioReport with detected scenarios.

print_scenario_report(report, console=None)

Pretty-print a scenario detection report.