-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulate_pyhelios.py
64 lines (47 loc) · 1.48 KB
/
simulate_pyhelios.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
Simulating point clouds with Helios++.
"""
import hydra
from omegaconf import DictConfig
from bin import pyhelios
from simulate_helios import create_scene, create_survey
@hydra.main(config_path='./conf', config_name='config', version_base='1.2')
def simulate(cfg: DictConfig):
"""
Simulate point cloud given scene.
"""
# set logging
pyhelios.loggingDefault()
# set seed for default random number generator
pyhelios.setDefaultRandomnessGeneratorSeed(f"{cfg.seed}")
# print current helios version
print(f'helios version: {pyhelios.getVersion()}')
# create survey
create_survey(cfg)
# create scene
create_scene(cfg)
# build simulation parameters
sim_builder = pyhelios.SimulationBuilder(
f'conf/als_{cfg.dataset_name}.xml',
'bin/assets/',
'outputs/',
)
sim_builder.setNumThreads(cfg.threads)
sim_builder.setLasOutput(True)
sim_builder.setZipOutput(True)
sim_builder.setCallbackFrequency(0) # run with callback
sim_builder.setFinalOutput(False) # return output at join
sim_builder.setExportToFile(True) # export point cloud to file
sim_builder.setRebuildScene(False)
sim = sim_builder.build()
sim.start()
if sim.isStarted():
print('Simulation has started!')
while sim.isRunning():
pass
if sim.isFinished():
print('Simulation has finished.')
# acquire simulated data
sim.join()
if __name__ == '__main__':
simulate()