hyperdrone 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hyperdrone/__init__.py +28 -0
- hyperdrone/_native/cmake/hyperdrone_jit.cmake +43 -0
- hyperdrone/_native/common/bindings.h +39 -0
- hyperdrone/_native/common/cuda_staging.h +68 -0
- hyperdrone/_native/common/jit_host.h +69 -0
- hyperdrone/_native/dynamics/CMakeLists.txt +66 -0
- hyperdrone/_native/dynamics/host.cpp +191 -0
- hyperdrone/_native/dynamics/iface.h +81 -0
- hyperdrone/_native/dynamics/impl.cpp +659 -0
- hyperdrone/_native/render/CMakeLists.txt +96 -0
- hyperdrone/_native/render/host.cpp +276 -0
- hyperdrone/_native/render/iface.h +132 -0
- hyperdrone/_native/render/impl.cpp +620 -0
- hyperdrone/_native/render/scene_bindings.cpp +279 -0
- hyperdrone/_vendor/rl-tools/CMakeLists.txt +159 -0
- hyperdrone/_vendor/rl-tools/LICENSE +21 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +14 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +103 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +13 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +43 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +84 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +29 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +33 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +26 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/assimp_fixup.cmake +16 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +17 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +27 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +32 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +17 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +4 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +6 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +946 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +703 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1334 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +205 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +411 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +771 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +139 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +382 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +297 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +184 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +739 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1185 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +421 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +534 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +217 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +375 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +158 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +947 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +214 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +428 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +494 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +291 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +158 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +120 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +144 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +79 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +381 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +135 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +280 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +276 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +165 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +571 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +196 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +256 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +564 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/README.md +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +768 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +177 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +934 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1678 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +220 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +1967 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +1986 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +376 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/operations_cpu.h +226 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/scene.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/scene.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +159 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +240 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +245 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +334 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_extensions.h +244 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +172 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +195 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_extensions.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_per_env.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1083 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cuda.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +126 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +276 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +625 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +329 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +290 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +369 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/multirotor_visual.h +135 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cpu.h +244 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cuda.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_generic.h +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +160 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +9 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +113 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +815 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +275 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +865 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +34 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +205 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +281 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +175 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +494 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1629 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.cu +523 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.h +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +164 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +213 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +367 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +385 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +85 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +270 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +276 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +218 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +866 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1833 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +646 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +221 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/inference_ios.o +0 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/libinference_ios.a +0 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +456 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +445 -0
- hyperdrone/cuda/__init__.py +78 -0
- hyperdrone/dynamics/__init__.py +22 -0
- hyperdrone/dynamics/_component.py +40 -0
- hyperdrone/dynamics/_config.py +47 -0
- hyperdrone/dynamics/_sim.py +201 -0
- hyperdrone/env/__init__.py +15 -0
- hyperdrone/env/_sampling.py +67 -0
- hyperdrone/env/_world.py +60 -0
- hyperdrone/examples/__init__.py +11 -0
- hyperdrone/examples/benchmark.py +236 -0
- hyperdrone/examples/benchmark_minimal.py +66 -0
- hyperdrone/examples/data.py +42 -0
- hyperdrone/examples/drone_flythrough.py +142 -0
- hyperdrone/examples/render_procthor.py +41 -0
- hyperdrone/jit/__init__.py +111 -0
- hyperdrone/jit/_build.py +94 -0
- hyperdrone/jit/_lock.py +23 -0
- hyperdrone/jit/_patches.py +95 -0
- hyperdrone/jit/_toolchain.py +13 -0
- hyperdrone/jit/_workspace.py +70 -0
- hyperdrone/render/__init__.py +48 -0
- hyperdrone/render/_component.py +35 -0
- hyperdrone/render/_config.py +90 -0
- hyperdrone/render/_renderer.py +306 -0
- hyperdrone/render/_scene.py +34 -0
- hyperdrone-0.1.0.dist-info/METADATA +15 -0
- hyperdrone-0.1.0.dist-info/RECORD +660 -0
- hyperdrone-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,2119 @@
|
|
|
1
|
+
#include "../../../version.h"
|
|
2
|
+
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_RL_ENVIRONMENTS_L2F_OPERATIONS_CPU_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
|
|
3
|
+
#pragma once
|
|
4
|
+
#define RL_TOOLS_RL_ENVIRONMENTS_L2F_OPERATIONS_CPU_H
|
|
5
|
+
#include "operations_generic.h"
|
|
6
|
+
|
|
7
|
+
#ifdef RL_TOOLS_ENABLE_JSON
|
|
8
|
+
#include <nlohmann/json.hpp>
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
#include <random>
|
|
12
|
+
#include <string>
|
|
13
|
+
// Why no JSON library? introduces a dependency and increases the compile time (massively in case of e.g. nlohmann::json)
|
|
14
|
+
RL_TOOLS_NAMESPACE_WRAPPER_START
|
|
15
|
+
namespace rl_tools{
|
|
16
|
+
namespace rl::environments::l2f::obs_helper{
|
|
17
|
+
template <typename DEVICE, typename ENV, typename OBS>
|
|
18
|
+
auto dispatch(DEVICE& device, const ENV& env, const OBS& obs, bool first = true);
|
|
19
|
+
}
|
|
20
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
21
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::LastComponent<OBS_SPEC>& obs, bool first = true){
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
25
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::Multiplex<OBS_SPEC>& obs, bool first = true){
|
|
26
|
+
using OBSERVATION = rl::environments::l2f::observation::Multiplex<OBS_SPEC>;
|
|
27
|
+
std::string output;
|
|
28
|
+
if constexpr(OBS_SPEC::ENABLE){
|
|
29
|
+
output += rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::CURRENT_COMPONENT{}, first);
|
|
30
|
+
first = false;
|
|
31
|
+
}
|
|
32
|
+
output += rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, first);
|
|
33
|
+
return output;
|
|
34
|
+
}
|
|
35
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
36
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::Position<OBS_SPEC>& obs, bool first = true){
|
|
37
|
+
using OBSERVATION = rl::environments::l2f::observation::Position<OBS_SPEC>;
|
|
38
|
+
return std::string(first ? "" : ".") + "Position" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
39
|
+
}
|
|
40
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
41
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::OrientationQuaternion<OBS_SPEC>& obs, bool first = true){
|
|
42
|
+
using OBSERVATION = rl::environments::l2f::observation::OrientationQuaternion<OBS_SPEC>;
|
|
43
|
+
return std::string(first ? "" : ".") + "OrientationQuaternion" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
44
|
+
}
|
|
45
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
46
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::OrientationRotationMatrix<OBS_SPEC>& obs, bool first = true){
|
|
47
|
+
using OBSERVATION = rl::environments::l2f::observation::OrientationRotationMatrix<OBS_SPEC>;
|
|
48
|
+
return std::string(first ? "" : ".") + "OrientationRotationMatrix" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
49
|
+
}
|
|
50
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
51
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::OrientationWorldZ<OBS_SPEC>& obs, bool first = true){
|
|
52
|
+
using OBSERVATION = rl::environments::l2f::observation::OrientationWorldZ<OBS_SPEC>;
|
|
53
|
+
return std::string(first ? "" : ".") + "OrientationWorldZ" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
54
|
+
}
|
|
55
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
56
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::OrientationMahonyWorldZ<OBS_SPEC>& obs, bool first = true){
|
|
57
|
+
using OBSERVATION = rl::environments::l2f::observation::OrientationMahonyWorldZ<OBS_SPEC>;
|
|
58
|
+
return std::string(first ? "" : ".") + "OrientationMahonyWorldZ" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
59
|
+
}
|
|
60
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
61
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::LinearVelocity<OBS_SPEC>& obs, bool first = true){
|
|
62
|
+
using OBSERVATION = rl::environments::l2f::observation::LinearVelocity<OBS_SPEC>;
|
|
63
|
+
return std::string(first ? "" : ".") + "LinearVelocity" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
64
|
+
}
|
|
65
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
66
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::AngularVelocity<OBS_SPEC>& obs, bool first = true){
|
|
67
|
+
using OBSERVATION = rl::environments::l2f::observation::AngularVelocity<OBS_SPEC>;
|
|
68
|
+
return std::string(first ? "" : ".") + "AngularVelocity" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
69
|
+
}
|
|
70
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
71
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::LinearAccelerationBodyFrame<OBS_SPEC>& obs, bool first = true){
|
|
72
|
+
using OBSERVATION = rl::environments::l2f::observation::LinearAccelerationBodyFrame<OBS_SPEC>;
|
|
73
|
+
return std::string(first ? "" : ".") + "LinearAccelerationBodyFrame" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
74
|
+
}
|
|
75
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
76
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::LinearAccelerationBodyFrameHistory<OBS_SPEC>& obs, bool first = true){
|
|
77
|
+
using OBSERVATION = rl::environments::l2f::observation::LinearAccelerationBodyFrameHistory<OBS_SPEC>;
|
|
78
|
+
return std::string(first ? "" : ".") + "LinearAccelerationBodyFrameHistory(" + std::to_string(OBSERVATION::HISTORY_LENGTH) + ")" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
79
|
+
}
|
|
80
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
81
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::LinearVelocityBodyFrame<OBS_SPEC>& obs, bool first = true){
|
|
82
|
+
using OBSERVATION = rl::environments::l2f::observation::LinearVelocityBodyFrame<OBS_SPEC>;
|
|
83
|
+
return std::string(first ? "" : ".") + "LinearVelocityBodyFrame" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
84
|
+
}
|
|
85
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
86
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::Magnetometer<OBS_SPEC>& obs, bool first = true){
|
|
87
|
+
using OBSERVATION = rl::environments::l2f::observation::Magnetometer<OBS_SPEC>;
|
|
88
|
+
return std::string(first ? "" : ".") + "Magnetometer" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
89
|
+
}
|
|
90
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
91
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::AngularVelocityDelayed<OBS_SPEC>& obs, bool first = true){
|
|
92
|
+
using OBSERVATION = rl::environments::l2f::observation::AngularVelocityDelayed<OBS_SPEC>;
|
|
93
|
+
return std::string(first ? "" : ".") + "AngularVelocityDelayed(" + std::to_string(OBS_SPEC::DELAY) + ")" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
94
|
+
}
|
|
95
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
96
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::PoseIntegral<OBS_SPEC>& obs, bool first = true){
|
|
97
|
+
using OBSERVATION = rl::environments::l2f::observation::PoseIntegral<OBS_SPEC>;
|
|
98
|
+
return std::string(first ? "" : ".") + "PoseIntegral" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
99
|
+
}
|
|
100
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
101
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::RotorSpeeds<OBS_SPEC>& obs, bool first = true){
|
|
102
|
+
using OBSERVATION = rl::environments::l2f::observation::RotorSpeeds<OBS_SPEC>;
|
|
103
|
+
return std::string(first ? "" : ".") + "RotorSpeeds" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
104
|
+
}
|
|
105
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
106
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::ActionHistory<OBS_SPEC>& obs, bool first = true){
|
|
107
|
+
using OBSERVATION = rl::environments::l2f::observation::ActionHistory<OBS_SPEC>;
|
|
108
|
+
return std::string(first ? "" : ".") + "ActionHistory(" + std::to_string(OBSERVATION::HISTORY_LENGTH) + ")" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
109
|
+
}
|
|
110
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
111
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::RandomForce<OBS_SPEC>& obs, bool first = true){
|
|
112
|
+
using OBSERVATION = rl::environments::l2f::observation::RandomForce<OBS_SPEC>;
|
|
113
|
+
return std::string(first ? "" : ".") + "RandomForce" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
114
|
+
}
|
|
115
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
116
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::ParametersMotorPosition<OBS_SPEC>& obs, bool first = true){
|
|
117
|
+
using OBSERVATION = rl::environments::l2f::observation::ParametersMotorPosition<OBS_SPEC>;
|
|
118
|
+
return std::string(first ? "" : ".") + "ParametersMotorPosition" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
119
|
+
}
|
|
120
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
121
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::ParametersThrustCurves<OBS_SPEC>& obs, bool first = true){
|
|
122
|
+
using OBSERVATION = rl::environments::l2f::observation::ParametersThrustCurves<OBS_SPEC>;
|
|
123
|
+
return std::string(first ? "" : ".") + "ParametersThrustCurves" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
124
|
+
}
|
|
125
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
126
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::ParametersMass<OBS_SPEC>& obs, bool first = true){
|
|
127
|
+
using OBSERVATION = rl::environments::l2f::observation::ParametersMass<OBS_SPEC>;
|
|
128
|
+
return std::string(first ? "" : ".") + "ParametersMass" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
129
|
+
}
|
|
130
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
131
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::ParametersInertia<OBS_SPEC>& obs, bool first = true){
|
|
132
|
+
using OBSERVATION = rl::environments::l2f::observation::ParametersInertia<OBS_SPEC>;
|
|
133
|
+
return std::string(first ? "" : ".") + "ParametersInertia" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
134
|
+
}
|
|
135
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
136
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::TrajectoryTrackingPosition<OBS_SPEC>& obs, bool first = true){
|
|
137
|
+
using OBSERVATION = rl::environments::l2f::observation::TrajectoryTrackingPosition<OBS_SPEC>;
|
|
138
|
+
return std::string(first ? "" : ".") + "TrajectoryTrackingPosition" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
139
|
+
}
|
|
140
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
141
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::TrajectoryTrackingLinearVelocity<OBS_SPEC>& obs, bool first = true){
|
|
142
|
+
using OBSERVATION = rl::environments::l2f::observation::TrajectoryTrackingLinearVelocity<OBS_SPEC>;
|
|
143
|
+
return std::string(first ? "" : ".") + "TrajectoryTrackingLinearVelocity" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
144
|
+
}
|
|
145
|
+
template <typename DEVICE, typename SPEC, typename OBS_SPEC>
|
|
146
|
+
std::string string(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::observation::TrajectoryTrackingLookahead<OBS_SPEC>& obs, bool first = true){
|
|
147
|
+
using OBSERVATION = rl::environments::l2f::observation::TrajectoryTrackingLookahead<OBS_SPEC>;
|
|
148
|
+
return std::string(first ? "" : ".") + "TrajectoryTrackingLookahead(" + std::to_string(OBS_SPEC::N_STEPS) + ", " + std::to_string(OBS_SPEC::INTERVAL) + ")" + rl::environments::l2f::obs_helper::dispatch(device, env, typename OBSERVATION::NEXT_COMPONENT{}, false);
|
|
149
|
+
}
|
|
150
|
+
namespace rl::environments::l2f::obs_helper{
|
|
151
|
+
template <typename DEVICE, typename ENV, typename OBS>
|
|
152
|
+
auto dispatch(DEVICE& device, const ENV& env, const OBS& obs, bool first){
|
|
153
|
+
return string(device, env, obs, first);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
template <typename DEVICE, typename SPEC>
|
|
157
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env){
|
|
158
|
+
using ENVIRONMENT = rl::environments::Multirotor<SPEC>;
|
|
159
|
+
std::string json_string = "{";
|
|
160
|
+
json_string += "\"name\": \"l2f\",";
|
|
161
|
+
json_string += "\"observation\": \"";
|
|
162
|
+
json_string += rl_tools::string(device, env, typename ENVIRONMENT::Observation{});
|
|
163
|
+
json_string += "\"}";
|
|
164
|
+
return json_string;
|
|
165
|
+
}
|
|
166
|
+
template <typename DEVICE, typename SPEC, typename T_T, typename T_TI, T_TI N>
|
|
167
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::Dynamics<T_T, T_TI, N>& parameters){
|
|
168
|
+
using T = typename SPEC::T;
|
|
169
|
+
using TI = typename DEVICE::index_t;
|
|
170
|
+
|
|
171
|
+
std::string json_string = "{";
|
|
172
|
+
json_string += "\"rotor_positions\": [";
|
|
173
|
+
for (TI i = 0; i < N; i++){
|
|
174
|
+
json_string += "[" + std::to_string(parameters.rotor_positions[i][0]) + ", " + std::to_string(parameters.rotor_positions[i][1]) + ", " + std::to_string(parameters.rotor_positions[i][2]) + "]";
|
|
175
|
+
if (i < N - 1) {
|
|
176
|
+
json_string += ", ";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
json_string += "], ";
|
|
180
|
+
|
|
181
|
+
json_string += "\"rotor_thrust_directions\": [";
|
|
182
|
+
for (TI i = 0; i < N; i++){
|
|
183
|
+
json_string += "[" + std::to_string(parameters.rotor_thrust_directions[i][0]) + ", " + std::to_string(parameters.rotor_thrust_directions[i][1]) + ", " + std::to_string(parameters.rotor_thrust_directions[i][2]) + "]";
|
|
184
|
+
if (i < N - 1) {
|
|
185
|
+
json_string += ", ";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
json_string += "], ";
|
|
189
|
+
|
|
190
|
+
json_string += "\"rotor_torque_directions\": [";
|
|
191
|
+
for (TI i = 0; i < N; i++){
|
|
192
|
+
json_string += "[" + std::to_string(parameters.rotor_torque_directions[i][0]) + ", " + std::to_string(parameters.rotor_torque_directions[i][1]) + ", " + std::to_string(parameters.rotor_torque_directions[i][2]) + "]";
|
|
193
|
+
if (i < N - 1) {
|
|
194
|
+
json_string += ", ";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
json_string += "], ";
|
|
198
|
+
|
|
199
|
+
json_string += "\"rotor_thrust_coefficients\": [";
|
|
200
|
+
for (TI i = 0; i < N; i++){
|
|
201
|
+
json_string += "[" + std::to_string(parameters.rotor_thrust_coefficients[i][0]) + ", " + std::to_string(parameters.rotor_thrust_coefficients[i][1]) + ", " + std::to_string(parameters.rotor_thrust_coefficients[i][2]) + "]";
|
|
202
|
+
if (i < N - 1) {
|
|
203
|
+
json_string += ", ";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
json_string += "], ";
|
|
207
|
+
|
|
208
|
+
json_string += "\"rotor_torque_constants\": [";
|
|
209
|
+
for (TI i = 0; i < N; i++){
|
|
210
|
+
json_string += std::to_string(parameters.rotor_torque_constants[i]);
|
|
211
|
+
if (i < N - 1) {
|
|
212
|
+
json_string += ", ";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
json_string += "], ";
|
|
216
|
+
|
|
217
|
+
json_string += "\"rotor_time_constants_rising\": [";
|
|
218
|
+
for (TI i = 0; i < N; i++){
|
|
219
|
+
json_string += std::to_string(parameters.rotor_time_constants_rising[i]);
|
|
220
|
+
if (i < N - 1) {
|
|
221
|
+
json_string += ", ";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
json_string += "], ";
|
|
225
|
+
|
|
226
|
+
json_string += "\"rotor_time_constants_falling\": [";
|
|
227
|
+
for (TI i = 0; i < N; i++){
|
|
228
|
+
json_string += std::to_string(parameters.rotor_time_constants_falling[i]);
|
|
229
|
+
if (i < N - 1) {
|
|
230
|
+
json_string += ", ";
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
json_string += "], ";
|
|
234
|
+
|
|
235
|
+
json_string += "\"mass\": " + std::to_string(parameters.mass) + ", ";
|
|
236
|
+
json_string += "\"gravity\": [" + std::to_string(parameters.gravity[0]) + ", " + std::to_string(parameters.gravity[1]) + ", " + std::to_string(parameters.gravity[2]) + "], ";
|
|
237
|
+
|
|
238
|
+
json_string += "\"J\": [";
|
|
239
|
+
for (TI i = 0; i < 3; i++) {
|
|
240
|
+
json_string += "[" + std::to_string(parameters.J[i][0]) + ", " + std::to_string(parameters.J[i][1]) + ", " + std::to_string(parameters.J[i][2]) + "]";
|
|
241
|
+
if (i < 2) {
|
|
242
|
+
json_string += ", ";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
json_string += "], ";
|
|
246
|
+
|
|
247
|
+
json_string += "\"J_inv\": [";
|
|
248
|
+
for (TI i = 0; i < 3; i++) {
|
|
249
|
+
json_string += "[" + std::to_string(parameters.J_inv[i][0]) + ", " + std::to_string(parameters.J_inv[i][1]) + ", " + std::to_string(parameters.J_inv[i][2]) + "]";
|
|
250
|
+
if (i < 2) {
|
|
251
|
+
json_string += ", ";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
json_string += "], ";
|
|
255
|
+
|
|
256
|
+
json_string += "\"hovering_throttle_relative\": " + std::to_string(parameters.hovering_throttle_relative) + ", ";
|
|
257
|
+
json_string += "\"action_limit\": {";
|
|
258
|
+
json_string += "\"min\": " + std::to_string(parameters.action_limit.min) + ", ";
|
|
259
|
+
json_string += "\"max\": " + std::to_string(parameters.action_limit.max);
|
|
260
|
+
json_string += "}"; // closing action_limit
|
|
261
|
+
json_string += "}"; // closing main JSON
|
|
262
|
+
return json_string;
|
|
263
|
+
}
|
|
264
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
265
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::IMU<T>& parameters) {
|
|
266
|
+
std::string json_string = "{";
|
|
267
|
+
json_string += "\"gyro_bias\": {";
|
|
268
|
+
json_string += "\"init_max\": " + std::to_string(parameters.gyro_bias.init_max) + ", ";
|
|
269
|
+
json_string += "\"tau\": " + std::to_string(parameters.gyro_bias.tau) + ", ";
|
|
270
|
+
json_string += "\"sigma\": " + std::to_string(parameters.gyro_bias.sigma);
|
|
271
|
+
json_string += "}";
|
|
272
|
+
json_string += "}";
|
|
273
|
+
return json_string;
|
|
274
|
+
}
|
|
275
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
276
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::CTBRController<T>& parameters) {
|
|
277
|
+
std::string json_string = "{";
|
|
278
|
+
json_string += "\"thrust_min\": " + std::to_string(parameters.thrust_min) + ", ";
|
|
279
|
+
json_string += "\"thrust_max\": " + std::to_string(parameters.thrust_max) + ", ";
|
|
280
|
+
json_string += "\"rate_limit\": [" + std::to_string(parameters.rate_limit[0]) + ", " + std::to_string(parameters.rate_limit[1]) + ", " + std::to_string(parameters.rate_limit[2]) + "], ";
|
|
281
|
+
json_string += "\"kp\": [" + std::to_string(parameters.kp[0]) + ", " + std::to_string(parameters.kp[1]) + ", " + std::to_string(parameters.kp[2]) + "], ";
|
|
282
|
+
json_string += "\"kd\": [" + std::to_string(parameters.kd[0]) + ", " + std::to_string(parameters.kd[1]) + ", " + std::to_string(parameters.kd[2]) + "], ";
|
|
283
|
+
json_string += "\"torque_limit\": [" + std::to_string(parameters.torque_limit[0]) + ", " + std::to_string(parameters.torque_limit[1]) + ", " + std::to_string(parameters.torque_limit[2]) + "]";
|
|
284
|
+
json_string += "}";
|
|
285
|
+
return json_string;
|
|
286
|
+
}
|
|
287
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
288
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::Integration<PARAM_SPEC>& parameters) {
|
|
289
|
+
return std::string("{\"dt\": ") + std::to_string(parameters.dt) + "}";
|
|
290
|
+
}
|
|
291
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
292
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::Initialization<PARAM_SPEC>& parameters) {
|
|
293
|
+
std::string json_string = "{";
|
|
294
|
+
json_string += "\"guidance\": " + std::to_string(parameters.guidance) + ", ";
|
|
295
|
+
json_string += "\"max_position\": " + std::to_string(parameters.max_position) + ", ";
|
|
296
|
+
json_string += "\"max_angle\": " + std::to_string(parameters.max_angle) + ", ";
|
|
297
|
+
json_string += "\"max_linear_velocity\": " + std::to_string(parameters.max_linear_velocity) + ", ";
|
|
298
|
+
json_string += "\"max_angular_velocity\": " + std::to_string(parameters.max_angular_velocity) + ", ";
|
|
299
|
+
json_string += "\"relative_rpm\": " + std::string(parameters.relative_rpm ? "true" : "false") + ", ";
|
|
300
|
+
json_string += "\"min_rpm\": " + std::to_string(parameters.min_rpm) + ", ";
|
|
301
|
+
json_string += "\"max_rpm\": " + std::to_string(parameters.max_rpm);
|
|
302
|
+
json_string += "}";
|
|
303
|
+
return json_string;
|
|
304
|
+
}
|
|
305
|
+
template <typename DEVICE, typename SPEC, typename T, unsigned T_ACTION_DIM>
|
|
306
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::reward_functions::Squared<T, T_ACTION_DIM>& parameters) {
|
|
307
|
+
std::string json_string = "{";
|
|
308
|
+
json_string += "\"non_negative\": " + std::string(parameters.non_negative ? "true" : "false") + ", ";
|
|
309
|
+
json_string += "\"scale\": " + std::to_string(parameters.scale) + ", ";
|
|
310
|
+
json_string += "\"constant\": " + std::to_string(parameters.constant) + ", ";
|
|
311
|
+
json_string += "\"termination_penalty\": " + std::to_string(parameters.termination_penalty) + ", ";
|
|
312
|
+
json_string += "\"position\": " + std::to_string(parameters.position) + ", ";
|
|
313
|
+
json_string += "\"position_clip\": " + std::to_string(parameters.position_clip) + ", ";
|
|
314
|
+
json_string += "\"orientation\": " + std::to_string(parameters.orientation) + ", ";
|
|
315
|
+
json_string += "\"linear_velocity\": " + std::to_string(parameters.linear_velocity) + ", ";
|
|
316
|
+
json_string += "\"angular_velocity\": " + std::to_string(parameters.angular_velocity) + ", ";
|
|
317
|
+
json_string += "\"linear_acceleration\": " + std::to_string(parameters.linear_acceleration) + ", ";
|
|
318
|
+
json_string += "\"angular_acceleration\": " + std::to_string(parameters.angular_acceleration) + ", ";
|
|
319
|
+
json_string += "\"action\": [";
|
|
320
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
321
|
+
json_string += std::to_string(parameters.action[action_i]);
|
|
322
|
+
if(action_i + 1 < T_ACTION_DIM){
|
|
323
|
+
json_string += ", ";
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
json_string += "], ";
|
|
327
|
+
json_string += "\"d_action\": [";
|
|
328
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
329
|
+
json_string += std::to_string(parameters.d_action[action_i]);
|
|
330
|
+
if(action_i + 1 < T_ACTION_DIM){
|
|
331
|
+
json_string += ", ";
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
json_string += "], ";
|
|
335
|
+
json_string += "\"position_error_integral\": " + std::to_string(parameters.position_error_integral);
|
|
336
|
+
json_string += "}";
|
|
337
|
+
return json_string;
|
|
338
|
+
}
|
|
339
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
340
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::Termination<PARAM_SPEC>& parameters) {
|
|
341
|
+
std::string json_string = "{";
|
|
342
|
+
json_string += "\"enabled\": " + std::string(parameters.enabled ? "true" : "false") + ", ";
|
|
343
|
+
json_string += "\"position_threshold\": " + std::to_string(parameters.position_threshold) + ", ";
|
|
344
|
+
json_string += "\"angle_threshold\": " + std::to_string(parameters.angle_threshold) + ", ";
|
|
345
|
+
json_string += "\"linear_velocity_threshold\": " + std::to_string(parameters.linear_velocity_threshold) + ", ";
|
|
346
|
+
json_string += "\"angular_velocity_threshold\": " + std::to_string(parameters.angular_velocity_threshold) + ", ";
|
|
347
|
+
json_string += "\"position_integral_threshold\": " + std::to_string(parameters.position_integral_threshold) + ", ";
|
|
348
|
+
json_string += "\"orientation_integral_threshold\": " + std::to_string(parameters.orientation_integral_threshold);
|
|
349
|
+
json_string += "}";
|
|
350
|
+
return json_string;
|
|
351
|
+
}
|
|
352
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
353
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::ObservationNoise<PARAM_SPEC>& parameters) {
|
|
354
|
+
std::string json_string = "{";
|
|
355
|
+
json_string += "\"position\": " + std::to_string(parameters.position) + ", ";
|
|
356
|
+
json_string += "\"orientation\": " + std::to_string(parameters.orientation) + ", ";
|
|
357
|
+
json_string += "\"linear_velocity\": " + std::to_string(parameters.linear_velocity) + ", ";
|
|
358
|
+
json_string += "\"angular_velocity\": " + std::to_string(parameters.angular_velocity) + ", ";
|
|
359
|
+
json_string += "\"imu_acceleration\": " + std::to_string(parameters.imu_acceleration);
|
|
360
|
+
json_string += "}";
|
|
361
|
+
return json_string;
|
|
362
|
+
}
|
|
363
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
364
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::ActionNoise<PARAM_SPEC>& parameters) {
|
|
365
|
+
std::string json_string = "{";
|
|
366
|
+
json_string += "\"normalized_rpm\": " + std::to_string(parameters.normalized_rpm);
|
|
367
|
+
json_string += "}";
|
|
368
|
+
return json_string;
|
|
369
|
+
}
|
|
370
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
371
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::MDP<PARAM_SPEC>& parameters) {
|
|
372
|
+
std::string json_string = "{";
|
|
373
|
+
json_string += "\"init\": " + json(device, env, parameters.init) + ", ";
|
|
374
|
+
json_string += "\"reward\": " + json(device, env, parameters.reward) + ", ";
|
|
375
|
+
json_string += "\"observation_noise\": " + json(device, env, parameters.observation_noise) + ", ";
|
|
376
|
+
json_string += "\"action_noise\": " + json(device, env, parameters.action_noise) + ", ";
|
|
377
|
+
json_string += "\"termination\": " + json(device, env, parameters.termination);
|
|
378
|
+
json_string += "}";
|
|
379
|
+
return json_string;
|
|
380
|
+
}
|
|
381
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
382
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersBase<PARAM_SPEC>& parameters, bool top_level=true){
|
|
383
|
+
using T = typename SPEC::T;
|
|
384
|
+
using TI = typename DEVICE::index_t;
|
|
385
|
+
std::string json_string = top_level ? "{" : "";
|
|
386
|
+
json_string += "\"dynamics\": " + json(device, env, parameters.dynamics) + ", ";
|
|
387
|
+
json_string += "\"integration\": " + json(device, env, parameters.integration) + ", ";
|
|
388
|
+
json_string += "\"mdp\": " + json(device, env, parameters.mdp);
|
|
389
|
+
json_string += top_level ? "}" : "";
|
|
390
|
+
return json_string;
|
|
391
|
+
}
|
|
392
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
393
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::Disturbances<PARAM_SPEC>& parameters) {
|
|
394
|
+
std::string json_string = "{";
|
|
395
|
+
json_string += "\"random_force\": {";
|
|
396
|
+
json_string += "\"mean\": " + std::to_string(parameters.random_force.mean) + ", ";
|
|
397
|
+
json_string += "\"std\": " + std::to_string(parameters.random_force.std);
|
|
398
|
+
json_string += "}, ";
|
|
399
|
+
json_string += "\"random_torque\": {";
|
|
400
|
+
json_string += "\"mean\": " + std::to_string(parameters.random_torque.mean) + ", ";
|
|
401
|
+
json_string += "\"std\": " + std::to_string(parameters.random_torque.std);
|
|
402
|
+
json_string += "}";
|
|
403
|
+
json_string += "}";
|
|
404
|
+
return json_string;
|
|
405
|
+
}
|
|
406
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
407
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersDisturbances<PARAM_SPEC>& parameters, bool top_level=true){
|
|
408
|
+
using T = typename SPEC::T;
|
|
409
|
+
using TI = typename DEVICE::index_t;
|
|
410
|
+
std::string json_string = top_level ? "{" : "";
|
|
411
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
412
|
+
json_string += ", \"disturbances\": " + json(device, env, parameters.disturbances);
|
|
413
|
+
json_string += (top_level ? "}" : "");
|
|
414
|
+
return json_string;
|
|
415
|
+
}
|
|
416
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
417
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersIMU<PARAM_SPEC>& parameters, bool top_level=true){
|
|
418
|
+
std::string json_string = top_level ? "{" : "";
|
|
419
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
420
|
+
json_string += ", \"imu\": " + json(device, env, parameters.imu);
|
|
421
|
+
json_string += (top_level ? "}" : "");
|
|
422
|
+
return json_string;
|
|
423
|
+
}
|
|
424
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
425
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersCTBRController<PARAM_SPEC>& parameters, bool top_level=true){
|
|
426
|
+
std::string json_string = top_level ? "{" : "";
|
|
427
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
428
|
+
json_string += ", \"ctbr_controller\": " + json(device, env, parameters.ctbr_controller);
|
|
429
|
+
json_string += (top_level ? "}" : "");
|
|
430
|
+
return json_string;
|
|
431
|
+
}
|
|
432
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
433
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::DomainRandomization<PARAM_SPEC>& parameters) {
|
|
434
|
+
std::string json_string = "{";
|
|
435
|
+
json_string += "\"thrust_to_weight_min\": " + std::to_string(parameters.thrust_to_weight_min) + ", ";
|
|
436
|
+
json_string += "\"thrust_to_weight_max\": " + std::to_string(parameters.thrust_to_weight_max) + ", ";
|
|
437
|
+
json_string += "\"torque_to_inertia_min\": " + std::to_string(parameters.torque_to_inertia_min) + ", ";
|
|
438
|
+
json_string += "\"torque_to_inertia_max\": " + std::to_string(parameters.torque_to_inertia_max) + ", ";
|
|
439
|
+
json_string += "\"mass_min\": " + std::to_string(parameters.mass_min) + ", ";
|
|
440
|
+
json_string += "\"mass_max\": " + std::to_string(parameters.mass_max) + ", ";
|
|
441
|
+
json_string += "\"mass_size_deviation\": " + std::to_string(parameters.mass_size_deviation) + ", ";
|
|
442
|
+
json_string += "\"rotor_time_constant_rising_min\": " + std::to_string(parameters.rotor_time_constant_rising_min) + ", ";
|
|
443
|
+
json_string += "\"rotor_time_constant_rising_max\": " + std::to_string(parameters.rotor_time_constant_rising_max) + ", ";
|
|
444
|
+
json_string += "\"rotor_time_constant_falling_min\": " + std::to_string(parameters.rotor_time_constant_falling_min) + ", ";
|
|
445
|
+
json_string += "\"rotor_time_constant_falling_max\": " + std::to_string(parameters.rotor_time_constant_falling_max) + ", ";
|
|
446
|
+
json_string += "\"rotor_torque_constant_min\": " + std::to_string(parameters.rotor_torque_constant_min) + ", ";
|
|
447
|
+
json_string += "\"rotor_torque_constant_max\": " + std::to_string(parameters.rotor_torque_constant_max) + ", ";
|
|
448
|
+
json_string += "\"orientation_offset_angle_max\": " + std::to_string(parameters.orientation_offset_angle_max) + ", ";
|
|
449
|
+
json_string += "\"disturbance_force_max\": " + std::to_string(parameters.disturbance_force_max);
|
|
450
|
+
json_string += "}";
|
|
451
|
+
return json_string;
|
|
452
|
+
}
|
|
453
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
454
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersDomainRandomization<PARAM_SPEC>& parameters, bool top_level=true){
|
|
455
|
+
std::string json_string = top_level ? "{" : "";
|
|
456
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
457
|
+
json_string += ", \"domain_randomization\": " + json(device, env, parameters.domain_randomization);
|
|
458
|
+
json_string += (top_level ? "}" : "");
|
|
459
|
+
return json_string;
|
|
460
|
+
}
|
|
461
|
+
template <typename DEVICE, typename SPEC, typename TRAJ_SPEC>
|
|
462
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::trajectories::Trajectory<TRAJ_SPEC>& parameters) {
|
|
463
|
+
using TI = typename DEVICE::index_t;
|
|
464
|
+
using TRAJECTORY = rl::environments::l2f::parameters::trajectories::Trajectory<TRAJ_SPEC>;
|
|
465
|
+
std::string json_string = "{";
|
|
466
|
+
json_string += "\"LENGTH\": " + std::to_string(TRAJECTORY::LENGTH) + ", ";
|
|
467
|
+
json_string += "\"DT\": " + std::to_string(TRAJECTORY::DT) + ", ";
|
|
468
|
+
json_string += "\"steps\": [";
|
|
469
|
+
for (TI step_i=0; step_i < TRAJECTORY::LENGTH; ++step_i){
|
|
470
|
+
json_string += "{";
|
|
471
|
+
json_string += "\"position\": [" + std::to_string(parameters.steps[step_i].position[0]) + ", " + std::to_string(parameters.steps[step_i].position[1]) + ", " + std::to_string(parameters.steps[step_i].position[2]) + "], ";
|
|
472
|
+
json_string += "\"yaw\": " + std::to_string(parameters.steps[step_i].yaw) + ", ";
|
|
473
|
+
json_string += "\"linear_velocity\": [" + std::to_string(parameters.steps[step_i].linear_velocity[0]) + ", " + std::to_string(parameters.steps[step_i].linear_velocity[1]) + ", " + std::to_string(parameters.steps[step_i].linear_velocity[2]) + "], ";
|
|
474
|
+
json_string += "\"yaw_velocity\": " + std::to_string(parameters.steps[step_i].yaw_velocity);
|
|
475
|
+
json_string += "}";
|
|
476
|
+
json_string += (step_i < TRAJECTORY::LENGTH-1 ? ", " : "");
|
|
477
|
+
}
|
|
478
|
+
json_string += "]";
|
|
479
|
+
json_string += "}";
|
|
480
|
+
return json_string;
|
|
481
|
+
}
|
|
482
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
483
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::trajectories::lissajous::Parameters<T>& parameters) {
|
|
484
|
+
std::string json_string = "{";
|
|
485
|
+
json_string += "\"A\": " + std::to_string(parameters.A) + ", ";
|
|
486
|
+
json_string += "\"B\": " + std::to_string(parameters.B) + ", ";
|
|
487
|
+
json_string += "\"C\": " + std::to_string(parameters.C) + ", ";
|
|
488
|
+
json_string += "\"a\": " + std::to_string(parameters.a) + ", ";
|
|
489
|
+
json_string += "\"b\": " + std::to_string(parameters.b) + ", ";
|
|
490
|
+
json_string += "\"c\": " + std::to_string(parameters.c) + ", ";
|
|
491
|
+
json_string += "\"interval\": " + std::to_string(parameters.interval) + ", ";
|
|
492
|
+
json_string += "\"ramp_duration\": " + std::to_string(parameters.ramp_duration);
|
|
493
|
+
json_string += "}";
|
|
494
|
+
return json_string;
|
|
495
|
+
}
|
|
496
|
+
template <typename DEVICE, typename SPEC, typename TRAJ_PARAM_SPEC>
|
|
497
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::trajectories::TaggedParameters<TRAJ_PARAM_SPEC>& parameters) {
|
|
498
|
+
std::string json_string = "{";
|
|
499
|
+
if (parameters.type == rl::environments::l2f::parameters::trajectories::Type::LISSAJOUS) {
|
|
500
|
+
json_string += "\"type\": \"LISSAJOUS\", ";
|
|
501
|
+
json_string += "\"lissajous\": " + json(device, env, parameters.parameters.lissajous);
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
utils::assert_exit(device, false, "L2F json export: Unknown trajectory_parameters type");
|
|
505
|
+
}
|
|
506
|
+
json_string += "}";
|
|
507
|
+
return json_string;
|
|
508
|
+
}
|
|
509
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
510
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersTrajectory<PARAM_SPEC>& parameters, bool top_level=true){
|
|
511
|
+
std::string json_string = top_level ? "{" : "";
|
|
512
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
513
|
+
json_string += ", \"trajectory\": " + json(device, env, parameters.trajectory);
|
|
514
|
+
json_string += ", \"trajectory_parameters\": " + json(device, env, parameters.trajectory_parameters);
|
|
515
|
+
json_string += (top_level ? "}" : "");
|
|
516
|
+
return json_string;
|
|
517
|
+
}
|
|
518
|
+
template <typename DEVICE, typename SPEC, typename T, typename TI>
|
|
519
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::parameters::ObservationDelay<T, TI>& parameters) {
|
|
520
|
+
std::string json_string = "{";
|
|
521
|
+
json_string += "\"linear_velocity\": " + std::to_string(parameters.linear_velocity) + ", ";
|
|
522
|
+
json_string += "\"angular_velocity\": " + std::to_string(parameters.angular_velocity);
|
|
523
|
+
json_string += "}";
|
|
524
|
+
return json_string;
|
|
525
|
+
}
|
|
526
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
527
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const rl::environments::l2f::ParametersObservationDelay<PARAM_SPEC>& parameters, bool top_level=true){
|
|
528
|
+
std::string json_string = top_level ? "{" : "";
|
|
529
|
+
json_string += json(device, env, static_cast<const typename PARAM_SPEC::NEXT_COMPONENT&>(parameters), false);
|
|
530
|
+
json_string += ", \"observation_delay\": " + json(device, env, parameters.observation_delay);
|
|
531
|
+
json_string += (top_level ? "}" : "");
|
|
532
|
+
return json_string;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
536
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateBase<STATE_SPEC>& state, bool top_level=true){
|
|
537
|
+
std::string json_string = top_level ? "{" : "";
|
|
538
|
+
json_string += "\"position\": [" + std::to_string(state.position[0]) + ", " + std::to_string(state.position[1]) + ", " + std::to_string(state.position[2]) + "], ";
|
|
539
|
+
json_string += "\"orientation\": [" + std::to_string(state.orientation[0]) + ", " + std::to_string(state.orientation[1]) + ", " + std::to_string(state.orientation[2]) + ", " + std::to_string(state.orientation[3]) + "], ";
|
|
540
|
+
json_string += "\"linear_velocity\": [" + std::to_string(state.linear_velocity[0]) + ", " + std::to_string(state.linear_velocity[1]) + ", " + std::to_string(state.linear_velocity[2]) + "], ";
|
|
541
|
+
json_string += "\"angular_velocity\": [" + std::to_string(state.angular_velocity[0]) + ", " + std::to_string(state.angular_velocity[1]) + ", " + std::to_string(state.angular_velocity[2]) + "]";
|
|
542
|
+
json_string += top_level ? "}" : "";
|
|
543
|
+
return json_string;
|
|
544
|
+
}
|
|
545
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
546
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateLastAction<STATE_SPEC>& state, bool top_level=true){
|
|
547
|
+
using TI = typename DEVICE::index_t;
|
|
548
|
+
std::string json_string = top_level ? "{" : "";
|
|
549
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
550
|
+
json_string += "\"last_action\": [";
|
|
551
|
+
for (TI action_i = 0; action_i < SPEC::PARAMETERS::N; action_i++){
|
|
552
|
+
json_string += std::to_string(state.last_action[action_i]);
|
|
553
|
+
if (action_i < SPEC::PARAMETERS::N - 1) {
|
|
554
|
+
json_string += ", ";
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
json_string += "]";
|
|
558
|
+
json_string += top_level ? "}" : "";
|
|
559
|
+
return json_string;
|
|
560
|
+
}
|
|
561
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
562
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateLinearAcceleration<STATE_SPEC>& state, bool top_level=true){
|
|
563
|
+
using TI = typename DEVICE::index_t;
|
|
564
|
+
std::string json_string = top_level ? "{" : "";
|
|
565
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
566
|
+
json_string += "\"linear_acceleration\": [";
|
|
567
|
+
for (TI i = 0; i < 3; i++){
|
|
568
|
+
json_string += std::to_string(state.linear_acceleration[i]);
|
|
569
|
+
if (i < 2) {
|
|
570
|
+
json_string += ", ";
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
json_string += "]";
|
|
574
|
+
json_string += top_level ? "}" : "";
|
|
575
|
+
return json_string;
|
|
576
|
+
}
|
|
577
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
578
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateGyroBias<STATE_SPEC>& state, bool top_level=true){
|
|
579
|
+
using TI = typename DEVICE::index_t;
|
|
580
|
+
std::string json_string = top_level ? "{" : "";
|
|
581
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
582
|
+
json_string += "\"gyro_bias\": [";
|
|
583
|
+
for (TI i = 0; i < 3; i++){
|
|
584
|
+
json_string += std::to_string(state.gyro_bias[i]);
|
|
585
|
+
if (i < 2) {
|
|
586
|
+
json_string += ", ";
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
json_string += "]";
|
|
590
|
+
json_string += top_level ? "}" : "";
|
|
591
|
+
return json_string;
|
|
592
|
+
}
|
|
593
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
594
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateMahony<STATE_SPEC>& state, bool top_level=true){
|
|
595
|
+
using TI = typename DEVICE::index_t;
|
|
596
|
+
std::string json_string = top_level ? "{" : "";
|
|
597
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
598
|
+
json_string += "\"q_estimate\": [";
|
|
599
|
+
for (TI i = 0; i < 4; i++){
|
|
600
|
+
json_string += std::to_string(state.q_estimate[i]);
|
|
601
|
+
if (i < 3) {
|
|
602
|
+
json_string += ", ";
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
json_string += "], ";
|
|
606
|
+
json_string += "\"bias_estimate\": [";
|
|
607
|
+
for (TI i = 0; i < 3; i++){
|
|
608
|
+
json_string += std::to_string(state.bias_estimate[i]);
|
|
609
|
+
if (i < 2) {
|
|
610
|
+
json_string += ", ";
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
json_string += "]";
|
|
614
|
+
json_string += top_level ? "}" : "";
|
|
615
|
+
return json_string;
|
|
616
|
+
}
|
|
617
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
618
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateCTBRController<STATE_SPEC>& state, bool top_level=true){
|
|
619
|
+
std::string json_string = top_level ? "{" : "";
|
|
620
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
621
|
+
json_string += "\"previous_angular_velocity\": [" + std::to_string(state.previous_angular_velocity[0]) + ", " + std::to_string(state.previous_angular_velocity[1]) + ", " + std::to_string(state.previous_angular_velocity[2]) + "]";
|
|
622
|
+
json_string += top_level ? "}" : "";
|
|
623
|
+
return json_string;
|
|
624
|
+
}
|
|
625
|
+
namespace rl::environments::l2f::detail{
|
|
626
|
+
template <typename FloatT>
|
|
627
|
+
inline std::string lossless_to_string(FloatT v){
|
|
628
|
+
// round-trip-safe textual representation; max_digits10 guarantees
|
|
629
|
+
// re-parsing yields exactly the same FloatT value.
|
|
630
|
+
char buf[64];
|
|
631
|
+
constexpr int digits = std::numeric_limits<FloatT>::max_digits10;
|
|
632
|
+
std::snprintf(buf, sizeof(buf), "%.*g", digits, (double)v);
|
|
633
|
+
return std::string(buf);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
637
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateLinearAccelerationHistory<STATE_SPEC>& state, bool top_level=true){
|
|
638
|
+
using TI = typename DEVICE::index_t;
|
|
639
|
+
using T = typename STATE_SPEC::T;
|
|
640
|
+
using STATE = rl::environments::l2f::StateLinearAccelerationHistory<STATE_SPEC>;
|
|
641
|
+
std::string json_string = top_level ? "{" : "";
|
|
642
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
643
|
+
json_string += "\"linear_acceleration_body_history\": [";
|
|
644
|
+
for (TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
645
|
+
json_string += "[";
|
|
646
|
+
for (TI dim_i = 0; dim_i < STATE::ACCELERATION_DIM; dim_i++){
|
|
647
|
+
json_string += rl::environments::l2f::detail::lossless_to_string<T>(state.linear_acceleration_body_history[step_i][dim_i]);
|
|
648
|
+
if (dim_i < STATE::ACCELERATION_DIM - 1) {
|
|
649
|
+
json_string += ", ";
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
json_string += "]";
|
|
653
|
+
if (step_i + 1 < STATE_SPEC::HISTORY_LENGTH) {
|
|
654
|
+
json_string += ", ";
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
json_string += "], ";
|
|
658
|
+
json_string += "\"acceleration_history_step\": " + std::to_string(state.acceleration_history_step);
|
|
659
|
+
json_string += top_level ? "}" : "";
|
|
660
|
+
return json_string;
|
|
661
|
+
}
|
|
662
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
663
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateAngularVelocityDelay<STATE_SPEC>& state, bool top_level=true){
|
|
664
|
+
using TI = typename DEVICE::index_t;
|
|
665
|
+
using STATE = rl::environments::l2f::StateAngularVelocityDelay<STATE_SPEC>;
|
|
666
|
+
std::string json_string = top_level ? "{" : "";
|
|
667
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
668
|
+
json_string += "\"angular_velocity_history\": [";
|
|
669
|
+
for (TI step_i = 0; step_i < STATE::HISTORY_MEM_LENGTH; step_i++){
|
|
670
|
+
json_string += "[";
|
|
671
|
+
for (TI dim_i = 0; dim_i < 3; dim_i++){
|
|
672
|
+
json_string += std::to_string(state.angular_velocity_history[step_i][dim_i]);
|
|
673
|
+
if (dim_i < 2) {
|
|
674
|
+
json_string += ", ";
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
json_string += "]";
|
|
678
|
+
if (step_i < STATE::HISTORY_MEM_LENGTH - 1) {
|
|
679
|
+
json_string += ", ";
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
json_string += "]";
|
|
683
|
+
json_string += top_level ? "}" : "";
|
|
684
|
+
return json_string;
|
|
685
|
+
}
|
|
686
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
687
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateLinearVelocityDelay<STATE_SPEC>& state, bool top_level=true){
|
|
688
|
+
using TI = typename DEVICE::index_t;
|
|
689
|
+
using STATE = rl::environments::l2f::StateLinearVelocityDelay<STATE_SPEC>;
|
|
690
|
+
std::string json_string = top_level ? "{" : "";
|
|
691
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
692
|
+
json_string += "\"linear_velocity_history\": [";
|
|
693
|
+
for (TI step_i = 0; step_i < STATE::HISTORY_MEM_LENGTH; step_i++){
|
|
694
|
+
json_string += "[";
|
|
695
|
+
for (TI dim_i = 0; dim_i < 3; dim_i++){
|
|
696
|
+
json_string += std::to_string(state.linear_velocity_history[step_i][dim_i]);
|
|
697
|
+
if (dim_i < 2) {
|
|
698
|
+
json_string += ", ";
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
json_string += "]";
|
|
702
|
+
if (step_i < STATE::HISTORY_MEM_LENGTH - 1) {
|
|
703
|
+
json_string += ", ";
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
json_string += "]";
|
|
707
|
+
json_string += top_level ? "}" : "";
|
|
708
|
+
return json_string;
|
|
709
|
+
}
|
|
710
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
711
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StatePoseErrorIntegral<STATE_SPEC>& state, bool top_level=true){
|
|
712
|
+
std::string json_string = top_level ? "{" : "";
|
|
713
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
714
|
+
json_string += "\"position_integral\": [" + std::to_string(state.position_integral[0]) + ", " + std::to_string(state.position_integral[1]) + ", " + std::to_string(state.position_integral[2]) + "], ";
|
|
715
|
+
json_string += "\"orientation_integral\": " + std::to_string(state.orientation_integral);
|
|
716
|
+
json_string += top_level ? "}" : "";
|
|
717
|
+
return json_string;
|
|
718
|
+
}
|
|
719
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
720
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateRotors<STATE_SPEC>& state, bool top_level=true){
|
|
721
|
+
using TI = typename DEVICE::index_t;
|
|
722
|
+
using STATE = rl::environments::l2f::StateRotors<STATE_SPEC>;
|
|
723
|
+
std::string json_string = top_level ? "{" : "";
|
|
724
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
725
|
+
json_string += "\"rpm\": [";
|
|
726
|
+
for (TI action_i = 0; action_i < STATE::ACTION_DIM; action_i++){
|
|
727
|
+
json_string += std::to_string(state.rpm[action_i]);
|
|
728
|
+
if (action_i < STATE::ACTION_DIM - 1) {
|
|
729
|
+
json_string += ", ";
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
json_string += "]";
|
|
733
|
+
json_string += top_level ? "}" : "";
|
|
734
|
+
return json_string;
|
|
735
|
+
}
|
|
736
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
737
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateRotorsHistory<STATE_SPEC>& state, bool top_level=true){
|
|
738
|
+
using TI = typename DEVICE::index_t;
|
|
739
|
+
using STATE = rl::environments::l2f::StateRotorsHistory<STATE_SPEC>;
|
|
740
|
+
std::string json_string = top_level ? "{" : "";
|
|
741
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE::NEXT_COMPONENT&>(state), false) + ", ";
|
|
742
|
+
json_string += "\"action_history\": [";
|
|
743
|
+
for (TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
744
|
+
json_string += "[";
|
|
745
|
+
for (TI action_i = 0; action_i < SPEC::PARAMETERS::N; action_i++){
|
|
746
|
+
json_string += std::to_string(state.action_history[step_i][action_i]);
|
|
747
|
+
if (action_i < SPEC::PARAMETERS::N - 1) {
|
|
748
|
+
json_string += ", ";
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
json_string += "]";
|
|
752
|
+
if (step_i < STATE_SPEC::HISTORY_LENGTH - 1) {
|
|
753
|
+
json_string += ", ";
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
json_string += "]";
|
|
757
|
+
json_string += top_level ? "}" : "";
|
|
758
|
+
return json_string;
|
|
759
|
+
}
|
|
760
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
761
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateRandomForce<STATE_SPEC>& state, bool top_level=true){
|
|
762
|
+
std::string json_string = top_level ? "{" : "";
|
|
763
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
764
|
+
json_string += "\"force\": [" + std::to_string(state.force[0]) + ", " + std::to_string(state.force[1]) + ", " + std::to_string(state.force[2]) + "], ";
|
|
765
|
+
json_string += "\"torque\": [" + std::to_string(state.torque[0]) + ", " + std::to_string(state.torque[1]) + ", " + std::to_string(state.torque[2]) + "]";
|
|
766
|
+
json_string += top_level ? "}" : "";
|
|
767
|
+
return json_string;
|
|
768
|
+
}
|
|
769
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
770
|
+
std::string json(DEVICE& device, const rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, const rl::environments::l2f::StateTrajectory<STATE_SPEC>& state, bool top_level=true){
|
|
771
|
+
std::string json_string = top_level ? "{" : "";
|
|
772
|
+
json_string += json(device, env, parameters, static_cast<const typename STATE_SPEC::NEXT_COMPONENT&>(state), false) + ", ";
|
|
773
|
+
json_string += "\"trajectory\": {";
|
|
774
|
+
json_string += "\"trajectory_step\": " + std::to_string(state.trajectory_step);
|
|
775
|
+
json_string += "}";
|
|
776
|
+
json_string += top_level ? "}" : "";
|
|
777
|
+
return json_string;
|
|
778
|
+
}
|
|
779
|
+
#ifdef RL_TOOLS_ENABLE_JSON
|
|
780
|
+
template <typename DEVICE, typename SPEC, typename T_T, typename T_TI, T_TI N>
|
|
781
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::Dynamics<T_T, T_TI, N>& parameters){
|
|
782
|
+
using TI = typename DEVICE::index_t;
|
|
783
|
+
for (TI i = 0; i < N; i++){
|
|
784
|
+
parameters.rotor_positions[i][0] = json_object["rotor_positions"][i][0];
|
|
785
|
+
parameters.rotor_positions[i][1] = json_object["rotor_positions"][i][1];
|
|
786
|
+
parameters.rotor_positions[i][2] = json_object["rotor_positions"][i][2];
|
|
787
|
+
parameters.rotor_thrust_directions[i][0] = json_object["rotor_thrust_directions"][i][0];
|
|
788
|
+
parameters.rotor_thrust_directions[i][1] = json_object["rotor_thrust_directions"][i][1];
|
|
789
|
+
parameters.rotor_thrust_directions[i][2] = json_object["rotor_thrust_directions"][i][2];
|
|
790
|
+
parameters.rotor_torque_directions[i][0] = json_object["rotor_torque_directions"][i][0];
|
|
791
|
+
parameters.rotor_torque_directions[i][1] = json_object["rotor_torque_directions"][i][1];
|
|
792
|
+
parameters.rotor_torque_directions[i][2] = json_object["rotor_torque_directions"][i][2];
|
|
793
|
+
parameters.rotor_thrust_coefficients[i][0] = json_object["rotor_thrust_coefficients"][i][0];
|
|
794
|
+
parameters.rotor_thrust_coefficients[i][1] = json_object["rotor_thrust_coefficients"][i][1];
|
|
795
|
+
parameters.rotor_thrust_coefficients[i][2] = json_object["rotor_thrust_coefficients"][i][2];
|
|
796
|
+
parameters.rotor_torque_constants[i] = json_object["rotor_torque_constants"][i];
|
|
797
|
+
parameters.rotor_time_constants_rising[i] = json_object["rotor_time_constants_rising"][i];
|
|
798
|
+
parameters.rotor_time_constants_falling[i] = json_object["rotor_time_constants_falling"][i];
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
parameters.mass = json_object["mass"];
|
|
802
|
+
parameters.gravity[0] = json_object["gravity"][0];
|
|
803
|
+
parameters.gravity[1] = json_object["gravity"][1];
|
|
804
|
+
parameters.gravity[2] = json_object["gravity"][2];
|
|
805
|
+
|
|
806
|
+
for (TI i = 0; i < 3; i++) {
|
|
807
|
+
for (TI j = 0; j < 3; j++) {
|
|
808
|
+
parameters.J[i][j] = json_object["J"][i][j];
|
|
809
|
+
parameters.J_inv[i][j] = json_object["J_inv"][i][j];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
parameters.hovering_throttle_relative = json_object["hovering_throttle_relative"];
|
|
814
|
+
parameters.action_limit.min = json_object["action_limit"]["min"];
|
|
815
|
+
parameters.action_limit.max = json_object["action_limit"]["max"];
|
|
816
|
+
}
|
|
817
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
818
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::IMU<T>& parameters) {
|
|
819
|
+
const auto& gb_json = json_object["gyro_bias"];
|
|
820
|
+
parameters.gyro_bias.init_max = gb_json.value("init_max", (T)0);
|
|
821
|
+
parameters.gyro_bias.tau = gb_json.value("tau", (T)0);
|
|
822
|
+
parameters.gyro_bias.sigma = gb_json.value("sigma", (T)0);
|
|
823
|
+
}
|
|
824
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
825
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::CTBRController<T>& parameters) {
|
|
826
|
+
parameters.thrust_min = json_object["thrust_min"];
|
|
827
|
+
parameters.thrust_max = json_object["thrust_max"];
|
|
828
|
+
for(typename DEVICE::index_t i = 0; i < 3; i++){
|
|
829
|
+
parameters.rate_limit[i] = json_object["rate_limit"][i];
|
|
830
|
+
parameters.kp[i] = json_object["kp"][i];
|
|
831
|
+
parameters.kd[i] = json_object["kd"][i];
|
|
832
|
+
parameters.torque_limit[i] = json_object["torque_limit"][i];
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
836
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::Integration<PARAM_SPEC>& parameters) {
|
|
837
|
+
parameters.dt = json_object["dt"];
|
|
838
|
+
}
|
|
839
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
840
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::Initialization<PARAM_SPEC>& parameters) {
|
|
841
|
+
parameters.guidance = json_object["guidance"];
|
|
842
|
+
parameters.max_position = json_object["max_position"];
|
|
843
|
+
parameters.max_angle = json_object["max_angle"];
|
|
844
|
+
parameters.max_linear_velocity = json_object["max_linear_velocity"];
|
|
845
|
+
parameters.max_angular_velocity = json_object["max_angular_velocity"];
|
|
846
|
+
parameters.relative_rpm = json_object["relative_rpm"];
|
|
847
|
+
parameters.min_rpm = json_object["min_rpm"];
|
|
848
|
+
parameters.max_rpm = json_object["max_rpm"];
|
|
849
|
+
}
|
|
850
|
+
template <typename DEVICE, typename SPEC, typename T, unsigned T_ACTION_DIM>
|
|
851
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::reward_functions::Squared<T, T_ACTION_DIM>& parameters) {
|
|
852
|
+
parameters.non_negative = json_object["non_negative"];
|
|
853
|
+
parameters.scale = json_object["scale"];
|
|
854
|
+
parameters.constant = json_object["constant"];
|
|
855
|
+
parameters.termination_penalty = json_object["termination_penalty"];
|
|
856
|
+
parameters.position = json_object["position"];
|
|
857
|
+
parameters.position_clip = json_object["position_clip"];
|
|
858
|
+
parameters.orientation = json_object["orientation"];
|
|
859
|
+
parameters.linear_velocity = json_object["linear_velocity"];
|
|
860
|
+
parameters.angular_velocity = json_object["angular_velocity"];
|
|
861
|
+
parameters.linear_acceleration = json_object["linear_acceleration"];
|
|
862
|
+
parameters.angular_acceleration = json_object["angular_acceleration"];
|
|
863
|
+
if(json_object["action"].is_array()){
|
|
864
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
865
|
+
parameters.action[action_i] = json_object["action"][action_i];
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
else{
|
|
869
|
+
T action = json_object["action"];
|
|
870
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
871
|
+
parameters.action[action_i] = action;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if(json_object["d_action"].is_array()){
|
|
875
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
876
|
+
parameters.d_action[action_i] = json_object["d_action"][action_i];
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else{
|
|
880
|
+
T d_action = json_object["d_action"];
|
|
881
|
+
for(typename DEVICE::index_t action_i = 0; action_i < T_ACTION_DIM; action_i++){
|
|
882
|
+
parameters.d_action[action_i] = d_action;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
parameters.position_error_integral = json_object["position_error_integral"];
|
|
886
|
+
}
|
|
887
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
888
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::Termination<PARAM_SPEC>& parameters) {
|
|
889
|
+
parameters.enabled = json_object["enabled"];
|
|
890
|
+
parameters.position_threshold = json_object["position_threshold"];
|
|
891
|
+
parameters.angle_threshold = json_object.value("angle_threshold", (PARAM_SPEC)0);
|
|
892
|
+
parameters.linear_velocity_threshold = json_object["linear_velocity_threshold"];
|
|
893
|
+
parameters.angular_velocity_threshold = json_object["angular_velocity_threshold"];
|
|
894
|
+
parameters.position_integral_threshold = json_object["position_integral_threshold"];
|
|
895
|
+
parameters.orientation_integral_threshold = json_object["orientation_integral_threshold"];
|
|
896
|
+
}
|
|
897
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
898
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::ObservationNoise<PARAM_SPEC>& parameters) {
|
|
899
|
+
parameters.position = json_object["position"];
|
|
900
|
+
parameters.orientation = json_object["orientation"];
|
|
901
|
+
parameters.linear_velocity = json_object["linear_velocity"];
|
|
902
|
+
parameters.angular_velocity = json_object["angular_velocity"];
|
|
903
|
+
parameters.imu_acceleration = json_object["imu_acceleration"];
|
|
904
|
+
}
|
|
905
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
906
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::ActionNoise<PARAM_SPEC>& parameters) {
|
|
907
|
+
parameters.normalized_rpm = json_object["normalized_rpm"];
|
|
908
|
+
}
|
|
909
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
910
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::MDP<PARAM_SPEC>& parameters) {
|
|
911
|
+
from_json(device, env, json_object["init"], parameters.init);
|
|
912
|
+
from_json(device, env, json_object["reward"], parameters.reward);
|
|
913
|
+
from_json(device, env, json_object["observation_noise"], parameters.observation_noise);
|
|
914
|
+
from_json(device, env, json_object["action_noise"], parameters.action_noise);
|
|
915
|
+
from_json(device, env, json_object["termination"], parameters.termination);
|
|
916
|
+
}
|
|
917
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
918
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersBase<PARAM_SPEC>& parameters){
|
|
919
|
+
from_json(device, env, json_object["dynamics"], parameters.dynamics);
|
|
920
|
+
from_json(device, env, json_object["integration"], parameters.integration);
|
|
921
|
+
from_json(device, env, json_object["mdp"], parameters.mdp);
|
|
922
|
+
}
|
|
923
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
924
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::Disturbances<PARAM_SPEC>& parameters) {
|
|
925
|
+
parameters.random_force.mean = json_object["random_force"]["mean"];
|
|
926
|
+
parameters.random_force.std = json_object["random_force"]["std"];
|
|
927
|
+
parameters.random_torque.mean = json_object["random_torque"]["mean"];
|
|
928
|
+
parameters.random_torque.std = json_object["random_torque"]["std"];
|
|
929
|
+
}
|
|
930
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
931
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersDisturbances<PARAM_SPEC>& parameters){
|
|
932
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
933
|
+
from_json(device, env, json_object["disturbances"], parameters.disturbances);
|
|
934
|
+
}
|
|
935
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
936
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersIMU<PARAM_SPEC>& parameters){
|
|
937
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
938
|
+
if (json_object.contains("imu")){
|
|
939
|
+
from_json(device, env, json_object["imu"], parameters.imu);
|
|
940
|
+
}
|
|
941
|
+
else {
|
|
942
|
+
parameters.imu.gyro_bias.init_max = 0;
|
|
943
|
+
parameters.imu.gyro_bias.tau = 0;
|
|
944
|
+
parameters.imu.gyro_bias.sigma = 0;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
948
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersCTBRController<PARAM_SPEC>& parameters){
|
|
949
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
950
|
+
from_json(device, env, json_object["ctbr_controller"], parameters.ctbr_controller);
|
|
951
|
+
}
|
|
952
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
953
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::DomainRandomization<PARAM_SPEC>& parameters) {
|
|
954
|
+
parameters.thrust_to_weight_min = json_object["thrust_to_weight_min"];
|
|
955
|
+
parameters.thrust_to_weight_max = json_object["thrust_to_weight_max"];
|
|
956
|
+
parameters.torque_to_inertia_min = json_object["torque_to_inertia_min"];
|
|
957
|
+
parameters.torque_to_inertia_max = json_object["torque_to_inertia_max"];
|
|
958
|
+
parameters.mass_min = json_object["mass_min"];
|
|
959
|
+
parameters.mass_max = json_object["mass_max"];
|
|
960
|
+
parameters.mass_size_deviation = json_object["mass_size_deviation"];
|
|
961
|
+
parameters.rotor_time_constant_rising_min = json_object["rotor_time_constant_rising_min"];
|
|
962
|
+
parameters.rotor_time_constant_rising_max = json_object["rotor_time_constant_rising_max"];
|
|
963
|
+
parameters.rotor_time_constant_falling_min = json_object["rotor_time_constant_falling_min"];
|
|
964
|
+
parameters.rotor_time_constant_falling_max = json_object["rotor_time_constant_falling_max"];
|
|
965
|
+
parameters.rotor_torque_constant_min = json_object["rotor_torque_constant_min"];
|
|
966
|
+
parameters.rotor_torque_constant_max = json_object["rotor_torque_constant_max"];
|
|
967
|
+
parameters.orientation_offset_angle_max = json_object["orientation_offset_angle_max"];
|
|
968
|
+
parameters.disturbance_force_max = json_object["disturbance_force_max"];
|
|
969
|
+
}
|
|
970
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
971
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersDomainRandomization<PARAM_SPEC>& parameters){
|
|
972
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
973
|
+
from_json(device, env, json_object["domain_randomization"], parameters.domain_randomization);
|
|
974
|
+
}
|
|
975
|
+
template <typename DEVICE, typename SPEC, typename TRAJ_SPEC>
|
|
976
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::trajectories::Trajectory<TRAJ_SPEC>& trajectory) {
|
|
977
|
+
using T = typename TRAJ_SPEC::T;
|
|
978
|
+
using TI = typename DEVICE::index_t;
|
|
979
|
+
using TRAJECTORY = rl::environments::l2f::parameters::trajectories::Trajectory<TRAJ_SPEC>;
|
|
980
|
+
rl_tools::utils::assert_exit(device, json_object["LENGTH"] == TRAJECTORY::LENGTH, "Mismatch in trajectory length");
|
|
981
|
+
T json_dt = json_object["DT"];
|
|
982
|
+
T traj_dt = TRAJECTORY::DT;
|
|
983
|
+
rl_tools::utils::assert_exit(device, json_dt == traj_dt, "Mismatch in trajectory dt");
|
|
984
|
+
for (TI step_i = 0; step_i < TRAJECTORY::LENGTH; step_i++){
|
|
985
|
+
auto& step = trajectory.steps[step_i];
|
|
986
|
+
for (TI axis_i=0; axis_i < 3; axis_i++){
|
|
987
|
+
step.position[axis_i] = json_object["steps"][step_i]["position"][axis_i];
|
|
988
|
+
step.yaw = json_object["steps"][step_i]["yaw"];
|
|
989
|
+
step.linear_velocity[axis_i] = json_object["steps"][step_i]["linear_velocity"][axis_i];
|
|
990
|
+
step.yaw_velocity = json_object["steps"][step_i]["yaw_velocity"];
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
995
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::trajectories::lissajous::Parameters<T>& parameters) {
|
|
996
|
+
parameters.A = json_object["A"];
|
|
997
|
+
parameters.B = json_object["B"];
|
|
998
|
+
parameters.C = json_object["C"];
|
|
999
|
+
parameters.a = json_object["a"];
|
|
1000
|
+
parameters.b = json_object["b"];
|
|
1001
|
+
parameters.c = json_object["c"];
|
|
1002
|
+
// backwards compat, deprecated
|
|
1003
|
+
if (json_object.contains("duration")) {
|
|
1004
|
+
parameters.interval = json_object["duration"];
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
parameters.interval = json_object["interval"];
|
|
1008
|
+
}
|
|
1009
|
+
parameters.ramp_duration = json_object["ramp_duration"];
|
|
1010
|
+
}
|
|
1011
|
+
template <typename DEVICE, typename SPEC, typename TRAJ_PARAM_SPEC>
|
|
1012
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::trajectories::TaggedParameters<TRAJ_PARAM_SPEC>& parameters) {
|
|
1013
|
+
std::string type_str = json_object["type"];
|
|
1014
|
+
if (type_str == "LISSAJOUS") {
|
|
1015
|
+
parameters.type = rl::environments::l2f::parameters::trajectories::Type::LISSAJOUS;
|
|
1016
|
+
from_json(device, env, json_object["lissajous"], parameters.parameters.lissajous);
|
|
1017
|
+
}
|
|
1018
|
+
else {
|
|
1019
|
+
utils::assert_exit(device, false, "L2F json import: Unknown trajectory_parameters type");
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
1023
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersTrajectory<PARAM_SPEC>& parameters){
|
|
1024
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
1025
|
+
from_json(device, env, json_object["trajectory"], parameters.trajectory);
|
|
1026
|
+
from_json(device, env, json_object["trajectory_parameters"], parameters.trajectory_parameters);
|
|
1027
|
+
}
|
|
1028
|
+
template <typename DEVICE, typename SPEC, typename T, typename TI>
|
|
1029
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::parameters::ObservationDelay<T, TI>& parameters) {
|
|
1030
|
+
parameters.linear_velocity = json_object["linear_velocity"];
|
|
1031
|
+
parameters.angular_velocity = json_object["angular_velocity"];
|
|
1032
|
+
}
|
|
1033
|
+
template <typename DEVICE, typename SPEC, typename PARAM_SPEC>
|
|
1034
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, nlohmann::json json_object, rl::environments::l2f::ParametersObservationDelay<PARAM_SPEC>& parameters){
|
|
1035
|
+
from_json(device, env, json_object, static_cast<typename PARAM_SPEC::NEXT_COMPONENT&>(parameters));
|
|
1036
|
+
from_json(device, env, json_object["observation_delay"], parameters.observation_delay);
|
|
1037
|
+
}
|
|
1038
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS>
|
|
1039
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, std::string json_string, PARAMETERS& parameters){
|
|
1040
|
+
nlohmann::json json_object = nlohmann::json::parse(json_string);
|
|
1041
|
+
from_json(device, env, json_object, parameters);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1045
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateBase<STATE_SPEC>& state){
|
|
1046
|
+
using TI = typename DEVICE::index_t;
|
|
1047
|
+
for (TI i = 0; i < 3; i++){
|
|
1048
|
+
state.position[i] = json_object["position"][i];
|
|
1049
|
+
state.orientation[i] = json_object["orientation"][i];
|
|
1050
|
+
state.linear_velocity[i] = json_object["linear_velocity"][i];
|
|
1051
|
+
state.angular_velocity[i] = json_object["angular_velocity"][i];
|
|
1052
|
+
}
|
|
1053
|
+
state.orientation[3] = json_object["orientation"][3];
|
|
1054
|
+
}
|
|
1055
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1056
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateLastAction<STATE_SPEC>& state){
|
|
1057
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1058
|
+
for (typename DEVICE::index_t action_i = 0; action_i < SPEC::PARAMETERS::N; action_i++){
|
|
1059
|
+
state.last_action[action_i] = json_object["last_action"][action_i];
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1063
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateLinearAcceleration<STATE_SPEC>& state){
|
|
1064
|
+
using TI = typename DEVICE::index_t;
|
|
1065
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1066
|
+
for (TI i = 0; i < 3; i++){
|
|
1067
|
+
state.linear_acceleration[i] = json_object["linear_acceleration"][i];
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1071
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateGyroBias<STATE_SPEC>& state){
|
|
1072
|
+
using TI = typename DEVICE::index_t;
|
|
1073
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1074
|
+
for (TI i = 0; i < 3; i++){
|
|
1075
|
+
state.gyro_bias[i] = json_object["gyro_bias"][i];
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1079
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateMahony<STATE_SPEC>& state){
|
|
1080
|
+
using TI = typename DEVICE::index_t;
|
|
1081
|
+
using T = typename STATE_SPEC::T;
|
|
1082
|
+
using STATE = rl::environments::l2f::StateMahony<STATE_SPEC>;
|
|
1083
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1084
|
+
if(json_object.contains("q_estimate")){
|
|
1085
|
+
for (TI i = 0; i < 4; i++){
|
|
1086
|
+
state.q_estimate[i] = json_object["q_estimate"][i];
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
else if(json_object.contains("world_z_body_estimate")){
|
|
1090
|
+
T world_z_body[3];
|
|
1091
|
+
for (TI i = 0; i < 3; i++){
|
|
1092
|
+
world_z_body[i] = json_object["world_z_body_estimate"][i];
|
|
1093
|
+
}
|
|
1094
|
+
state.q_estimate[0] = 1;
|
|
1095
|
+
state.q_estimate[1] = 0;
|
|
1096
|
+
state.q_estimate[2] = 0;
|
|
1097
|
+
state.q_estimate[3] = 0;
|
|
1098
|
+
rl::environments::l2f::mahony_quaternion_from_accel(device, world_z_body, state.q_estimate);
|
|
1099
|
+
}
|
|
1100
|
+
else{
|
|
1101
|
+
T world_z_body[3];
|
|
1102
|
+
rl::environments::l2f::quaternion_to_world_z_body<DEVICE, T>(state.orientation, world_z_body);
|
|
1103
|
+
state.q_estimate[0] = 1;
|
|
1104
|
+
state.q_estimate[1] = 0;
|
|
1105
|
+
state.q_estimate[2] = 0;
|
|
1106
|
+
state.q_estimate[3] = 0;
|
|
1107
|
+
rl::environments::l2f::mahony_quaternion_from_accel(device, world_z_body, state.q_estimate);
|
|
1108
|
+
}
|
|
1109
|
+
if(json_object.contains("bias_estimate")){
|
|
1110
|
+
for (TI i = 0; i < 3; i++){
|
|
1111
|
+
state.bias_estimate[i] = json_object["bias_estimate"][i];
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
else if(json_object.contains("gyro_bias_tangent")){
|
|
1115
|
+
for (TI i = 0; i < 3; i++){
|
|
1116
|
+
state.bias_estimate[i] = json_object["gyro_bias_tangent"][i];
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
else{
|
|
1120
|
+
for (TI i = 0; i < 3; i++){
|
|
1121
|
+
state.bias_estimate[i] = 0;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
T q_norm = math::sqrt(device.math,
|
|
1125
|
+
state.q_estimate[0]*state.q_estimate[0] +
|
|
1126
|
+
state.q_estimate[1]*state.q_estimate[1] +
|
|
1127
|
+
state.q_estimate[2]*state.q_estimate[2] +
|
|
1128
|
+
state.q_estimate[3]*state.q_estimate[3]);
|
|
1129
|
+
if(q_norm > (T)1e-12){
|
|
1130
|
+
for(TI i = 0; i < 4; i++){
|
|
1131
|
+
state.q_estimate[i] /= q_norm;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
else{
|
|
1135
|
+
state.q_estimate[0] = 1;
|
|
1136
|
+
state.q_estimate[1] = 0;
|
|
1137
|
+
state.q_estimate[2] = 0;
|
|
1138
|
+
state.q_estimate[3] = 0;
|
|
1139
|
+
}
|
|
1140
|
+
for(TI i = 0; i < 3; i++){
|
|
1141
|
+
state.bias_estimate[i] = math::clamp(device.math, state.bias_estimate[i], -STATE::MAX_BIAS, STATE::MAX_BIAS);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1145
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateCTBRController<STATE_SPEC>& state){
|
|
1146
|
+
using TI = typename DEVICE::index_t;
|
|
1147
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1148
|
+
for(TI i = 0; i < 3; i++){
|
|
1149
|
+
state.previous_angular_velocity[i] = json_object["previous_angular_velocity"][i];
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1153
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateLinearAccelerationHistory<STATE_SPEC>& state){
|
|
1154
|
+
using TI = typename DEVICE::index_t;
|
|
1155
|
+
using STATE = rl::environments::l2f::StateLinearAccelerationHistory<STATE_SPEC>;
|
|
1156
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1157
|
+
const auto& hist = json_object.at("linear_acceleration_body_history");
|
|
1158
|
+
if (hist.size() != STATE_SPEC::HISTORY_LENGTH){
|
|
1159
|
+
throw std::runtime_error("StateLinearAccelerationHistory: linear_acceleration_body_history has " + std::to_string(hist.size()) + " entries, expected " + std::to_string(STATE_SPEC::HISTORY_LENGTH));
|
|
1160
|
+
}
|
|
1161
|
+
for(TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
1162
|
+
const auto& step_entry = hist.at(step_i);
|
|
1163
|
+
if (step_entry.size() != STATE::ACCELERATION_DIM){
|
|
1164
|
+
throw std::runtime_error("StateLinearAccelerationHistory: entry " + std::to_string(step_i) + " has " + std::to_string(step_entry.size()) + " components, expected " + std::to_string(STATE::ACCELERATION_DIM));
|
|
1165
|
+
}
|
|
1166
|
+
for(TI dim_i = 0; dim_i < STATE::ACCELERATION_DIM; dim_i++){
|
|
1167
|
+
state.linear_acceleration_body_history[step_i][dim_i] = step_entry.at(dim_i);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
TI raw_step = json_object.at("acceleration_history_step");
|
|
1171
|
+
if constexpr(STATE_SPEC::HISTORY_LENGTH == 0){
|
|
1172
|
+
state.acceleration_history_step = 0;
|
|
1173
|
+
}
|
|
1174
|
+
else{
|
|
1175
|
+
if (raw_step >= STATE_SPEC::HISTORY_LENGTH){
|
|
1176
|
+
throw std::runtime_error("StateLinearAccelerationHistory: acceleration_history_step " + std::to_string(raw_step) + " out of range [0, " + std::to_string(STATE_SPEC::HISTORY_LENGTH) + ")");
|
|
1177
|
+
}
|
|
1178
|
+
state.acceleration_history_step = raw_step;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1182
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateAngularVelocityDelay<STATE_SPEC>& state){
|
|
1183
|
+
using TI = typename DEVICE::index_t;
|
|
1184
|
+
using STATE = rl::environments::l2f::StateAngularVelocityDelay<STATE_SPEC>;
|
|
1185
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE::NEXT_COMPONENT&>(state));
|
|
1186
|
+
for(TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
1187
|
+
for(TI dim_i = 0; dim_i < 3; dim_i++){
|
|
1188
|
+
state.angular_velocity_history[step_i][dim_i] = json_object["angular_velocity_history"][step_i][dim_i];
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1193
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateLinearVelocityDelay<STATE_SPEC>& state){
|
|
1194
|
+
using TI = typename DEVICE::index_t;
|
|
1195
|
+
using STATE = rl::environments::l2f::StateLinearVelocityDelay<STATE_SPEC>;
|
|
1196
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE::NEXT_COMPONENT&>(state));
|
|
1197
|
+
for(TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
1198
|
+
for(TI dim_i = 0; dim_i < 3; dim_i++){
|
|
1199
|
+
state.linear_velocity_history[step_i][dim_i] = json_object["linear_velocity_history"][step_i][dim_i];
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1204
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StatePoseErrorIntegral<STATE_SPEC>& state){
|
|
1205
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1206
|
+
state.position_integral[0] = json_object["position_integral"][0];
|
|
1207
|
+
state.position_integral[1] = json_object["position_integral"][1];
|
|
1208
|
+
state.position_integral[2] = json_object["position_integral"][2];
|
|
1209
|
+
state.orientation_integral = json_object["orientation_integral"];
|
|
1210
|
+
}
|
|
1211
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1212
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateRotors<STATE_SPEC>& state){
|
|
1213
|
+
using TI = typename DEVICE::index_t;
|
|
1214
|
+
using STATE = rl::environments::l2f::StateRotors<STATE_SPEC>;
|
|
1215
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1216
|
+
for (TI action_i = 0; action_i < STATE::ACTION_DIM; action_i++){
|
|
1217
|
+
state.rpm[action_i] = json_object["rpm"][action_i];
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1221
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateRotorsHistory<STATE_SPEC>& state){
|
|
1222
|
+
using TI = typename DEVICE::index_t;
|
|
1223
|
+
using STATE = rl::environments::l2f::StateRotorsHistory<STATE_SPEC>;
|
|
1224
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE::NEXT_COMPONENT&>(state));
|
|
1225
|
+
for(TI step_i = 0; step_i < STATE_SPEC::HISTORY_LENGTH; step_i++){
|
|
1226
|
+
for(TI action_i = 0; action_i < SPEC::PARAMETERS::N; action_i++){
|
|
1227
|
+
state.action_history[step_i][action_i] = json_object["action_history"][step_i][action_i];
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1232
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateRandomForce<STATE_SPEC>& state){
|
|
1233
|
+
using TI = typename DEVICE::index_t;
|
|
1234
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1235
|
+
for (TI i = 0; i < 3; i++){
|
|
1236
|
+
state.force[i] = json_object["force"][i];
|
|
1237
|
+
state.torque[i] = json_object["torque"][i];
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE_SPEC>
|
|
1241
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, nlohmann::json json_object, rl::environments::l2f::StateTrajectory<STATE_SPEC>& state){
|
|
1242
|
+
using TI = typename DEVICE::index_t;
|
|
1243
|
+
from_json(device, env, parameters, json_object, static_cast<typename STATE_SPEC::NEXT_COMPONENT&>(state));
|
|
1244
|
+
state.trajectory_step = json_object["trajectory"]["trajectory_step"];
|
|
1245
|
+
}
|
|
1246
|
+
template <typename DEVICE, typename SPEC, typename PARAMETERS, typename STATE>
|
|
1247
|
+
void from_json(DEVICE& device, rl::environments::Multirotor<SPEC>& env, const PARAMETERS& parameters, std::string json_string, STATE& state){
|
|
1248
|
+
using TI = typename DEVICE::index_t;
|
|
1249
|
+
nlohmann::json json_object = nlohmann::json::parse(json_string);
|
|
1250
|
+
from_json(device, env, parameters, json_object, state);
|
|
1251
|
+
}
|
|
1252
|
+
#endif
|
|
1253
|
+
template <typename DEVICE, typename SPEC>
|
|
1254
|
+
std::string get_ui(DEVICE& device, rl::environments::Multirotor<SPEC>& env){
|
|
1255
|
+
// just the body of `function render(ctx, state, action) {` (so that it can be easily processed by `new Function("ctx", "state", "action", body)`
|
|
1256
|
+
#ifndef _MSC_VER
|
|
1257
|
+
std::string ui = R"RL_TOOLS_LITERAL(
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
import * as THREE from "three"
|
|
1272
|
+
import {OrbitControls} from "three-orbitcontrols"
|
|
1273
|
+
import {GLTFLoader} from "three-gltfloader"
|
|
1274
|
+
|
|
1275
|
+
export class CoordinateSystem{
|
|
1276
|
+
constructor(origin, length=1, diameter=0.01) {
|
|
1277
|
+
this.cs = new THREE.Group()
|
|
1278
|
+
const material_red = new THREE.MeshLambertMaterial({color: 0xAA0000})
|
|
1279
|
+
const material_green = new THREE.MeshLambertMaterial({color: 0x00AA00})
|
|
1280
|
+
const material_blue = new THREE.MeshLambertMaterial({color: 0x0000AA})
|
|
1281
|
+
const line = new THREE.BoxGeometry(length, diameter, diameter)
|
|
1282
|
+
var x = new THREE.Mesh( line, material_red);
|
|
1283
|
+
x.position.set(length/2, 0, 0)
|
|
1284
|
+
var y = new THREE.Mesh( line, material_green);
|
|
1285
|
+
y.position.set(0, length/2, 0)
|
|
1286
|
+
y.rotation.set(0, 0, Math.PI/2)
|
|
1287
|
+
var z = new THREE.Mesh( line, material_blue);
|
|
1288
|
+
z.position.set(0, 0, length/2)
|
|
1289
|
+
z.rotation.set(0, Math.PI/2, 0)
|
|
1290
|
+
this.cs.add(x)
|
|
1291
|
+
this.cs.add(y)
|
|
1292
|
+
this.cs.add(z)
|
|
1293
|
+
this.cs.position.set(origin[0], origin[1], origin[2])
|
|
1294
|
+
}
|
|
1295
|
+
get(){
|
|
1296
|
+
return this.cs
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
function norm(a){
|
|
1301
|
+
return Math.sqrt(a.map(x => x**2).reduce((a, c) => a + c, 0))
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
function Matrix4FromRotMatTranspose(rotMat){
|
|
1305
|
+
const m = new THREE.Matrix4()
|
|
1306
|
+
m.set(
|
|
1307
|
+
rotMat[0][0], rotMat[1][0], rotMat[2][0], 0,
|
|
1308
|
+
rotMat[0][1], rotMat[1][1], rotMat[2][1], 0,
|
|
1309
|
+
rotMat[0][2], rotMat[1][2], rotMat[2][2], 0,
|
|
1310
|
+
0, 0, 0, 1)
|
|
1311
|
+
return m
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
function Matrix4FromRotMat(rotMat){
|
|
1315
|
+
const m = new THREE.Matrix4()
|
|
1316
|
+
m.set(
|
|
1317
|
+
rotMat[0][0], rotMat[0][1], rotMat[0][2], 0,
|
|
1318
|
+
rotMat[1][0], rotMat[1][1], rotMat[1][2], 0,
|
|
1319
|
+
rotMat[2][0], rotMat[2][1], rotMat[2][2], 0,
|
|
1320
|
+
0, 0, 0, 1)
|
|
1321
|
+
return m
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
class State{
|
|
1328
|
+
constructor(canvas, {devicePixelRatio, showAxes=false, capture=false, camera_position=[0.5, 0.5, 1], camera_distance=null, interactive=true, conta_url="/conta/"}){
|
|
1329
|
+
this.canvas = canvas
|
|
1330
|
+
this.IS_MOBILE = this.is_mobile();
|
|
1331
|
+
this.actualDevicePixelRatio = devicePixelRatio || window.devicePixelRatio
|
|
1332
|
+
this.devicePixelRatio = !this.IS_MOBILE ? this.actualDevicePixelRatio : Math.min(this.actualDevicePixelRatio || 1, 2)
|
|
1333
|
+
this.showAxes = showAxes
|
|
1334
|
+
this.cursor_grab = interactive // Instruct the embedding code to make the cursor a grab cursor
|
|
1335
|
+
this.render_tick = 0
|
|
1336
|
+
this.capture = capture
|
|
1337
|
+
this.camera_position = camera_position
|
|
1338
|
+
this.camera_distance = camera_distance
|
|
1339
|
+
this.interactive = interactive
|
|
1340
|
+
this.lastCanvasWidth = 0
|
|
1341
|
+
this.lastCanvasHeight = 0
|
|
1342
|
+
this.conta_url = conta_url
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
is_mobile() {
|
|
1346
|
+
const isIOS = /iP(hone|ad|od)/.test(navigator.platform) || /iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
1347
|
+
const isAndroid = /Android/.test(navigator.userAgent);
|
|
1348
|
+
const isMobile = /Mobi|Android/i.test(navigator.userAgent) || 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
1349
|
+
const isTablet = /iPad|Android(?!.*Mobile)/.test(navigator.userAgent);
|
|
1350
|
+
return isIOS || isAndroid || isMobile || isTablet;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
async initialize(){
|
|
1354
|
+
const width = this.canvas.width
|
|
1355
|
+
const height = this.canvas.height
|
|
1356
|
+
this.scene = new THREE.Scene();
|
|
1357
|
+
this.camera = new THREE.PerspectiveCamera( 40, width / height, 0.1, 1000 );
|
|
1358
|
+
this.scene.add(this.camera);
|
|
1359
|
+
|
|
1360
|
+
this.renderer = new THREE.WebGLRenderer({
|
|
1361
|
+
canvas: this.canvas,
|
|
1362
|
+
antialias: !this.IS_MOBILE,
|
|
1363
|
+
alpha: !this.IS_MOBILE,
|
|
1364
|
+
powerPreference: this.IS_MOBILE ? 'low-power' : 'high-performance',
|
|
1365
|
+
preserveDrawingBuffer: this.capture && !this.IS_MOBILE
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
this.renderer.setPixelRatio(this.devicePixelRatio)
|
|
1369
|
+
this.renderer.setClearColor(0xffffff, 0);
|
|
1370
|
+
|
|
1371
|
+
this.renderer.setSize(width/this.actualDevicePixelRatio, height/this.actualDevicePixelRatio);
|
|
1372
|
+
|
|
1373
|
+
this.lastCanvasWidth = this.canvas.width
|
|
1374
|
+
this.lastCanvasHeight = this.canvas.height
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
// canvasContainer.appendChild(this.renderer.domElement );
|
|
1378
|
+
|
|
1379
|
+
this.controls = this.interactive ? new OrbitControls(this.camera, this.renderer.domElement) : null;
|
|
1380
|
+
|
|
1381
|
+
// this.controls.enabled = false;
|
|
1382
|
+
// window.addEventListener('keydown', (event) => {
|
|
1383
|
+
// if (event.key === 'Alt') {
|
|
1384
|
+
// this.controls.enabled = true;
|
|
1385
|
+
// this.canvas.style.cursor = "grab"
|
|
1386
|
+
// }
|
|
1387
|
+
// });
|
|
1388
|
+
|
|
1389
|
+
// window.addEventListener('keyup', (event) => {
|
|
1390
|
+
// if (event.key === 'Alt') {
|
|
1391
|
+
// this.controls.enabled = false;
|
|
1392
|
+
// this.canvas.style.cursor = "default"
|
|
1393
|
+
// }
|
|
1394
|
+
// });
|
|
1395
|
+
this.canvas.title = "Alt+Drag to rotate the camera. Alt+CTRL+Drag to move the camera."
|
|
1396
|
+
|
|
1397
|
+
this.simulator = new THREE.Group()
|
|
1398
|
+
this.simulator.rotation.set(-Math.PI / 2, 0, Math.PI / 2, 'XYZ');
|
|
1399
|
+
|
|
1400
|
+
// const axesHelper = new THREE.AxesHelper(5);
|
|
1401
|
+
// this.scene.add(axesHelper)
|
|
1402
|
+
this.scene.add(this.simulator)
|
|
1403
|
+
|
|
1404
|
+
var light = new THREE.AmbientLight( 0xffffff,0.5 ); // soft white light
|
|
1405
|
+
this.scene.add(light);
|
|
1406
|
+
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.4 )
|
|
1407
|
+
directionalLight.position.set(-100, 100, 0)
|
|
1408
|
+
directionalLight.target.position.set(0, 0, 0)
|
|
1409
|
+
this.scene.add( directionalLight )
|
|
1410
|
+
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.3 )
|
|
1411
|
+
directionalLight.position.set(0, 100, 100)
|
|
1412
|
+
directionalLight.target.position.set(0, 0, 0)
|
|
1413
|
+
this.scene.add( directionalLight )
|
|
1414
|
+
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.2 )
|
|
1415
|
+
directionalLight.position.set(0, 100, -100)
|
|
1416
|
+
directionalLight.target.position.set(0, 0, 0)
|
|
1417
|
+
this.scene.add( directionalLight )
|
|
1418
|
+
|
|
1419
|
+
// this.camera.position.set(...this.camera_position)
|
|
1420
|
+
// this.camera.quaternion.set(-0.14, 0.70, 0.14, 0.68)
|
|
1421
|
+
// this.controls.target.set(0.0, 0.0, 0.0)
|
|
1422
|
+
// this.controls.minDistance = 1
|
|
1423
|
+
// this.controls.minDistance = 5
|
|
1424
|
+
// this.controls.update()
|
|
1425
|
+
|
|
1426
|
+
this.camera_set = false
|
|
1427
|
+
this.THREE = THREE
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
function thrust_direction_to_quaternion(thrust_direction){
|
|
1434
|
+
const x = thrust_direction[0];
|
|
1435
|
+
const y = thrust_direction[1];
|
|
1436
|
+
const z = thrust_direction[2];
|
|
1437
|
+
|
|
1438
|
+
const z_unit = [0.0, 0.0, 1.0];
|
|
1439
|
+
|
|
1440
|
+
let cross_x = z_unit[1] * z - z_unit[2] * y;
|
|
1441
|
+
let cross_y = z_unit[2] * x - z_unit[0] * z;
|
|
1442
|
+
let cross_z = z_unit[0] * y - z_unit[1] * x;
|
|
1443
|
+
|
|
1444
|
+
const dot = z_unit[0] * x + z_unit[1] * y + z_unit[2] * z;
|
|
1445
|
+
|
|
1446
|
+
const angle = Math.acos(dot);
|
|
1447
|
+
|
|
1448
|
+
const cross_magnitude = Math.sqrt(cross_x * cross_x + cross_y * cross_y + cross_z * cross_z);
|
|
1449
|
+
if (cross_magnitude != 0) {
|
|
1450
|
+
cross_x /= cross_magnitude;
|
|
1451
|
+
cross_y /= cross_magnitude;
|
|
1452
|
+
cross_z /= cross_magnitude;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
const half_angle = angle / 2.0;
|
|
1456
|
+
const sin_half_angle = Math.sin(half_angle);
|
|
1457
|
+
|
|
1458
|
+
const qw = Math.cos(half_angle);
|
|
1459
|
+
const qx = cross_x * sin_half_angle;
|
|
1460
|
+
const qy = cross_y * sin_half_angle;
|
|
1461
|
+
const qz = cross_z * sin_half_angle;
|
|
1462
|
+
return [qw, qx, qy, qz];
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
export class DroneMesh{
|
|
1466
|
+
static glbCache = new Map();
|
|
1467
|
+
static gltfLoader = new GLTFLoader();
|
|
1468
|
+
|
|
1469
|
+
constructor(parameters, origin, displayIMUCoordinateSystem, displayActions, conta_url){
|
|
1470
|
+
console.assert(parameters.ui)
|
|
1471
|
+
this.group = new THREE.Group()
|
|
1472
|
+
const url = `${conta_url}${parameters.ui.model}`
|
|
1473
|
+
|
|
1474
|
+
if (DroneMesh.glbCache.has(url)) {
|
|
1475
|
+
this.loaded = DroneMesh.glbCache.get(url)
|
|
1476
|
+
} else {
|
|
1477
|
+
const loadingPromise = DroneMesh.gltfLoader.loadAsync(url).then((gltf) => {
|
|
1478
|
+
return gltf
|
|
1479
|
+
}).catch((error) => {
|
|
1480
|
+
DroneMesh.glbCache.delete(url)
|
|
1481
|
+
throw error
|
|
1482
|
+
})
|
|
1483
|
+
|
|
1484
|
+
DroneMesh.glbCache.set(url, loadingPromise)
|
|
1485
|
+
this.loaded = loadingPromise
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
this.loaded.then((gltf) => {
|
|
1489
|
+
const object = gltf.scene.clone()
|
|
1490
|
+
const object_group = new THREE.Group()
|
|
1491
|
+
object_group.add(object)
|
|
1492
|
+
// if(parameters.ui.name == "x500"){
|
|
1493
|
+
object_group.rotation.set(Math.PI / 2, 0, Math.PI / 2, 'ZYX')
|
|
1494
|
+
const scale = 0.5
|
|
1495
|
+
object_group.scale.set(scale, scale, scale)
|
|
1496
|
+
// }
|
|
1497
|
+
this.group.add(object_group)
|
|
1498
|
+
})
|
|
1499
|
+
if (displayIMUCoordinateSystem) {
|
|
1500
|
+
const scale = 1 //model.mass
|
|
1501
|
+
const coordinateSystemLength = Math.cbrt(scale)
|
|
1502
|
+
const coordinateSystemThickness = 0.01 * coordinateSystemLength
|
|
1503
|
+
this.group.add((new CoordinateSystem([0, 0, 0], coordinateSystemLength, coordinateSystemThickness)).get())
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
get(){
|
|
1507
|
+
return this.group
|
|
1508
|
+
}
|
|
1509
|
+
set_action(action){ }
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
export class DroneDefault{
|
|
1513
|
+
constructor(parameters, origin, displayIMUCoordinateSystem, displayActions){
|
|
1514
|
+
const url = window.location.href;
|
|
1515
|
+
const urlObj = new URL(url);
|
|
1516
|
+
const params = new URLSearchParams(urlObj.search);
|
|
1517
|
+
if(params.has('L2FDisplayActions') === true){
|
|
1518
|
+
displayActions = params.get('L2FDisplayActions') === "true";
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
// console.log(model)
|
|
1522
|
+
this.origin = origin
|
|
1523
|
+
this.parameters = parameters
|
|
1524
|
+
this.droneFrame = new THREE.Group()
|
|
1525
|
+
this.drone = new THREE.Group()
|
|
1526
|
+
if(origin){
|
|
1527
|
+
this.drone.position.set(...origin)
|
|
1528
|
+
}
|
|
1529
|
+
// this.drone.add((new CoordinateSystem()).get())
|
|
1530
|
+
// this.drone.add((new CoordinateSystem(10 * this.scale, 0.1 * this.scale)).get())
|
|
1531
|
+
this.scale = parameters.dynamics.mass
|
|
1532
|
+
const material = new THREE.MeshLambertMaterial({color: 0xAAAAAA})
|
|
1533
|
+
const clockwise_rotor_material = new THREE.MeshLambertMaterial({color: 0x00FF00})
|
|
1534
|
+
const counter_clockwise_rotor_material = new THREE.MeshLambertMaterial({color: 0xFF0000})
|
|
1535
|
+
|
|
1536
|
+
const coordinateSystemLength = Math.cbrt(this.scale)
|
|
1537
|
+
const coordinateSystemThickness = 0.01 * coordinateSystemLength
|
|
1538
|
+
|
|
1539
|
+
const centerSize = Math.cbrt(this.scale) / 15
|
|
1540
|
+
const centerForm = new THREE.BoxGeometry(centerSize, centerSize, centerSize*0.3)
|
|
1541
|
+
const center = new THREE.Mesh( centerForm, material);
|
|
1542
|
+
|
|
1543
|
+
this.parameters.dynamics["imu_position"] = [0, 0, 0]
|
|
1544
|
+
this.parameters.dynamics["imu_orientation"] = [1, 0, 0, 0]
|
|
1545
|
+
|
|
1546
|
+
this.imuGroup = new THREE.Group()
|
|
1547
|
+
this.imuGroup.position.set(...this.parameters.dynamics.imu_position)
|
|
1548
|
+
this.imuGroup.quaternion.set(this.parameters.dynamics.imu_orientation[1], this.parameters.dynamics.imu_orientation[2], this.parameters.dynamics.imu_orientation[3], this.parameters.dynamics.imu_orientation[0])
|
|
1549
|
+
if (displayIMUCoordinateSystem) {
|
|
1550
|
+
this.imuGroup.add((new CoordinateSystem([0, 0, 0], coordinateSystemLength, coordinateSystemThickness)).get())
|
|
1551
|
+
}
|
|
1552
|
+
this.drone.add(this.imuGroup)
|
|
1553
|
+
this.drone.add(center)
|
|
1554
|
+
|
|
1555
|
+
this.rotors = []
|
|
1556
|
+
|
|
1557
|
+
const averageArmLength = this.parameters.dynamics.rotor_positions.map(position => norm(position)).reduce((a, c) => a + c, 0) / this.parameters.dynamics.rotor_positions.length
|
|
1558
|
+
for(const [rotorIndex, rotor_position] of this.parameters.dynamics.rotor_positions.entries()){
|
|
1559
|
+
let rotorCageRadiusFactor = 1
|
|
1560
|
+
let rotorCageThicknessFactor = 1
|
|
1561
|
+
const rotorCageRadius = averageArmLength/3 * Math.sqrt(rotorCageRadiusFactor)
|
|
1562
|
+
const rotorCageThickness = averageArmLength/20 * Math.sqrt(rotorCageThicknessFactor)
|
|
1563
|
+
const armGroup = new THREE.Group()
|
|
1564
|
+
const length = norm(rotor_position)
|
|
1565
|
+
const armDiameter = averageArmLength/10
|
|
1566
|
+
const armLength = length - rotorCageRadius
|
|
1567
|
+
const armForm = new THREE.CylinderGeometry( armDiameter/2, armDiameter/2, armLength, 8 );
|
|
1568
|
+
const rot = new THREE.Quaternion(); // Geometry extends in y -> transform y to relative pos
|
|
1569
|
+
rot.setFromUnitVectors(new THREE.Vector3(...[0, 1, 0]), (new THREE.Vector3(...rotor_position)).normalize());
|
|
1570
|
+
armGroup.quaternion.set(rot.x, rot.y, rot.z, rot.w)
|
|
1571
|
+
|
|
1572
|
+
const arm = new THREE.Mesh(armForm, material)
|
|
1573
|
+
arm.position.set(0, armLength/2, 0)
|
|
1574
|
+
armGroup.add(arm)
|
|
1575
|
+
|
|
1576
|
+
const rotorGroup = new THREE.Group()
|
|
1577
|
+
rotorGroup.position.set(...rotor_position)
|
|
1578
|
+
|
|
1579
|
+
const thrust_orientation = thrust_direction_to_quaternion(this.parameters.dynamics.rotor_thrust_directions[rotorIndex])
|
|
1580
|
+
rotorGroup.quaternion.set(thrust_orientation[3], thrust_orientation[0], thrust_orientation[1], thrust_orientation[2])
|
|
1581
|
+
// rotorGroup.add((new CoordinateSystem([0, 0, 0], 0.1, 0.01)).get())
|
|
1582
|
+
const rotorCageForm = new THREE.TorusGeometry(rotorCageRadius, rotorCageThickness, 16, 32 );
|
|
1583
|
+
const cageMaterial = (this.parameters.dynamics.rotor_thrust_directions[rotorIndex][2] < 0 ? clockwise_rotor_material : counter_clockwise_rotor_material)// new THREE.MeshLambertMaterial({color: 0xAAAAAA})
|
|
1584
|
+
const rotorCage = new THREE.Mesh(rotorCageForm, cageMaterial)
|
|
1585
|
+
rotorGroup.add(rotorCage)
|
|
1586
|
+
|
|
1587
|
+
const forceArrow = new THREE.ArrowHelper(new THREE.Vector3(0,0,1), new THREE.Vector3(0,0,0 ), 0, 0x000000);
|
|
1588
|
+
if(displayActions){
|
|
1589
|
+
rotorGroup.add(forceArrow)
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
this.drone.add(rotorGroup)
|
|
1593
|
+
this.drone.add(armGroup)
|
|
1594
|
+
this.droneFrame.add(this.drone)
|
|
1595
|
+
this.rotors.push({
|
|
1596
|
+
forceArrow,
|
|
1597
|
+
rotorCage
|
|
1598
|
+
})
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
}
|
|
1602
|
+
get(){
|
|
1603
|
+
return this.droneFrame
|
|
1604
|
+
}
|
|
1605
|
+
// setState(state){
|
|
1606
|
+
// const mat = Matrix4FromRotMat(state.orientation)
|
|
1607
|
+
// this.droneFrame.quaternion.setFromRotationMatrix(mat)
|
|
1608
|
+
// this.droneFrame.position.set(state.pose.position[0] + this.origin[0], state.pose.position[1] + this.origin[1], state.pose.position[2] + this.origin[2])
|
|
1609
|
+
// const avg_rot_rate = state.rotor_states.reduce((a, c) => a + c["power"], 0)/state.rotor_states.length
|
|
1610
|
+
// state.rotor_states.map((rotorState, i) => {
|
|
1611
|
+
// const forceArrow = this.rotors[i].forceArrow
|
|
1612
|
+
// const rotorCage = this.rotors[i].rotorCage
|
|
1613
|
+
// const min_rpm = this.model.rotors[i].min_rpm
|
|
1614
|
+
// const max_rpm = this.model.rotors[i].max_rpm
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
// const rot_rate = rotorState["power"]
|
|
1618
|
+
// const force_magnitude = (rot_rate - avg_rot_rate)/max_rpm * 10///1000
|
|
1619
|
+
// forceArrow.setDirection(new THREE.Vector3(0, 0, rot_rate)) //Math.sign(force_magnitude)))
|
|
1620
|
+
// forceArrow.setLength(Math.cbrt(this.this.scale)/10) //Math.abs(force_magnitude))
|
|
1621
|
+
// })
|
|
1622
|
+
// }
|
|
1623
|
+
set_action(action){
|
|
1624
|
+
for(let i = 0; i < 4; i++){
|
|
1625
|
+
const forceArrow = this.rotors[i].forceArrow
|
|
1626
|
+
const force_magnitude = action[i]
|
|
1627
|
+
forceArrow.setDirection(new THREE.Vector3(0, 0, force_magnitude))
|
|
1628
|
+
forceArrow.setLength(Math.cbrt(this.scale)/10)
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
async function drone_factory(parameters, origin, displayIMUCoordinateSystem, displayActions, conta_url){
|
|
1635
|
+
if(parameters.ui && parameters.ui.enable && parameters.ui.model){
|
|
1636
|
+
try{
|
|
1637
|
+
const model = new DroneMesh(parameters, origin, displayIMUCoordinateSystem, displayActions, conta_url)
|
|
1638
|
+
await model.loaded
|
|
1639
|
+
return model
|
|
1640
|
+
}
|
|
1641
|
+
catch(error){
|
|
1642
|
+
console.error("An error occurred:", error.message);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
return new DroneDefault(parameters, origin, displayIMUCoordinateSystem, displayActions)
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
export async function init(canvas, options){
|
|
1649
|
+
const state = new State(canvas, options)
|
|
1650
|
+
await state.initialize()
|
|
1651
|
+
return state
|
|
1652
|
+
}
|
|
1653
|
+
function clear_episode(ui_state){
|
|
1654
|
+
if(ui_state.drone){
|
|
1655
|
+
ui_state.simulator.remove(ui_state.drone.get())
|
|
1656
|
+
if(ui_state.showAxes){
|
|
1657
|
+
ui_state.simulator.remove(ui_state.origin_coordinate_system.get())
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
if(ui_state.drones){
|
|
1661
|
+
ui_state.drones.map(drone => ui_state.simulator.remove(drone.get()))
|
|
1662
|
+
if(ui_state.showAxes){
|
|
1663
|
+
ui_state.origin_coordinate_systems.map(cs => ui_state.simulator.remove(cs.get()))
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
// Clear trajectory visualization
|
|
1667
|
+
if(ui_state.trajectoryVis){
|
|
1668
|
+
ui_state.simulator.remove(ui_state.trajectoryVis.group)
|
|
1669
|
+
ui_state.trajectoryVis = null
|
|
1670
|
+
}
|
|
1671
|
+
if(ui_state.trajectoryVisArray){
|
|
1672
|
+
ui_state.trajectoryVisArray.forEach(tv => {
|
|
1673
|
+
if(tv) ui_state.simulator.remove(tv.group)
|
|
1674
|
+
})
|
|
1675
|
+
ui_state.trajectoryVisArray = null
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
function set_camera(ui_state, distance, target){
|
|
1679
|
+
const scale = 1/Math.sqrt(ui_state.camera_position[0]**2 + ui_state.camera_position[1]**2 + ui_state.camera_position[2]**2) * distance
|
|
1680
|
+
const tx = target ? target[0] : 0
|
|
1681
|
+
const ty = target ? target[1] : 0
|
|
1682
|
+
const tz = target ? target[2] : 0
|
|
1683
|
+
if(!ui_state.camera_set){
|
|
1684
|
+
ui_state.camera.position.set(ui_state.camera_position[0] * scale + tx, ui_state.camera_position[1] * scale + ty, ui_state.camera_position[2] * scale + tz)
|
|
1685
|
+
ui_state.camera.lookAt(tx, ty, tz)
|
|
1686
|
+
if(ui_state.controls){
|
|
1687
|
+
ui_state.controls.target.set(tx, ty, tz)
|
|
1688
|
+
}
|
|
1689
|
+
ui_state.camera_set = true
|
|
1690
|
+
if(ui_state.controls) ui_state.controls.update()
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
export async function episode_init(ui_state, parameters){
|
|
1694
|
+
let distance = (parameters.ui && parameters.ui.camera_distance) ? parameters.ui.camera_distance : Math.cbrt(parameters.dynamics.mass) * 2
|
|
1695
|
+
if(ui_state.camera_distance){
|
|
1696
|
+
distance = ui_state.camera_distance
|
|
1697
|
+
}
|
|
1698
|
+
set_camera(ui_state, distance)
|
|
1699
|
+
clear_episode(ui_state)
|
|
1700
|
+
ui_state.drone = await drone_factory(parameters, [0, 0, 0], ui_state.showAxes, false, ui_state.conta_url)
|
|
1701
|
+
ui_state.simulator.add(ui_state.drone.get())
|
|
1702
|
+
const scale = parameters.dynamics.mass
|
|
1703
|
+
if(ui_state.showAxes){
|
|
1704
|
+
ui_state.origin_coordinate_system = new CoordinateSystem([0, 0, 0], 1 * scale, 0.01 * scale)
|
|
1705
|
+
ui_state.simulator.add(ui_state.origin_coordinate_system.get())
|
|
1706
|
+
}
|
|
1707
|
+
ui_state.trajectoryVis = create_trajectory_visualization(parameters, scale)
|
|
1708
|
+
if(ui_state.trajectoryVis){
|
|
1709
|
+
ui_state.simulator.add(ui_state.trajectoryVis.group)
|
|
1710
|
+
}
|
|
1711
|
+
await setup_onboard_camera(ui_state, parameters)
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
export async function episode_init_multi(ui_state, parameters){
|
|
1715
|
+
const grid_distance = 0.0
|
|
1716
|
+
const grid_size = Math.ceil(Math.sqrt(parameters.length))
|
|
1717
|
+
let distance = (grid_distance > 0 ? grid_distance * grid_size * 2 : Math.cbrt(parameters[0].dynamics.mass))
|
|
1718
|
+
if(parameters.ui && parameters.ui.camera_distance){
|
|
1719
|
+
distance = parameters.ui.camera_distance
|
|
1720
|
+
}
|
|
1721
|
+
if(ui_state.camera_distance){
|
|
1722
|
+
distance = ui_state.camera_distance
|
|
1723
|
+
}
|
|
1724
|
+
set_camera(ui_state, distance)
|
|
1725
|
+
clear_episode(ui_state)
|
|
1726
|
+
ui_state.drones = []
|
|
1727
|
+
ui_state.trajectoryVisArray = []
|
|
1728
|
+
if(!ui_state.showAxes && ui_state.origin_coordinate_systems){
|
|
1729
|
+
ui_state.origin_coordinate_systems.forEach(cs => {
|
|
1730
|
+
ui_state.simulator.remove(cs.get())
|
|
1731
|
+
})
|
|
1732
|
+
}
|
|
1733
|
+
ui_state.origin_coordinate_systems = []
|
|
1734
|
+
await Promise.all(parameters.map(async (parameter, i) => {
|
|
1735
|
+
const x = (i % grid_size) * grid_distance
|
|
1736
|
+
const y = Math.floor(i / grid_size) * grid_distance
|
|
1737
|
+
const drone = await drone_factory(parameter, [x, y, 0], ui_state.showAxes, false, ui_state.conta_url)
|
|
1738
|
+
ui_state.simulator.add(drone.get())
|
|
1739
|
+
if(ui_state.showAxes){
|
|
1740
|
+
const cs = new CoordinateSystem([x, y, 0], 1, 0.01)
|
|
1741
|
+
ui_state.simulator.add(cs.get())
|
|
1742
|
+
ui_state.origin_coordinate_systems.push(cs)
|
|
1743
|
+
}
|
|
1744
|
+
ui_state.drones.push(drone)
|
|
1745
|
+
// Create trajectory visualization for first N drones only (performance optimization)
|
|
1746
|
+
const MAX_TRAJECTORY_VISUALIZATIONS = 5
|
|
1747
|
+
if(i < MAX_TRAJECTORY_VISUALIZATIONS){
|
|
1748
|
+
const scale = parameter.dynamics.mass
|
|
1749
|
+
const trajectoryVis = create_trajectory_visualization(parameter, scale)
|
|
1750
|
+
if(trajectoryVis){
|
|
1751
|
+
// Offset trajectory to match drone grid position
|
|
1752
|
+
trajectoryVis.group.position.set(x, y, 0)
|
|
1753
|
+
ui_state.simulator.add(trajectoryVis.group)
|
|
1754
|
+
}
|
|
1755
|
+
ui_state.trajectoryVisArray.push(trajectoryVis)
|
|
1756
|
+
} else {
|
|
1757
|
+
ui_state.trajectoryVisArray.push(null)
|
|
1758
|
+
}
|
|
1759
|
+
}))
|
|
1760
|
+
await setup_onboard_camera(ui_state, parameters[0])
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
function get_desired_onboard_dims(parameters){
|
|
1764
|
+
const visual = parameters && parameters.visual
|
|
1765
|
+
if(visual && visual.cam_width && visual.cam_height && visual.fov){
|
|
1766
|
+
return {
|
|
1767
|
+
cam_w: visual.cam_width,
|
|
1768
|
+
cam_h: visual.cam_height,
|
|
1769
|
+
fov: visual.fov,
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
throw new Error("get_desired_onboard_dims: parameters.visual is missing cam_width/cam_height")
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
function ensure_onboard_render_state(ui_state, cam_w, cam_h, fov){
|
|
1776
|
+
if(!ui_state.onboard_scene) return
|
|
1777
|
+
const aspect = cam_w / cam_h
|
|
1778
|
+
const vfov_deg = 2 * Math.atan(Math.tan(fov / 2) / aspect) * 180 / Math.PI
|
|
1779
|
+
let rt_changed = false
|
|
1780
|
+
if(!ui_state.onboard_render_target){
|
|
1781
|
+
ui_state.onboard_render_target = new THREE.WebGLRenderTarget(cam_w, cam_h)
|
|
1782
|
+
rt_changed = true
|
|
1783
|
+
} else if(ui_state.onboard_render_target.width !== cam_w || ui_state.onboard_render_target.height !== cam_h){
|
|
1784
|
+
ui_state.onboard_render_target.setSize(cam_w, cam_h)
|
|
1785
|
+
rt_changed = true
|
|
1786
|
+
}
|
|
1787
|
+
const buf_size = cam_w * cam_h * 4
|
|
1788
|
+
if(!ui_state.onboard_pixel_buffer || ui_state.onboard_pixel_buffer.length !== buf_size){
|
|
1789
|
+
ui_state.onboard_pixel_buffer = new Uint8Array(buf_size)
|
|
1790
|
+
}
|
|
1791
|
+
if(ui_state.onboard_camera){
|
|
1792
|
+
const eps = 1e-4
|
|
1793
|
+
if(Math.abs(ui_state.onboard_camera.aspect - aspect) > eps || Math.abs(ui_state.onboard_camera.fov - vfov_deg) > eps){
|
|
1794
|
+
ui_state.onboard_camera.aspect = aspect
|
|
1795
|
+
ui_state.onboard_camera.fov = vfov_deg
|
|
1796
|
+
ui_state.onboard_camera.updateProjectionMatrix()
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
ui_state.onboard_overlay_max_extent = Math.max(cam_w, cam_h) * 3
|
|
1800
|
+
if(rt_changed){
|
|
1801
|
+
ui_state.onboard_overlay_quad = null
|
|
1802
|
+
ui_state.onboard_overlay_blit_scene = null
|
|
1803
|
+
ui_state.onboard_overlay_blit_camera = null
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
async function setup_onboard_camera(ui_state, parameters){
|
|
1808
|
+
const visual = parameters.visual
|
|
1809
|
+
if(!visual || !visual.scene_hash || visual.scene_hash === '0000000000000000000000000000000000000000') return
|
|
1810
|
+
const dims = get_desired_onboard_dims(parameters)
|
|
1811
|
+
const aspect = dims.cam_w / dims.cam_h
|
|
1812
|
+
const vfov_deg = 2 * Math.atan(Math.tan(dims.fov / 2) / aspect) * 180 / Math.PI
|
|
1813
|
+
ui_state.onboard_camera = new THREE.PerspectiveCamera(vfov_deg, aspect, 0.05, 100)
|
|
1814
|
+
ui_state.onboard_scene = new THREE.Scene()
|
|
1815
|
+
ui_state.onboard_scene.background = new THREE.Color(0x87CEEB)
|
|
1816
|
+
const ambient = new THREE.AmbientLight(0xffffff, 0.6)
|
|
1817
|
+
ui_state.onboard_scene.add(ambient)
|
|
1818
|
+
const dir_light = new THREE.DirectionalLight(0xffffff, 0.8)
|
|
1819
|
+
dir_light.position.set(5, 10, 5)
|
|
1820
|
+
ui_state.onboard_scene.add(dir_light)
|
|
1821
|
+
const scene_url = `${ui_state.conta_url}data/${visual.scene_hash}`
|
|
1822
|
+
try {
|
|
1823
|
+
const prev_enabled = THREE.ColorManagement.enabled
|
|
1824
|
+
THREE.ColorManagement.enabled = false
|
|
1825
|
+
const gltf = await new GLTFLoader().loadAsync(scene_url)
|
|
1826
|
+
THREE.ColorManagement.enabled = prev_enabled
|
|
1827
|
+
ui_state.onboard_scene.add(gltf.scene)
|
|
1828
|
+
} catch(e) {
|
|
1829
|
+
console.error('Failed to load scene GLB for onboard camera:', e)
|
|
1830
|
+
ui_state.onboard_camera = null
|
|
1831
|
+
ui_state.onboard_scene = null
|
|
1832
|
+
}
|
|
1833
|
+
ui_state.onboard_scene_translation = visual.scene_translation || [0, 0, 0]
|
|
1834
|
+
ensure_onboard_render_state(ui_state, dims.cam_w, dims.cam_h, dims.fov)
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
function update_onboard_camera(ui_state, state, parameters){
|
|
1838
|
+
if(!ui_state.onboard_camera || !ui_state.onboard_scene) return
|
|
1839
|
+
const st = ui_state.onboard_scene_translation || [0, 0, 0]
|
|
1840
|
+
// FLU (X-fwd, Y-left, Z-up) → Three.js Y-up: (x,y,z) → (x, z, -y)
|
|
1841
|
+
// st is in FLU coordinates
|
|
1842
|
+
ui_state.onboard_camera.position.set(state.position[0] + st[0], state.position[2] + st[2], -(state.position[1] + st[1]))
|
|
1843
|
+
// FLU quat axis (ax,ay,az) → Three.js axis (ax, az, -ay)
|
|
1844
|
+
const qw = state.orientation[0], qx = state.orientation[1], qy = state.orientation[2], qz = state.orientation[3]
|
|
1845
|
+
const scene_quat = new THREE.Quaternion(qx, qz, -qy, qw)
|
|
1846
|
+
// Camera forward = body +X = Three.js +X, Three.js camera looks along -Z
|
|
1847
|
+
const body_to_cam = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), -Math.PI / 2)
|
|
1848
|
+
ui_state.onboard_camera.quaternion.copy(scene_quat.multiply(body_to_cam))
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
function render_onboard_overlay(ui_state){
|
|
1852
|
+
if(!ui_state.onboard_camera || !ui_state.onboard_scene || !ui_state.renderer) return
|
|
1853
|
+
const max_extent = ui_state.onboard_overlay_max_extent || 128
|
|
1854
|
+
const rt = ui_state.onboard_render_target
|
|
1855
|
+
const rt_aspect = (rt && rt.width && rt.height) ? (rt.width / rt.height) : (ui_state.onboard_camera.aspect || 1)
|
|
1856
|
+
const overlay_w = rt_aspect >= 1 ? max_extent : Math.max(1, Math.round(max_extent * rt_aspect))
|
|
1857
|
+
const overlay_h = rt_aspect >= 1 ? Math.max(1, Math.round(max_extent / rt_aspect)) : max_extent
|
|
1858
|
+
const margin = 10
|
|
1859
|
+
const canvas_w = ui_state.canvas.width / ui_state.devicePixelRatio
|
|
1860
|
+
const canvas_h = ui_state.canvas.height / ui_state.devicePixelRatio
|
|
1861
|
+
const x = canvas_w - overlay_w - margin
|
|
1862
|
+
const prev_autoClear = ui_state.renderer.autoClear
|
|
1863
|
+
ui_state.renderer.autoClear = false
|
|
1864
|
+
ui_state.renderer.setScissorTest(true)
|
|
1865
|
+
ui_state.renderer.setViewport(x, margin, overlay_w, overlay_h)
|
|
1866
|
+
ui_state.renderer.setScissor(x, margin, overlay_w, overlay_h)
|
|
1867
|
+
ui_state.renderer.clearDepth()
|
|
1868
|
+
if(ui_state.onboard_obs_resolution && ui_state.onboard_render_target){
|
|
1869
|
+
if(!ui_state.onboard_overlay_quad){
|
|
1870
|
+
const geo = new THREE.PlaneGeometry(2, 2)
|
|
1871
|
+
const mat = new THREE.MeshBasicMaterial({map: ui_state.onboard_render_target.texture, depthTest: false})
|
|
1872
|
+
mat.map.magFilter = THREE.NearestFilter
|
|
1873
|
+
ui_state.onboard_overlay_quad = new THREE.Mesh(geo, mat)
|
|
1874
|
+
ui_state.onboard_overlay_blit_scene = new THREE.Scene()
|
|
1875
|
+
ui_state.onboard_overlay_blit_scene.add(ui_state.onboard_overlay_quad)
|
|
1876
|
+
ui_state.onboard_overlay_blit_camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1)
|
|
1877
|
+
}
|
|
1878
|
+
ui_state.renderer.render(ui_state.onboard_overlay_blit_scene, ui_state.onboard_overlay_blit_camera)
|
|
1879
|
+
} else {
|
|
1880
|
+
ui_state.renderer.render(ui_state.onboard_scene, ui_state.onboard_camera)
|
|
1881
|
+
}
|
|
1882
|
+
ui_state.renderer.setScissorTest(false)
|
|
1883
|
+
ui_state.renderer.setViewport(0, 0, canvas_w, canvas_h)
|
|
1884
|
+
ui_state.renderer.autoClear = prev_autoClear
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
export async function setup_onboard_scene(ui_state, scene_hash, cam_w, cam_h, fov){
|
|
1888
|
+
const aspect = cam_w / cam_h
|
|
1889
|
+
const vfov_deg = 2 * Math.atan(Math.tan(fov / 2) / aspect) * 180 / Math.PI
|
|
1890
|
+
ui_state.onboard_camera = new THREE.PerspectiveCamera(vfov_deg, aspect, 0.05, 100)
|
|
1891
|
+
ui_state.onboard_scene = new THREE.Scene()
|
|
1892
|
+
ui_state.onboard_scene.background = new THREE.Color(0x87CEEB)
|
|
1893
|
+
ui_state.onboard_scene.add(new THREE.AmbientLight(0xffffff, 0.6))
|
|
1894
|
+
const dir_light = new THREE.DirectionalLight(0xffffff, 0.8)
|
|
1895
|
+
dir_light.position.set(5, 10, 5)
|
|
1896
|
+
ui_state.onboard_scene.add(dir_light)
|
|
1897
|
+
if(scene_hash && scene_hash !== 'none'){
|
|
1898
|
+
const scene_url = `${ui_state.conta_url}${scene_hash}`
|
|
1899
|
+
try {
|
|
1900
|
+
const prev_enabled = THREE.ColorManagement.enabled
|
|
1901
|
+
THREE.ColorManagement.enabled = false
|
|
1902
|
+
const gltf = await new GLTFLoader().loadAsync(scene_url)
|
|
1903
|
+
THREE.ColorManagement.enabled = prev_enabled
|
|
1904
|
+
ui_state.onboard_scene.add(gltf.scene)
|
|
1905
|
+
} catch(e) {
|
|
1906
|
+
console.error('Failed to load scene GLB:', e)
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
ui_state.onboard_scene_translation = [0, 0, 0]
|
|
1910
|
+
ensure_onboard_render_state(ui_state, cam_w, cam_h, fov)
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
export function render_onboard_pixels(ui_state, state, parameters){
|
|
1914
|
+
if(!ui_state.onboard_camera || !ui_state.onboard_scene || !ui_state.renderer) return null
|
|
1915
|
+
const dims = get_desired_onboard_dims(parameters)
|
|
1916
|
+
ensure_onboard_render_state(ui_state, dims.cam_w, dims.cam_h, dims.fov)
|
|
1917
|
+
if(!ui_state.onboard_render_target) return null
|
|
1918
|
+
update_onboard_camera(ui_state, state, parameters)
|
|
1919
|
+
ui_state.renderer.setRenderTarget(ui_state.onboard_render_target)
|
|
1920
|
+
ui_state.renderer.render(ui_state.onboard_scene, ui_state.onboard_camera)
|
|
1921
|
+
ui_state.renderer.setRenderTarget(null)
|
|
1922
|
+
const w = ui_state.onboard_render_target.width, h = ui_state.onboard_render_target.height
|
|
1923
|
+
ui_state.renderer.readRenderTargetPixels(ui_state.onboard_render_target, 0, 0, w, h, ui_state.onboard_pixel_buffer)
|
|
1924
|
+
const rgb = new Float32Array(w * h * 3)
|
|
1925
|
+
for(let y = 0; y < h; y++){
|
|
1926
|
+
const src_y = h - 1 - y
|
|
1927
|
+
for(let x = 0; x < w; x++){
|
|
1928
|
+
const dst = (y * w + x) * 3
|
|
1929
|
+
const src = (src_y * w + x) * 4
|
|
1930
|
+
rgb[dst + 0] = ui_state.onboard_pixel_buffer[src + 0] / 255
|
|
1931
|
+
rgb[dst + 1] = ui_state.onboard_pixel_buffer[src + 1] / 255
|
|
1932
|
+
rgb[dst + 2] = ui_state.onboard_pixel_buffer[src + 2] / 255
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return rgb
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
function update_camera(ui_state){
|
|
1939
|
+
const currentWidth = ui_state.canvas.width
|
|
1940
|
+
const currentHeight = ui_state.canvas.height
|
|
1941
|
+
const hasResized = currentWidth !== ui_state.lastCanvasWidth || currentHeight !== ui_state.lastCanvasHeight
|
|
1942
|
+
|
|
1943
|
+
if (hasResized) {
|
|
1944
|
+
const width = currentWidth / ui_state.devicePixelRatio;
|
|
1945
|
+
const height = currentHeight / ui_state.devicePixelRatio;
|
|
1946
|
+
|
|
1947
|
+
if (ui_state.camera.aspect !== width / height) {
|
|
1948
|
+
ui_state.camera.aspect = width / height;
|
|
1949
|
+
ui_state.camera.updateProjectionMatrix();
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
if (ui_state.renderer) {
|
|
1953
|
+
ui_state.renderer.setPixelRatio(ui_state.devicePixelRatio);
|
|
1954
|
+
ui_state.renderer.setSize(width, height, false);
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
ui_state.lastCanvasWidth = currentWidth
|
|
1958
|
+
ui_state.lastCanvasHeight = currentHeight
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
if(ui_state.interactive && ui_state.controls){
|
|
1962
|
+
ui_state.controls.update()
|
|
1963
|
+
}
|
|
1964
|
+
if(ui_state.renderer){
|
|
1965
|
+
ui_state.renderer.render(ui_state.scene, ui_state.camera);
|
|
1966
|
+
}
|
|
1967
|
+
ui_state.render_tick += 1
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
function clip_position(scale, position){
|
|
1971
|
+
const extent = Math.cbrt(scale) * 300 // to maybe prevent threejs from exploding
|
|
1972
|
+
const max_position = extent
|
|
1973
|
+
const min_position = -extent
|
|
1974
|
+
return position.map((p) => {
|
|
1975
|
+
if(p > max_position){
|
|
1976
|
+
return max_position
|
|
1977
|
+
}
|
|
1978
|
+
else if(p < min_position){
|
|
1979
|
+
return min_position
|
|
1980
|
+
}
|
|
1981
|
+
else{
|
|
1982
|
+
return p
|
|
1983
|
+
}
|
|
1984
|
+
})
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
function get_trajectory_index(trajectory_step, trajectory_length){
|
|
1988
|
+
const full_step = trajectory_step
|
|
1989
|
+
const interval = Math.floor(full_step / trajectory_length)
|
|
1990
|
+
const forward = interval % 2 === 0
|
|
1991
|
+
const progress = full_step % trajectory_length
|
|
1992
|
+
const position = forward ? progress : (trajectory_length - progress - 1)
|
|
1993
|
+
return position
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
function create_trajectory_visualization(parameters, scale){
|
|
1997
|
+
if(!parameters.trajectory || !parameters.trajectory.steps){
|
|
1998
|
+
return null
|
|
1999
|
+
}
|
|
2000
|
+
const trajectory = parameters.trajectory
|
|
2001
|
+
const steps = trajectory.steps
|
|
2002
|
+
if(steps.length < 2){
|
|
2003
|
+
return null
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
const group = new THREE.Group()
|
|
2007
|
+
|
|
2008
|
+
// Create trajectory line
|
|
2009
|
+
const points = steps.map(step => new THREE.Vector3(step.position[0], step.position[1], step.position[2]))
|
|
2010
|
+
const curve = new THREE.CatmullRomCurve3(points, false)
|
|
2011
|
+
const lineThickness = Math.cbrt(scale) * 0.02
|
|
2012
|
+
const tubeGeometry = new THREE.TubeGeometry(curve, steps.length * 4, lineThickness, 8, false)
|
|
2013
|
+
const lineMaterial = new THREE.MeshLambertMaterial({color: 0x4488FF, transparent: true, opacity: 0.6})
|
|
2014
|
+
const trajectoryMesh = new THREE.Mesh(tubeGeometry, lineMaterial)
|
|
2015
|
+
group.add(trajectoryMesh)
|
|
2016
|
+
|
|
2017
|
+
// Create bug (target indicator sphere)
|
|
2018
|
+
const bugRadius = Math.cbrt(scale) * 0.05
|
|
2019
|
+
const bugGeometry = new THREE.SphereGeometry(bugRadius, 16, 16)
|
|
2020
|
+
const bugMaterial = new THREE.MeshLambertMaterial({color: 0xFF4444, emissive: 0x441111})
|
|
2021
|
+
const bug = new THREE.Mesh(bugGeometry, bugMaterial)
|
|
2022
|
+
bug.position.set(steps[0].position[0], steps[0].position[1], steps[0].position[2])
|
|
2023
|
+
group.add(bug)
|
|
2024
|
+
|
|
2025
|
+
return {
|
|
2026
|
+
group: group,
|
|
2027
|
+
bug: bug,
|
|
2028
|
+
steps: steps,
|
|
2029
|
+
length: trajectory.LENGTH || steps.length
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
function update_trajectory_bug(trajectoryVis, trajectory_step){
|
|
2034
|
+
if(!trajectoryVis || !trajectoryVis.bug || trajectory_step === undefined){
|
|
2035
|
+
return
|
|
2036
|
+
}
|
|
2037
|
+
const index = get_trajectory_index(trajectory_step, trajectoryVis.length)
|
|
2038
|
+
const step = trajectoryVis.steps[index]
|
|
2039
|
+
if(step){
|
|
2040
|
+
trajectoryVis.bug.position.set(step.position[0], step.position[1], step.position[2])
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
export async function render(ui_state, parameters, state, action) {
|
|
2045
|
+
if(ui_state.drone){
|
|
2046
|
+
ui_state.drone.get().position.set(...clip_position(parameters.dynamics.mass, state.position))
|
|
2047
|
+
ui_state.drone.get().quaternion.copy(new THREE.Quaternion(state.orientation[1], state.orientation[2], state.orientation[3], state.orientation[0]).normalize())
|
|
2048
|
+
}
|
|
2049
|
+
if(ui_state.trajectoryVis && state.trajectory && state.trajectory.trajectory_step !== undefined){
|
|
2050
|
+
update_trajectory_bug(ui_state.trajectoryVis, state.trajectory.trajectory_step)
|
|
2051
|
+
}
|
|
2052
|
+
if(ui_state.show_onboard_preview && ui_state.onboard_scene){
|
|
2053
|
+
const dims = get_desired_onboard_dims(parameters)
|
|
2054
|
+
ensure_onboard_render_state(ui_state, dims.cam_w, dims.cam_h, dims.fov)
|
|
2055
|
+
if(ui_state.onboard_obs_resolution && ui_state.onboard_render_target){
|
|
2056
|
+
render_onboard_pixels(ui_state, state, parameters)
|
|
2057
|
+
} else {
|
|
2058
|
+
update_onboard_camera(ui_state, state, parameters)
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
update_camera(ui_state)
|
|
2062
|
+
if(ui_state.show_onboard_preview && ui_state.onboard_scene) render_onboard_overlay(ui_state)
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
export async function render_multi(ui_state, parameters, states, actions){
|
|
2066
|
+
if(ui_state.drones && ui_state.drones.length == states.length){
|
|
2067
|
+
states.map((state, i) => {
|
|
2068
|
+
const action = actions[i]
|
|
2069
|
+
const current_parameters = parameters[i]
|
|
2070
|
+
ui_state.drones[i].get().position.set(...clip_position(current_parameters.dynamics.mass, state.position))
|
|
2071
|
+
ui_state.drones[i].get().quaternion.copy(new THREE.Quaternion(state.orientation[1], state.orientation[2], state.orientation[3], state.orientation[0]).normalize())
|
|
2072
|
+
ui_state.drones[i].set_action(action)
|
|
2073
|
+
if(ui_state.trajectoryVisArray && ui_state.trajectoryVisArray[i] && state.trajectory && state.trajectory.trajectory_step !== undefined){
|
|
2074
|
+
update_trajectory_bug(ui_state.trajectoryVisArray[i], state.trajectory.trajectory_step)
|
|
2075
|
+
}
|
|
2076
|
+
})
|
|
2077
|
+
if(ui_state.show_onboard_preview && ui_state.onboard_scene){
|
|
2078
|
+
const dims = get_desired_onboard_dims(parameters[0])
|
|
2079
|
+
ensure_onboard_render_state(ui_state, dims.cam_w, dims.cam_h, dims.fov)
|
|
2080
|
+
if(ui_state.onboard_obs_resolution && ui_state.onboard_render_target){
|
|
2081
|
+
render_onboard_pixels(ui_state, states[0], parameters[0])
|
|
2082
|
+
} else {
|
|
2083
|
+
update_onboard_camera(ui_state, states[0], parameters[0])
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
update_camera(ui_state)
|
|
2088
|
+
if(ui_state.show_onboard_preview && ui_state.onboard_scene) render_onboard_overlay(ui_state)
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
)RL_TOOLS_LITERAL";
|
|
2111
|
+
#else
|
|
2112
|
+
std::string ui = "";
|
|
2113
|
+
#endif
|
|
2114
|
+
return ui;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
RL_TOOLS_NAMESPACE_WRAPPER_END
|
|
2118
|
+
|
|
2119
|
+
#endif
|