{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Scene Part Swap: Repeated Surveys over Several Scene States\n", "\n", "Notebook: Hannah Weiser, 2024\n", "\n", "This notebook demonstrates how to use the [scene swap feature]() in HELIOS++ both for a terrestrial laser scanning (TLS) and UAV-based laser scanning (ULS) example.\n", "In the HELIOS++ scene XML, swaps can be defined for each scene part, resulting in a sequence of different scene states. HELIOS++ will automatically repeat the survey for each scene state.\n", "\n", "We will use the command-line access of HELIOS++ to run the simulation, and use Python just for displaying the input XMLs and the resulting point clouds." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "from IPython.display import Code\n", "from pyhelios.util.xmldisplayer import display_xml, find_playback_dir\n", "import laspy\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import matplotlib as mpl" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "os.chdir(\"..\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# TLS \n", "\n", "## Survey\n", "\n", "The survey consists of two flight lines from a height of 400 m, placed 200 m apart. The scanner is a Leica ALS-50." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<document>\n",
" <survey name="dyn_geom_swap_als" scene="data/scenes/dyn/dyn_geom_swap_scene.xml#dyn_geom_swap_scene" platform="data/platforms.xml#sr22" scanner="data/scanners_als.xml#leica_als50">\n",
"\t\t<leg>\n",
" <platformSettings x="100" y="100.0" z="400" onGround="false" movePerSec_m="5" />\n",
" <scannerSettings active="true" pulseFreq_hz="83000" scanFreq_hz="70" scanAngle_deg="60" trajectoryTimeInterval_s="0.01" />\n",
" </leg>\n",
"\t\t<leg>\n",
" <platformSettings x="-100" y="-100.0" z="400" onGround="false" movePerSec_m="5" />\n",
" <scannerSettings active="false" pulseFreq_hz="83000" scanFreq_hz="70" scanAngle_deg="60" />\n",
" </leg>\n",
"\t\t<leg>\n",
" <platformSettings x="-100" y="100.0" z="400" onGround="false" movePerSec_m="5" />\n",
" <scannerSettings active="true" pulseFreq_hz="83000" scanFreq_hz="70" scanAngle_deg="60" trajectoryTimeInterval_s="0.01" />\n",
" </leg>\n",
"\t\t<leg>\n",
" <platformSettings x="100" y="-100.0" z="400" onGround="false" movePerSec_m="5" />\n",
" <scannerSettings active="false" pulseFreq_hz="83000" scanFreq_hz="70" scanAngle_deg="60" />\n",
" </leg>\n",
" </survey>\n",
"</document>\n",
"<scene id="dyn_geom_swap_scene" name="DynGeomSwapScene">\n",
"\n",
"\n",
"\t\t<!-- Ground plane -->\n",
"\t\t<!-- ************ -->\n",
"\t\t<part id="1">\n",
" <filter type="objloader">\n",
" <param type="string" key="filepath" value="data/sceneparts/basic/groundplane/groundplane.obj" />\n",
" </filter>\n",
" <filter type="scale">\n",
" <param type="double" key="scale" value="120" />\n",
" </filter>\n",
"\t\t\t<filter type="translate">\n",
"\t\t\t\t<param type="vec3" key="offset" value="50.0;0;0" />\n",
"\t\t\t</filter>\n",
" </part>\n",
"\n",
"\n",
"\n",
"\n",
"\t\t<!-- Small cube goes sphere for two repetitions then goes big cube -->\n",
"\t\t<!-- ************************************************************* -->\n",
"\t\t<part id="2">\n",
" <filter type="objloader">\n",
" <param type="string" key="filepath" value="data/sceneparts/toyblocks/cube.obj" />\n",
" </filter>\n",
"\t\t\t<filter type="rotate">\n",
"\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t</param>\n",
"\t\t\t</filter>\n",
"\t\t\t<filter type="scale">\n",
" <param type="double" key="scale" value="0.75" />\n",
" </filter>\n",
"\t\t\t<filter type="translate">\n",
"\t\t\t\t<param type="vec3" key="offset" value="-40.0;-50.0;0" />\n",
"\t\t\t</filter>\n",
"\t\t\t<!-- Swap small cube by sphere -->\n",
"\t\t\t<swap swapStep="2">\n",
"\t\t\t\t<filter type="objloader">\n",
" \t<param type="string" key="filepath" value="data/sceneparts/toyblocks/sphere.obj" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="1.25" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-30.0;-60.0;0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
"\t\t\t<!-- Swap sphere by big cube -->\n",
"\t\t\t<swap swapStep="1">\n",
"\t\t\t\t<filter type="objloader">\n",
"\t\t <param type="string" key="filepath" value="data/sceneparts/toyblocks/cube.obj" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="rotate">\n",
"\t\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t\t</param>\n",
"\t\t\t\t</filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="1.5" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-20.0;-60.0;0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
" </part>\n",
"\n",
"\n",
"\n",
"\n",
"\t\t<!-- Sphere goes cube goes nothing -->\n",
"\t\t<!-- ***************************** -->\n",
"\t\t<part id="3">\n",
"\t\t\t<filter type="objloader">\n",
" <param type="string" key="filepath" value="data/sceneparts/toyblocks/sphere.obj" />\n",
" </filter>\n",
"\t\t\t<filter type="scale">\n",
" <param type="double" key="scale" value="1.25" />\n",
" </filter>\n",
"\t\t\t<filter type="translate">\n",
"\t\t\t\t<param type="vec3" key="offset" value="-10.0;-20.0;0" />\n",
"\t\t\t</filter>\n",
"\t\t\t<!-- Swap sphere by cube -->\n",
"\t\t\t<swap>\n",
"\t\t\t\t<filter type="objloader">\n",
"\t\t <param type="string" key="filepath" value="data/sceneparts/toyblocks/cube.obj" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="2.0" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-40.0;40.0;0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
"\t\t\t<!-- Swap cube by nothing -->\n",
"\t\t\t<swap force_null="true">\n",
"\t\t\t</swap>\n",
"\t\t</part>\n",
"\n",
"\n",
"\n",
"\n",
"\t\t<!-- Small cube goes mid goes big goes bigger -->\n",
"\t\t<!-- **************************************** -->\n",
"\t\t<part id="4">\n",
" <filter type="objloader">\n",
" <param type="string" key="filepath" value="data/sceneparts/toyblocks/cube.obj" />\n",
" </filter>\n",
"\t\t\t<filter type="rotate">\n",
"\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t</param>\n",
"\t\t\t</filter>\n",
"\t\t\t<filter type="scale">\n",
" <param type="double" key="scale" value="0.75" />\n",
" </filter>\n",
"\t\t\t<filter type="translate">\n",
"\t\t\t\t<param type="vec3" key="offset" value="-20.0;10.0;0" />\n",
"\t\t\t</filter>\n",
"\t\t\t<!-- Swap small cube by mid cube -->\n",
"\t\t\t<swap swapStep="1">\n",
"\t\t\t\t<filter type="rotate">\n",
"\t\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t\t</param>\n",
"\t\t\t\t</filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="2.0" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-22.0;12.0;0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
"\t\t\t<!-- Swap mid cube by big cube -->\n",
"\t\t\t<swap swapStep="1">\n",
"\t\t\t\t<filter type="rotate">\n",
"\t\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t\t</param>\n",
"\t\t\t\t</filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="3.0" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-18.0;11.0;0.0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
"\t\t\t<!-- Swap big cube by bigger cube -->\n",
"\t\t\t<swap swapStep="1">\n",
"\t\t\t\t<filter type="rotate">\n",
"\t\t\t\t\t<param key="rotation" type="rotation">\n",
"\t\t\t\t\t\t<rot angle_deg="45" axis="z" />\n",
"\t\t\t\t\t</param>\n",
"\t\t\t\t</filter>\n",
"\t\t\t\t<filter type="scale">\n",
"\t\t <param type="double" key="scale" value="3.5" />\n",
"\t\t </filter>\n",
"\t\t\t\t<filter type="translate">\n",
"\t\t\t\t\t<param type="vec3" key="offset" value="-42.0;12.0;0.0" />\n",
"\t\t\t\t</filter>\n",
"\t\t\t</swap>\n",
" </part>\n",
" </scene>\n",
"