param( [Parameter(Mandatory = $true)][string]$DataRoot, [Parameter(Mandatory = $true)][string]$OutputRoot, [Parameter(Mandatory = $true)][string]$RtkCapture, [Parameter(Mandatory = $true)][string]$ImuCapture, [string]$LidarObject = "frontlidar", [string]$LidarCaptureName = "h32.rscap", [string]$Timezone = "+08:00", [string[]]$StationNames = @(), [int]$Stride = 1, [double]$RtkMaxDtMs = 150.0, [double]$ImuBeforeMs = 100.0, [double]$ImuAfterMs = 100.0, [ValidateSet("device_gnss", "host")][string]$TimeBasis = "device_gnss", [switch]$SkipLidarExport, [switch]$SkipSerialParsing ) $ErrorActionPreference = "Stop" $RepoRoot = Split-Path -Parent $PSScriptRoot $Exporter = Join-Path $RepoRoot "tools\export_raw_to_combined.py" foreach ($Path in @($DataRoot, $RtkCapture, $ImuCapture)) { if (-not (Test-Path -LiteralPath $Path)) { throw "Input does not exist: $Path" } } if ($Stride -lt 1) { throw "Stride must be at least 1" } if ($SkipLidarExport -or $SkipSerialParsing) { throw "Partial skip flags are no longer supported; use tools/export_raw_to_combined.py internals or run_direct_rtk_lidar.ps1 on an existing combined/" } $Args = @( $Exporter, "--stations-root", $DataRoot, "--rtk-rscap", $RtkCapture, "--imu-rscap", $ImuCapture, "--out", $OutputRoot, "--lidar-capture-name", $LidarCaptureName, "--lidar-object", $LidarObject, "--timezone", $Timezone, "--stride", "$Stride", "--rtk-max-dt-ms", "$RtkMaxDtMs", "--imu-before-ms", "$ImuBeforeMs", "--imu-after-ms", "$ImuAfterMs", "--time-basis", $TimeBasis, "--overwrite" ) foreach ($Name in $StationNames) { $Args += @("--station", $Name) } Write-Host "[raw → combined one-shot export]" & python @Args if ($LASTEXITCODE -ne 0) { throw "export_raw_to_combined failed with Python exit code $LASTEXITCODE" } Write-Host "Combined NPZ: $(Join-Path $OutputRoot 'combined')" Write-Host "Summary: $(Join-Path $OutputRoot 'export_summary.json')"