Files
NODEDC_MISSION_CORE/simulation/ai-polygon/Prepare-RobotAssets.ps1
T

34 lines
2.0 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$root = 'D:\NDC_MISSIONCORE\runtime\simulation\assets\jetbot-6.1-v1'
$origin = 'https://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/6.1/Isaac/Robots_Multiphysics/NVIDIA/Jetbot/'
$files = @('jetbot.usda', 'payloads/base.usda', 'payloads/instances.usda', 'payloads/robot.usda', 'payloads/materials.usda', 'payloads/geometries.usd', 'payloads/Physics/physics.usda', 'payloads/Physics/physx.usda')
$manifest = Join-Path $root 'asset-manifest.json'
if (Test-Path $manifest) {
$existing = Get-Content $manifest -Raw | ConvertFrom-Json
foreach ($file in $existing.files) {
if ((Get-FileHash (Join-Path $root $file.path) -Algorithm SHA256).Hash.ToLower() -ne $file.sha256) { throw 'Prepared Jetbot asset changed' }
}
Get-Content $manifest
exit 0
}
New-Item -ItemType Directory $root -Force | Out-Null
$rows = @()
$total = 0
foreach ($relative in $files) {
$target = Join-Path $root $relative
New-Item -ItemType Directory (Split-Path $target) -Force | Out-Null
if (!(Test-Path $target)) {
& curl.exe --fail --silent --show-error --location --connect-timeout 10 --max-time 180 --max-filesize 536870912 --retry 2 --continue-at - --output "$target.part" ($origin + $relative)
if ($LASTEXITCODE -ne 0) { throw "Jetbot download failed: $relative" }
Move-Item "$target.part" $target
}
$length = (Get-Item $target).Length
$total += $length
if ($total -gt 536870912) { throw 'Jetbot package exceeds 512 MiB budget' }
$rows += [ordered]@{path=$relative; source_url=($origin+$relative); byte_length=$length; sha256=(Get-FileHash $target -Algorithm SHA256).Hash.ToLower()}
}
# OmniPBR.mdl and OmniGlass.mdl are bundled renderer materials, not remote assets.
[ordered]@{schema_version='missioncore.ai-polygon-robot-assets/v1'; version='isaac-6.1-jetbot'; files=$rows; byte_length=$total; prepared_at=[DateTime]::UtcNow.ToString('o')} | ConvertTo-Json -Depth 5 | Set-Content -Encoding UTF8 $manifest
Get-Content $manifest