bfz111's picture
Add reproducible Gazebo simulation environment and English setup documentation
e5f58d9 verified
Raw History Blame Contribute Delete
1.39 kB
#!/usr/bin/env bash
# Outputs and the mutable CSV stay in datasets/smoke_world_vN.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VERSION="${1:-v1}"
if [[ ! "${VERSION}" =~ ^v[1-4]$ ]]; then
echo "Usage: $0 [v1|v2|v3|v4]" >&2
exit 2
fi
mkdir -p "${ROOT}/datasets/smoke_world_${VERSION}/trajectory"
cp "${ROOT}/examples/smoke.csv" "${ROOT}/datasets/smoke_world_${VERSION}/trajectory/smoke.csv"
export WORLD_VERSION="${VERSION}"
export DATASET_CAPTURE_LIMIT=1
export DATASET_REVALIDATE_EXISTING=1
export DATASET_CAPTURE_MAX_ATTEMPTS=1
export SIMPLE_DRONE_RUN_TIMEOUT="${SIMPLE_DRONE_RUN_TIMEOUT:-120}"
"${ROOT}/datasets_construct.sh" "${ROOT}/datasets/smoke_world_${VERSION}"
# The original capture script can skip timeouts; require actual outputs here.
python3 - "${ROOT}/datasets/smoke_world_${VERSION}" <<'PY'
import csv
import sys
from pathlib import Path
from PIL import Image
root = Path(sys.argv[1])
rows = list(csv.DictReader((root / 'trajectory/smoke.csv').open()))
assert len(rows) == 1 and rows[0].get('capture_frame'), 'Capture did not finish'
for view in ('front', 'down', 'left', 'right'):
path = root / 'images/smoke' / ('images_' + view) / rows[0][view + '_image']
with Image.open(path) as image:
assert image.size == (640, 480), (path, image.size)
image.verify()
print('PASS: four 640x480 images and capture metadata')
PY