hyperray 0.0.1__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.
Files changed (788) hide show
  1. hyperdrone/__init__.py +53 -0
  2. hyperdrone/_cuda/__init__.py +76 -0
  3. hyperdrone/_dlpack.py +30 -0
  4. hyperdrone/_jit/__init__.py +131 -0
  5. hyperdrone/_jit/_build.py +113 -0
  6. hyperdrone/_jit/_lock.py +23 -0
  7. hyperdrone/_jit/_patches.py +99 -0
  8. hyperdrone/_jit/_toolchain.py +17 -0
  9. hyperdrone/_jit/_workspace.py +94 -0
  10. hyperdrone/_native/cmake/hyperdrone_jit.cmake +65 -0
  11. hyperdrone/_native/common/bindings.h +39 -0
  12. hyperdrone/_native/common/cuda_staging.h +80 -0
  13. hyperdrone/_native/common/jit_host.h +69 -0
  14. hyperdrone/_native/common/models.h +24 -0
  15. hyperdrone/_native/common/verbosity.h +52 -0
  16. hyperdrone/_native/dynamics/CMakeLists.txt +63 -0
  17. hyperdrone/_native/dynamics/host.cpp +188 -0
  18. hyperdrone/_native/dynamics/iface.h +71 -0
  19. hyperdrone/_native/dynamics/impl.cpp +638 -0
  20. hyperdrone/_native/env/CMakeLists.txt +98 -0
  21. hyperdrone/_native/env/environment.cpp +190 -0
  22. hyperdrone/_native/env/environment.h +282 -0
  23. hyperdrone/_native/env/impl.cpp +779 -0
  24. hyperdrone/_native/env/rotorcraft_bindings.cpp +53 -0
  25. hyperdrone/_native/render/CMakeLists.txt +96 -0
  26. hyperdrone/_native/render/renderer.cpp +973 -0
  27. hyperdrone/_native/render/rig_bindings.h +152 -0
  28. hyperdrone/_native/render/scene_bindings.cpp +515 -0
  29. hyperdrone/_outputs.py +32 -0
  30. hyperdrone/_parameters.py +36 -0
  31. hyperdrone/_vendor/rl-tools/CMakeLists.txt +207 -0
  32. hyperdrone/_vendor/rl-tools/LICENSE +21 -0
  33. hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +34 -0
  34. hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +100 -0
  35. hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +24 -0
  36. hyperdrone/_vendor/rl-tools/cmake/autodetect/summary.cmake +65 -0
  37. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier0-compiler.cmake +18 -0
  38. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +51 -0
  39. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +82 -0
  40. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +25 -0
  41. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +42 -0
  42. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +24 -0
  43. hyperdrone/_vendor/rl-tools/cmake/dependencies/assimp.cmake +19 -0
  44. hyperdrone/_vendor/rl-tools/cmake/legacy_flags.cmake +33 -0
  45. hyperdrone/_vendor/rl-tools/cmake/optional/assimp.cmake +30 -0
  46. hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +20 -0
  47. hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +25 -0
  48. hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +89 -0
  49. hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +25 -0
  50. hyperdrone/_vendor/rl-tools/cmake/optional/raytracing.cmake +105 -0
  51. hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +2 -0
  52. hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +4 -0
  53. hyperdrone/_vendor/rl-tools/cmake/optional/webgpu.cmake +24 -0
  54. hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
  55. hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
  56. hyperdrone/_vendor/rl-tools/include/conta/conta.h +1480 -0
  57. hyperdrone/_vendor/rl-tools/include/metra/metra.h +381 -0
  58. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
  59. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
  60. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
  61. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
  62. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
  63. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
  64. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
  65. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
  66. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
  67. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
  68. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +944 -0
  69. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
  70. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
  71. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
  72. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
  73. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
  74. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
  75. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
  76. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
  77. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +713 -0
  78. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1356 -0
  79. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
  80. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
  81. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
  82. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +210 -0
  83. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
  84. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
  85. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_emscripten.h +20 -0
  86. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
  87. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
  88. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
  89. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +464 -0
  90. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda_streams.h +23 -0
  91. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +105 -0
  92. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
  93. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
  94. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
  95. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
  96. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
  97. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +769 -0
  98. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
  99. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
  100. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
  101. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
  102. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +117 -0
  103. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
  104. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
  105. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
  106. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
  107. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
  108. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
  109. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
  110. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
  111. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
  112. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
  113. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
  114. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
  115. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
  116. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +57 -0
  117. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
  118. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
  119. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
  120. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
  121. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
  122. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +138 -0
  123. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +380 -0
  124. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
  125. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
  126. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +295 -0
  127. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +230 -0
  128. hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +98 -0
  129. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +113 -0
  130. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +61 -0
  131. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +31 -0
  132. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/group.h +99 -0
  133. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
  134. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
  135. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +186 -0
  136. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
  137. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
  138. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
  139. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +809 -0
  140. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1219 -0
  141. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
  142. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
  143. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
  144. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
  145. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
  146. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
  147. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
  148. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
  149. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
  150. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
  151. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
  152. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
  153. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
  154. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
  155. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +429 -0
  156. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
  157. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
  158. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +59 -0
  159. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
  160. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
  161. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +536 -0
  162. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
  163. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
  164. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +223 -0
  165. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
  166. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
  167. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +154 -0
  168. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
  169. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
  170. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +602 -0
  171. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +251 -0
  172. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +206 -0
  173. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +889 -0
  174. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
  175. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
  176. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
  177. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
  178. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
  179. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +216 -0
  180. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
  181. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
  182. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
  183. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
  184. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
  185. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
  186. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
  187. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
  188. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
  189. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
  190. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
  191. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +446 -0
  192. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
  193. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
  194. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
  195. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +502 -0
  196. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
  197. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
  198. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
  199. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
  200. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +295 -0
  201. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
  202. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
  203. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
  204. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +272 -0
  205. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
  206. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
  207. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
  208. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
  209. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +160 -0
  210. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
  211. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
  212. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
  213. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
  214. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +230 -0
  215. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
  216. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
  217. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
  218. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
  219. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +14 -0
  220. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
  221. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
  222. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
  223. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
  224. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
  225. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
  226. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
  227. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
  228. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +15 -0
  229. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +121 -0
  230. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +98 -0
  231. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +150 -0
  232. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
  233. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +80 -0
  234. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +85 -0
  235. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +109 -0
  236. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
  237. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +107 -0
  238. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
  239. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +68 -0
  240. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
  241. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +85 -0
  242. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +140 -0
  243. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
  244. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +72 -0
  245. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +49 -0
  246. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +50 -0
  247. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +92 -0
  248. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/update.h +54 -0
  249. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
  250. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +98 -0
  251. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +79 -0
  252. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
  253. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +136 -0
  254. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
  255. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
  256. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/behaviors/skip_parameter_gradients.h +65 -0
  257. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/README.md +107 -0
  258. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/model.h +19 -0
  259. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/persist_code.h +77 -0
  260. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
  261. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
  262. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
  263. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +407 -0
  264. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
  265. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
  266. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +55 -0
  267. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +86 -0
  268. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
  269. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +142 -0
  270. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
  271. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
  272. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +288 -0
  273. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
  274. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
  275. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
  276. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
  277. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
  278. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +4 -0
  279. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +290 -0
  280. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +174 -0
  281. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +623 -0
  282. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
  283. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +200 -0
  284. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
  285. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
  286. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
  287. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
  288. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
  289. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +270 -0
  290. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +625 -0
  291. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
  292. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +115 -0
  293. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
  294. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
  295. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
  296. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
  297. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
  298. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
  299. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
  300. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
  301. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +17 -0
  302. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
  303. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
  304. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
  305. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
  306. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
  307. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
  308. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
  309. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
  310. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
  311. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
  312. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
  313. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +158 -0
  314. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
  315. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
  316. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
  317. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
  318. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
  319. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
  320. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
  321. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
  322. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
  323. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
  324. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
  325. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
  326. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
  327. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
  328. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
  329. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
  330. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
  331. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
  332. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
  333. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
  334. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
  335. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
  336. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
  337. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
  338. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
  339. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
  340. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
  341. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
  342. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
  343. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
  344. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
  345. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
  346. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
  347. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +81 -0
  348. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +172 -0
  349. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
  350. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
  351. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
  352. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +73 -0
  353. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
  354. hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
  355. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/camera.h +105 -0
  356. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/cache.h +26 -0
  357. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/free_space.h +60 -0
  358. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/operations_cpu.h +411 -0
  359. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/glb/glb.h +25 -0
  360. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/glb/operations_cpu.h +1288 -0
  361. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/operations_cpu.h +136 -0
  362. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/catalog.h +232 -0
  363. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/conversion.h +33 -0
  364. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/operations_cpu.h +123 -0
  365. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/procthor.h +39 -0
  366. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +717 -0
  367. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1283 -0
  368. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +193 -0
  369. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
  370. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1123 -0
  371. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +207 -0
  372. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +1043 -0
  373. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1747 -0
  374. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +64 -0
  375. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/specialization.h +37 -0
  376. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +251 -0
  377. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +48 -0
  378. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +2067 -0
  379. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/bvh_sah.h +182 -0
  380. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/context.h +280 -0
  381. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/device_source.h +17 -0
  382. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/operations_cpu.h +1405 -0
  383. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +948 -0
  384. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +32 -0
  385. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_post.h +96 -0
  386. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +484 -0
  387. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/save_cpu.h +314 -0
  388. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +44 -0
  389. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +25 -0
  390. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +45 -0
  391. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_cpu.h +119 -0
  392. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_generic.h +121 -0
  393. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/rig.h +70 -0
  394. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/scene.h +132 -0
  395. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/segmentation_cpu.h +145 -0
  396. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/transforms.h +204 -0
  397. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/types.h +76 -0
  398. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
  399. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
  400. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
  401. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
  402. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +243 -0
  403. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +9 -0
  404. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +205 -0
  405. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +109 -0
  406. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +51 -0
  407. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/mixed_imitation.h +63 -0
  408. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +190 -0
  409. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +332 -0
  410. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_mixed_imitation.h +81 -0
  411. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
  412. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
  413. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
  414. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
  415. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
  416. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
  417. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
  418. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
  419. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
  420. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
  421. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
  422. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
  423. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
  424. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
  425. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
  426. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
  427. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
  428. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +174 -0
  429. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
  430. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
  431. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
  432. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
  433. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
  434. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +117 -0
  435. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
  436. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
  437. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
  438. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
  439. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
  440. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
  441. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
  442. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
  443. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
  444. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
  445. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/collection.h +57 -0
  446. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +122 -0
  447. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +2 -0
  448. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +8 -0
  449. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +8 -0
  450. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mux.h +12 -0
  451. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +183 -0
  452. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +366 -0
  453. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_common.h +74 -0
  454. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +47 -0
  455. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
  456. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
  457. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
  458. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
  459. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
  460. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
  461. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
  462. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
  463. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
  464. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
  465. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
  466. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
  467. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
  468. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
  469. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
  470. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
  471. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
  472. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
  473. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/environment.h +40 -0
  474. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_cuda.h +204 -0
  475. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic.h +106 -0
  476. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic_common.h +26 -0
  477. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/persist.h +33 -0
  478. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
  479. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
  480. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
  481. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
  482. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
  483. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
  484. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
  485. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
  486. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
  487. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
  488. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/observation.h +75 -0
  489. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cpu.h +1063 -0
  490. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cuda.h +564 -0
  491. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/pose.h +253 -0
  492. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/presets.h +154 -0
  493. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/operations_cpu.h +26 -0
  494. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/operations_generic.h +91 -0
  495. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/raptor.h +71 -0
  496. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_cpu.h +190 -0
  497. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_generic.h +32 -0
  498. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/rig.h +25 -0
  499. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_cpu.h +86 -0
  500. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_cuda.h +69 -0
  501. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_optix.h +163 -0
  502. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cpu.h +223 -0
  503. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cpu_spectator.h +194 -0
  504. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cuda.h +1 -0
  505. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cuda_spectator.h +109 -0
  506. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/spectator.h +82 -0
  507. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/spy.h +107 -0
  508. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/ui.h +30 -0
  509. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/moving_gate.h +103 -0
  510. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cpu.h +279 -0
  511. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cuda.h +242 -0
  512. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cpu.h +322 -0
  513. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cuda.h +312 -0
  514. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_generic_position_hold.h +128 -0
  515. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/position_hold.h +22 -0
  516. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/target_frame.h +92 -0
  517. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/baseline.h +46 -0
  518. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/calibration.h +62 -0
  519. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/metrics.h +101 -0
  520. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/operations_cpu.h +374 -0
  521. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/visual_inertial_localization.h +126 -0
  522. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/world.h +333 -0
  523. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/inertial_velocity.h +27 -0
  524. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
  525. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1138 -0
  526. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2252 -0
  527. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +148 -0
  528. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
  529. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +208 -0
  530. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +300 -0
  531. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
  532. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +637 -0
  533. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
  534. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
  535. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +368 -0
  536. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +312 -0
  537. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +367 -0
  538. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic_inertial_velocity.h +44 -0
  539. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +43 -0
  540. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +70 -0
  541. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +24 -0
  542. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +209 -0
  543. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
  544. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
  545. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
  546. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
  547. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
  548. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
  549. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
  550. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
  551. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500.h +88 -0
  552. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
  553. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
  554. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
  555. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +96 -0
  556. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
  557. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
  558. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
  559. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
  560. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
  561. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
  562. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
  563. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist.h +21 -0
  564. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
  565. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +103 -0
  566. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
  567. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
  568. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
  569. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
  570. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
  571. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
  572. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
  573. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +162 -0
  574. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/persist.h +86 -0
  575. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
  576. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
  577. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
  578. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
  579. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
  580. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
  581. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
  582. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
  583. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
  584. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
  585. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
  586. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
  587. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
  588. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
  589. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
  590. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
  591. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
  592. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
  593. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
  594. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
  595. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
  596. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
  597. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
  598. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
  599. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
  600. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
  601. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
  602. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
  603. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
  604. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
  605. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
  606. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
  607. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
  608. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
  609. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
  610. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
  611. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
  612. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
  613. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
  614. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
  615. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
  616. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
  617. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
  618. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
  619. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
  620. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
  621. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
  622. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
  623. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
  624. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
  625. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
  626. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
  627. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
  628. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
  629. hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +80 -0
  630. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
  631. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
  632. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
  633. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
  634. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
  635. hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
  636. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
  637. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu_emscripten.h +15 -0
  638. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +29 -0
  639. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +24 -0
  640. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu_emscripten.h +28 -0
  641. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +33 -0
  642. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
  643. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
  644. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
  645. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
  646. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
  647. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
  648. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
  649. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
  650. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +103 -0
  651. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
  652. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
  653. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +147 -0
  654. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +122 -0
  655. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +172 -0
  656. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
  657. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
  658. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
  659. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
  660. hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
  661. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
  662. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/README.md +214 -0
  663. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +11 -0
  664. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
  665. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +134 -0
  666. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
  667. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +912 -0
  668. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
  669. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
  670. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
  671. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +308 -0
  672. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
  673. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +970 -0
  674. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +44 -0
  675. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/CMakeLists.txt +31 -0
  676. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/device.wgsl +1381 -0
  677. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +129 -0
  678. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +131 -0
  679. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +180 -0
  680. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +491 -0
  681. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/download_paper_scene.py +74 -0
  682. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/CMakeLists.txt +104 -0
  683. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/Info.plist +36 -0
  684. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/Sources/BenchmarkApp.swift +172 -0
  685. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/benchmark.h +10 -0
  686. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/benchmark.mm +46 -0
  687. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/build.sh +17 -0
  688. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/rig.cpp +119 -0
  689. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1382 -0
  690. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.h +5 -0
  691. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_config.h.in +25 -0
  692. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_identity.cmake +11 -0
  693. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_main.cpp +5 -0
  694. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.cu +125 -0
  695. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.h +58 -0
  696. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics_contract.h +179 -0
  697. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics_cpu.cpp +77 -0
  698. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/camera_orbit.h +51 -0
  699. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +199 -0
  700. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +214 -0
  701. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +320 -0
  702. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +359 -0
  703. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +96 -0
  704. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +263 -0
  705. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +273 -0
  706. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +221 -0
  707. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/flow.cpp +120 -0
  708. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +1015 -0
  709. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
  710. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal.cpp +82 -0
  711. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal_overlay.cpp +137 -0
  712. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
  713. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1829 -0
  714. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +647 -0
  715. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
  716. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
  717. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
  718. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
  719. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
  720. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
  721. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
  722. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
  723. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
  724. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +222 -0
  725. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
  726. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
  727. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
  728. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
  729. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
  730. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
  731. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
  732. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
  733. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
  734. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
  735. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
  736. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
  737. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
  738. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
  739. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
  740. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
  741. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
  742. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
  743. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
  744. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
  745. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
  746. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +457 -0
  747. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
  748. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +443 -0
  749. hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/CMakeLists.txt +63 -0
  750. hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/example.cpp +101 -0
  751. hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/ui.cpp +380 -0
  752. hyperdrone/dynamics/__init__.py +5 -0
  753. hyperdrone/dynamics/_component.py +31 -0
  754. hyperdrone/dynamics/_config.py +46 -0
  755. hyperdrone/dynamics/_sim.py +166 -0
  756. hyperdrone/env/__init__.py +23 -0
  757. hyperdrone/env/_multi_environment.py +566 -0
  758. hyperdrone/env/_rotorcraft.py +29 -0
  759. hyperdrone/env/_spy.py +39 -0
  760. hyperdrone/examples/.gitignore +3 -0
  761. hyperdrone/examples/Benchmark.ipynb +113 -0
  762. hyperdrone/examples/HyperDrone.ipynb +589 -0
  763. hyperdrone/examples/Orbiter.ipynb +496 -0
  764. hyperdrone/examples/Renderer.ipynb +218 -0
  765. hyperdrone/examples/__init__.py +16 -0
  766. hyperdrone/examples/articulation.py +55 -0
  767. hyperdrone/examples/benchmark.py +236 -0
  768. hyperdrone/examples/benchmark_minimal.py +65 -0
  769. hyperdrone/examples/data.py +71 -0
  770. hyperdrone/examples/drone_flythrough.py +169 -0
  771. hyperdrone/examples/hyperdrone_videos/my_world_preview.h +17 -0
  772. hyperdrone/examples/my_world.h +17 -0
  773. hyperdrone/examples/render_procthor.py +40 -0
  774. hyperdrone/examples/shots.py +108 -0
  775. hyperdrone/examples/spy.py +40 -0
  776. hyperdrone/examples/visual_inertial_localization.py +158 -0
  777. hyperdrone/gym/__init__.py +67 -0
  778. hyperdrone/render/__init__.py +57 -0
  779. hyperdrone/render/_component.py +51 -0
  780. hyperdrone/render/_config.py +76 -0
  781. hyperdrone/render/_renderer.py +498 -0
  782. hyperdrone/render/_rig.py +136 -0
  783. hyperdrone/render/_sampling.py +69 -0
  784. hyperdrone/render/_scene.py +38 -0
  785. hyperdrone/render/datasets.py +15 -0
  786. hyperray-0.0.1.dist-info/METADATA +519 -0
  787. hyperray-0.0.1.dist-info/RECORD +788 -0
  788. hyperray-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,1063 @@
1
+ #include "../../../version.h"
2
+ #include "../../../rl_tools.h"
3
+ #if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_RL_ENVIRONMENTS_HYPERDRONE_OPERATIONS_CPU_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
4
+ #pragma once
5
+ #define RL_TOOLS_RL_ENVIRONMENTS_HYPERDRONE_OPERATIONS_CPU_H
6
+
7
+ #include "world.h"
8
+ #include "rig/operations_cpu.h"
9
+ #include "pose.h"
10
+
11
+ #include <rl_tools/rl/environments/l2f/operations_cpu.h>
12
+ #include <rl_tools/rendering/raytracing/operations_cpu_mux.h>
13
+ #include <rl_tools/rendering/datasets/operations_cpu.h>
14
+ #include <rl_tools/rendering/datasets/glb/operations_cpu.h>
15
+ #include <rl_tools/rendering/datasets/procthor/operations_cpu.h>
16
+ #include <rl_tools/rendering/datasets/annotations/operations_cpu.h>
17
+
18
+ #include <algorithm>
19
+ #include <filesystem>
20
+ #include <string>
21
+ #include <vector>
22
+
23
+ RL_TOOLS_NAMESPACE_WRAPPER_START
24
+ namespace rl_tools {
25
+ template <typename DEVICE, typename SPEC>
26
+ bool set_asset(DEVICE&, rl::environments::hyperdrone::World<SPEC>&, const std::string&, const std::string&){
27
+ return false;
28
+ }
29
+
30
+ template <typename DEVICE, typename SPEC>
31
+ auto& get_renderer(DEVICE&, rl::environments::hyperdrone::World<SPEC>& world) {
32
+ return world.slots[world.active_slot].renderer;
33
+ }
34
+
35
+ template <typename DEVICE, typename SPEC>
36
+ const auto& get_renderer(DEVICE&, const rl::environments::hyperdrone::World<SPEC>& world) {
37
+ return world.slots[world.active_slot].renderer;
38
+ }
39
+
40
+ namespace rl::environments::hyperdrone {
41
+ // task wrappers extend the instance Parameters/State by derivation, so the World verbs
42
+ // accept any element type derived from the base contract types
43
+ template <typename WORLD, typename PARAMETER_SPEC, typename STATE_SPEC>
44
+ constexpr bool check_world_instance_tensors(){
45
+ static_assert(utils::typing::is_base_of_v<typename WORLD::Parameters, typename PARAMETER_SPEC::T>);
46
+ static_assert(utils::typing::is_base_of_v<typename WORLD::State, typename STATE_SPEC::T>);
47
+ static_assert(get<0>(typename PARAMETER_SPEC::SHAPE{}) == WORLD::INSTANCES);
48
+ static_assert(get<0>(typename STATE_SPEC::SHAPE{}) == WORLD::INSTANCES);
49
+ return true;
50
+ }
51
+ }
52
+
53
+ // Direct state or parameter writes require request_render before acquiring the updated frame.
54
+ template <typename DEVICE, typename SPEC, typename RESET_SPEC>
55
+ void request_render(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, const Tensor<RESET_SPEC>& reset_mask){
56
+ static_assert(length(typename RESET_SPEC::SHAPE{}) == 1 && get<0>(typename RESET_SPEC::SHAPE{}) == rl::environments::hyperdrone::World<SPEC>::INSTANCES);
57
+ if(static_cast<const void*>(data(reset_mask)) != static_cast<const void*>(data(world.render_reset))){
58
+ auto reset = reset_mask;
59
+ binary_operation(device, tensor::operations::binary::LogicalOr{}, reset, world.render_reset);
60
+ }
61
+ world.render_pending = true;
62
+ if(world.history_step == 0){
63
+ world.history_step = 1;
64
+ }
65
+ }
66
+
67
+ template <typename DEVICE, typename SPEC>
68
+ void request_render(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world){
69
+ world.render_pending = true;
70
+ if(world.history_step == 0){
71
+ world.history_step = 1;
72
+ }
73
+ }
74
+
75
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC>
76
+ void prepare_render_inputs(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask_input);
77
+ template <typename DEVICE, typename SPEC, typename RESET_SPEC>
78
+ void reset_render_state(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, const Tensor<RESET_SPEC>& reset_mask);
79
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC>
80
+ void render(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask_input);
81
+
82
+ template <typename DEVICE, typename SPEC>
83
+ void malloc(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world) {
84
+ malloc(device, world.dynamics);
85
+ malloc(device, world.drone_parameters);
86
+ malloc(device, world.drone_bodies);
87
+ }
88
+
89
+ // pools an assembly once per path in the shared library; must happen before any hot slot
90
+ // flattens the pool (wrapper init overloads register before forwarding, the World's own
91
+ // drones register before its slots build)
92
+ template <typename DEVICE, typename SPEC>
93
+ rendering::raytracing::AssetHandle register_pool_asset(DEVICE& device, rl::environments::hyperdrone::SharedContext<SPEC>& shared, const std::string& path) {
94
+ auto& render_device = get_rendering_device(device);
95
+ for (size_t asset_i = 0; asset_i < shared.pool_asset_paths.size(); asset_i++) {
96
+ if (shared.pool_asset_paths[asset_i] == path) {
97
+ return shared.pool_asset_handles[asset_i];
98
+ }
99
+ }
100
+ rendering::raytracing::ObjectAssembly assembly;
101
+ bool loaded = load<typename SPEC::SHADING, SPEC::OUTPUT_RGB>(render_device, assembly, path);
102
+ utils::assert_exit(device, loaded, "hyperdrone::register_pool_asset: failed to load the asset");
103
+ auto handle = add(render_device, shared.library.pool, assembly);
104
+ shared.pool_asset_paths.push_back(path);
105
+ shared.pool_asset_handles.push_back(handle);
106
+ return handle;
107
+ }
108
+
109
+ // appends a rigid entity kind: its pooled asset and the rig derived from it; kinds take
110
+ // consecutive per-instance slots in registration order, ahead of the drone region
111
+ template <typename DEVICE, typename SPEC>
112
+ typename SPEC::TI register_entity_kind(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::SharedContext& shared, const std::string& path) {
113
+ using TI = typename SPEC::TI;
114
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
115
+ auto& render_device = get_rendering_device(device);
116
+ typename WORLD::EntityKind kind{};
117
+ kind.asset = register_pool_asset(device, shared, path);
118
+ bool rig_ok = init(render_device, kind.rig, shared.library.pool.assemblies[kind.asset.index]);
119
+ utils::assert_exit(device, rig_ok, "hyperdrone::register_entity_kind: the asset does not fit the entity rig");
120
+ for (const auto& registered : world.entity_kinds) {
121
+ kind.slot_offset += registered.rig.num_parts;
122
+ }
123
+ utils::assert_exit(device, kind.slot_offset + kind.rig.num_parts <= SPEC::MAX_ENTITY_SLOTS_PER_INSTANCE, "hyperdrone::register_entity_kind: the entity kinds exceed MAX_ENTITY_SLOTS_PER_INSTANCE");
124
+ world.entity_kinds.push_back(kind);
125
+ return (TI)world.entity_kinds.size() - 1;
126
+ }
127
+
128
+ // builds the drone table once from the registered entries; SELF_VISIBLE pools one mesh per
129
+ // distinct assembly content and matches each entry's rig to its nominal rotors
130
+ template <typename DEVICE, typename SPEC>
131
+ void init(DEVICE& device, rl::environments::hyperdrone::SharedContext<SPEC>& shared) {
132
+ using TI = typename SPEC::TI;
133
+ using DYNAMICS_ENV = typename rl::environments::hyperdrone::Parameters<SPEC>::DYNAMICS_ENV;
134
+ auto& render_device = get_rendering_device(device);
135
+ utils::assert_exit(device, shared.num_drones == 0, "hyperdrone::SharedContext: the drone table is built once");
136
+ utils::assert_exit(device, !shared.drones.empty(), "hyperdrone::SharedContext: register at least one drone");
137
+ utils::assert_exit(device, shared.drones.size() <= SPEC::MAX_DRONES, "hyperdrone::SharedContext: more drones than Specification::MAX_DRONES");
138
+ if constexpr (SPEC::N_AGENTS > 1) {
139
+ for (const auto& drone : shared.drones) {
140
+ utils::assert_exit(device, drone.parameters.dynamics.integration.dt == shared.drones[0].parameters.dynamics.integration.dt, "hyperdrone::SharedContext: agents in a group need the same integration timestep");
141
+ }
142
+ }
143
+ if constexpr (SPEC::SELF_VISIBLE) {
144
+ std::vector<std::string> content_hashes;
145
+ for (auto& drone : shared.drones) {
146
+ std::string path, content_hash;
147
+ utils::assert_exit(device, !drone.asset.empty(), "hyperdrone::SharedContext: every drone needs an asset when SELF_VISIBLE");
148
+ utils::assert_exit(device, rendering::datasets::resolve_reference(render_device, drone.asset, path), "hyperdrone::SharedContext: failed to resolve the drone asset");
149
+ utils::assert_exit(device, rendering::datasets::content_hash(render_device, path, content_hash), "hyperdrone::SharedContext: failed to hash the drone asset");
150
+ drone.asset = path;
151
+ rl::environments::hyperdrone::DroneBody<SPEC> body;
152
+ while (body.mesh < (TI)content_hashes.size() && content_hashes[body.mesh] != content_hash) {
153
+ body.mesh++;
154
+ }
155
+ if (body.mesh == (TI)content_hashes.size()) {
156
+ shared.drone_meshes.push_back(register_pool_asset(device, shared, path));
157
+ content_hashes.push_back(content_hash);
158
+ }
159
+ const auto& assembly = shared.library.pool.assemblies[shared.drone_meshes[body.mesh].index];
160
+ const auto& rotors = drone.parameters.dynamics.dynamics;
161
+ const bool rig_ok = init(render_device, body.rig, assembly, rotors.rotor_positions, rotors.rotor_torque_directions, (TI)DYNAMICS_ENV::ACTION_DIM);
162
+ utils::assert_exit(device, rig_ok, "hyperdrone::SharedContext: a drone asset needs a body and one prop_* per rotor, each hub nearest a distinct rotor with a nonzero reaction torque");
163
+ utils::assert_exit(device, shared.drone_bodies.empty() || body.rig.num_parts == shared.drone_bodies[0].rig.num_parts, "hyperdrone::SharedContext: all drone assets need the same part count");
164
+ shared.drone_bodies.push_back(body);
165
+ }
166
+ shared.drone_parts = shared.drone_bodies[0].rig.num_parts;
167
+ }
168
+ shared.num_drones = (TI)shared.drones.size();
169
+ }
170
+
171
+ // the shared AssetLibrary and SceneSet are owned by the caller (typically the
172
+ // MultiEnvironment); each World builds one hot slot per scene of its partition, each
173
+ // initialized exactly once
174
+ template <typename DEVICE, typename SPEC, typename DATASET>
175
+ void init(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::SharedContext& shared, const DATASET& dataset, const typename DATASET::Corpus& corpus, typename SPEC::TI first_scene, typename SPEC::TI num_scenes, typename SPEC::TI member_index) {
176
+ using T = typename SPEC::T;
177
+ using TI = typename SPEC::TI;
178
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
179
+ auto& render_device = get_rendering_device(device);
180
+ init(device, world.dynamics);
181
+ world.member_index = member_index;
182
+ world.history_step = 0;
183
+ world.flow_scene_version = 0;
184
+ utils::assert_exit(device, num_scenes > 0, "hyperdrone::World: empty scene partition");
185
+ utils::assert_exit(device, first_scene + num_scenes <= (TI)corpus.references.size(), "hyperdrone::World: scene partition out of range");
186
+ if (shared.num_drones == 0) {
187
+ if (shared.drones.empty()) {
188
+ // no registration: the first World's nominal is the single drone (no assembly)
189
+ rl::environments::hyperdrone::Drone<SPEC> drone;
190
+ drone.parameters = world.parameters.agents[0];
191
+ drone.parameters.dynamics = world.dynamics.parameters;
192
+ shared.drones.push_back(drone);
193
+ }
194
+ init(device, shared);
195
+ }
196
+ world.num_drones = shared.num_drones;
197
+ world.dynamics.parameters = shared.drones[0].parameters.dynamics;
198
+ for (TI agent_i = 0; agent_i < WORLD::N_AGENTS; agent_i++) {
199
+ for (TI camera_i = 0; camera_i < WORLD::N_CAMERAS_PER_AGENT; camera_i++) {
200
+ world.parameters.agents[agent_i].cameras[camera_i] = shared.drones[0].parameters.cameras[camera_i];
201
+ }
202
+ }
203
+ {
204
+ std::vector<rl::environments::hyperdrone::DroneParameters<SPEC>> parameters_staging(SPEC::MAX_DRONES);
205
+ std::vector<rl::environments::hyperdrone::DroneBody<SPEC>> bodies_staging(SPEC::MAX_DRONES);
206
+ for (TI drone_i = 0; drone_i < world.num_drones; drone_i++) {
207
+ parameters_staging[drone_i] = shared.drones[drone_i].parameters;
208
+ if constexpr (SPEC::SELF_VISIBLE) {
209
+ bodies_staging[drone_i] = shared.drone_bodies[drone_i];
210
+ }
211
+ }
212
+ Tensor<typename WORLD::DRONE_PARAMETERS_SPEC> parameters_alias;
213
+ parameters_alias._data = parameters_staging.data();
214
+ copy(render_device, device, parameters_alias, world.drone_parameters);
215
+ Tensor<typename WORLD::DRONE_BODIES_SPEC> bodies_alias;
216
+ bodies_alias._data = bodies_staging.data();
217
+ copy(render_device, device, bodies_alias, world.drone_bodies);
218
+ }
219
+ if constexpr (SPEC::SELF_VISIBLE) {
220
+ world.drone_meshes = shared.drone_meshes;
221
+ world.drone_parts = shared.drone_parts;
222
+ world.drone_slot_offset = 0;
223
+ for (const auto& kind : world.entity_kinds) {
224
+ world.drone_slot_offset += kind.rig.num_parts;
225
+ }
226
+ const TI required_slots = world.drone_slot_offset + WORLD::N_AGENTS * world.drone_parts;
227
+ const std::string slot_message = "hyperdrone::World: MAX_ENTITY_SLOTS_PER_INSTANCE must be at least " + std::to_string(required_slots) + " for the entity kinds and the drones";
228
+ utils::assert_exit(device, required_slots <= SPEC::MAX_ENTITY_SLOTS_PER_INSTANCE, slot_message.c_str());
229
+ }
230
+ world.slots.resize(num_scenes);
231
+ for (TI slot_i = 0; slot_i < num_scenes; slot_i++) {
232
+ auto& slot = world.slots[slot_i];
233
+ slot.corpus_index = first_scene + slot_i;
234
+ malloc(render_device, slot.renderer, shared.library);
235
+ rendering::Bundle<T> bundle;
236
+ using LOAD_MODE = utils::typing::conditional_t<SPEC::OUTPUT_SEGMENTATION, mode::rendering::SceneRoots<>, mode::Default<>>;
237
+ const bool scene_loaded = load<typename SPEC::SHADING, SPEC::OUTPUT_RGB>(render_device, dataset, corpus, slot.corpus_index, bundle, Mode<LOAD_MODE>{});
238
+ utils::assert_exit(device, scene_loaded, "hyperdrone::World: failed to load scene");
239
+ slot.metadata = bundle.metadata;
240
+ slot.scene_id = insert(render_device, shared.library, bundle);
241
+ init(render_device, slot.renderer, shared.library, slot.scene_id);
242
+ generate_probe_directions(render_device, slot.renderer);
243
+ rendering::datasets::annotations::FreeSpaceParameters<T, TI> free_space_parameters{};
244
+ rendering::datasets::annotations::annotate(render_device, slot.annotations, slot.metadata, slot.renderer, free_space_parameters, shared.annotation_cache);
245
+ utils::assert_exit(device, slot.annotations.num_positions > 0, "hyperdrone::World: scene has no valid indoor positions");
246
+ if constexpr (WORLD::RENDERER_CONFIG::NUM_OVERLAYS > 0) {
247
+ // pinned deterministic spawn order (instance-major, registration order, then the
248
+ // drone region with the first mesh) so segmentation ids are stable across runs and
249
+ // backends and every row sits where the producers write it; publishing here leaves
250
+ // no pending rows behind, so the per-step producers own their rows from the first
251
+ // frame on
252
+ const float identity[12] = {1,0,0,0, 0,1,0,0, 0,0,1,0};
253
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
254
+ const rendering::raytracing::OverlayIndex overlay{instance_i};
255
+ for (TI view_i = 0; view_i < WORLD::N_VIEWS; view_i++) {
256
+ attach(render_device, slot.renderer, instance_i * WORLD::N_VIEWS + view_i, overlay);
257
+ }
258
+ for (const auto& kind : world.entity_kinds) {
259
+ const auto placement = spawn(render_device, slot.renderer, overlay, kind.asset, identity);
260
+ utils::assert_exit(device, placement.first_slot == kind.slot_offset && placement.num_parts == kind.rig.num_parts, "hyperdrone::World: entity placement deviates from the registration layout");
261
+ }
262
+ if constexpr (SPEC::SELF_VISIBLE) {
263
+ for (TI agent_i = 0; agent_i < WORLD::N_AGENTS; agent_i++) {
264
+ const auto placement = spawn(render_device, slot.renderer, overlay, world.drone_meshes[0], identity);
265
+ utils::assert_exit(device, placement.first_slot == world.drone_slot_offset + agent_i * world.drone_parts, "hyperdrone::World: drone placement deviates from the drone region");
266
+ }
267
+ }
268
+ }
269
+ update(render_device, slot.renderer);
270
+ }
271
+ }
272
+ world.active_slot = 0;
273
+ world.scene_version = 1;
274
+ malloc(device, world.history);
275
+ malloc(device, world.prev_cameras);
276
+ malloc(device, world.episode_start);
277
+ malloc(device, world.render_reset);
278
+ malloc(device, world.active_annotations);
279
+ malloc(render_device, world.camera_staging_close);
280
+ malloc(render_device, world.camera_staging_previous);
281
+ malloc(render_device, world.camera_staging_open);
282
+ set_all(device, world.episode_start, (TI)0);
283
+ set_all(device, world.render_reset, false);
284
+ world.render_pending = false;
285
+ {
286
+ Tensor<typename WORLD::ACTIVE_ANNOTATIONS_SPEC> annotations_alias;
287
+ annotations_alias._data = &world.slots[0].annotations;
288
+ copy(render_device, device, annotations_alias, world.active_annotations);
289
+ }
290
+ }
291
+
292
+ template <typename DEVICE, typename SPEC>
293
+ void free(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world) {
294
+ auto& render_device = get_rendering_device(device);
295
+ if (!world.slots.empty()) {
296
+ free(device, world.history);
297
+ free(device, world.prev_cameras);
298
+ free(device, world.episode_start);
299
+ free(device, world.render_reset);
300
+ free(device, world.active_annotations);
301
+ free(render_device, world.camera_staging_close);
302
+ free(render_device, world.camera_staging_previous);
303
+ free(render_device, world.camera_staging_open);
304
+ }
305
+ for (auto& slot : world.slots) {
306
+ free(render_device, slot.renderer);
307
+ }
308
+ world.slots.clear();
309
+ free(device, world.drone_parameters);
310
+ free(device, world.drone_bodies);
311
+ free(device, world.dynamics);
312
+ }
313
+
314
+ // Scene changes require the caller to reset all instances before observing again.
315
+ template <typename DEVICE, typename SPEC>
316
+ void select_scene(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename SPEC::TI slot_i) {
317
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
318
+ auto& render_device = get_rendering_device(device);
319
+ utils::assert_exit(device, slot_i < world.slots.size(), "hyperdrone::select_scene: slot out of range");
320
+ world.active_slot = slot_i;
321
+ world.scene_version++;
322
+ Tensor<typename WORLD::ACTIVE_ANNOTATIONS_SPEC> annotations_alias;
323
+ annotations_alias._data = &world.slots[world.active_slot].annotations;
324
+ copy(render_device, device, annotations_alias, world.active_annotations);
325
+ request_render(device, world);
326
+ }
327
+
328
+ template <typename DEVICE, typename SPEC>
329
+ void rotate_scene(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world) {
330
+ utils::assert_exit(device, !world.slots.empty(), "hyperdrone::rotate_scene: empty scene partition");
331
+ select_scene(device, world, (world.active_slot + 1) % world.slots.size());
332
+ }
333
+
334
+ template <typename DEVICE, typename SPEC>
335
+ RL_TOOLS_FUNCTION_PLACEMENT void initial_parameters(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters) {
336
+ parameters = world.parameters;
337
+ for (typename SPEC::TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
338
+ initial_parameters(device, world.dynamics, parameters.agents[agent_i].dynamics);
339
+ }
340
+ }
341
+
342
+ namespace rl::environments::hyperdrone {
343
+ // device-capable single-instance sampling shared by the CPU loops and the CUDA kernels.
344
+ // The episode parameters split into the drone entry, the drone's own (dynamics, shutter)
345
+ // and the view (camera, brightness) so task wrappers can source the view from elsewhere
346
+ template <typename DEVICE, typename SPEC, typename RNG>
347
+ RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::TI _sample_drone(DEVICE& device, typename SPEC::TI num_drones, RNG& rng) {
348
+ using T = typename SPEC::T;
349
+ using TI = typename SPEC::TI;
350
+ if (num_drones <= 1) {
351
+ return 0;
352
+ }
353
+ const TI drone_i = (TI)(random::uniform_real_distribution(device.random, (T)0, (T)1, rng) * (T)num_drones);
354
+ return drone_i < num_drones ? drone_i : num_drones - 1;
355
+ }
356
+ template <typename DEVICE, typename SPEC, typename RNG>
357
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_dynamics_parameters(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, const DroneParameters<SPEC>& drone, AgentParameters<SPEC>& parameters, RNG& rng) {
358
+ // the l2f sampler copies its environment's nominal before randomizing: hand it the entry's
359
+ auto drone_dynamics = dynamics;
360
+ drone_dynamics.parameters = drone.dynamics;
361
+ sample_initial_parameters(device, drone_dynamics, parameters.dynamics, rng);
362
+ }
363
+ template <typename DEVICE, typename SPEC, typename RNG>
364
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_view_parameters(DEVICE& device, const Camera<typename SPEC::T>& nominal, Camera<typename SPEC::T>& camera, RNG& rng) {
365
+ using T = typename SPEC::T;
366
+ camera = nominal;
367
+ camera.fov = nominal.fov + SPEC::CAMERA_FOV_RANDOMIZATION_RANGE * random::uniform_real_distribution(device.random, (T)-1, (T)1, rng);
368
+ CameraRandomization<T> randomization;
369
+ for (unsigned axis_i = 0; axis_i < 3; axis_i++) {
370
+ randomization.offset_body_range[axis_i] = SPEC::CAMERA_MOUNT_OFFSET_RANDOMIZATION_RANGE;
371
+ randomization.rotation_body_range[axis_i] = SPEC::CAMERA_MOUNT_ROTATION_RANDOMIZATION_RANGE;
372
+ }
373
+ randomize_camera_mount(device, randomization, camera.mount, rng);
374
+ }
375
+ template <typename DEVICE, typename SPEC, typename RNG>
376
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_brightness(DEVICE& device, Parameters<SPEC>& parameters, RNG& rng) {
377
+ using T = typename SPEC::T;
378
+ parameters.brightness_scale = (T)1 + (random::uniform_real_distribution(device.random, (T)0, (T)1, rng) * (T)2 - (T)1) * SPEC::BRIGHTNESS_RANDOMIZATION_RANGE;
379
+ }
380
+ template <typename DEVICE, typename SPEC, typename RNG>
381
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_shutter_fraction(DEVICE& device, Parameters<SPEC>& parameters, RNG& rng) {
382
+ if constexpr (SPEC::ENABLE_MOTION_BLUR) {
383
+ parameters.shutter_fraction = random::uniform_real_distribution(device.random, SPEC::SHUTTER_FRACTION_MIN, SPEC::SHUTTER_FRACTION_MAX, rng);
384
+ }
385
+ }
386
+ template <typename DEVICE, typename SPEC, typename DRONE_SPEC, typename RNG>
387
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_initial_parameters(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, const GroupParameters<SPEC>& defaults, const Tensor<DRONE_SPEC>& drones, typename SPEC::TI num_drones, Parameters<SPEC>& parameters, RNG& rng) {
388
+ static_cast<GroupParameters<SPEC>&>(parameters) = defaults;
389
+ for (typename SPEC::TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
390
+ auto& agent = parameters.agents[agent_i];
391
+ agent.drone = _sample_drone<DEVICE, SPEC>(device, num_drones, rng);
392
+ const auto& drone = get_ref(device, drones, agent.drone);
393
+ _sample_dynamics_parameters<DEVICE, SPEC>(device, dynamics, drone, agent, rng);
394
+ for (typename SPEC::TI camera_i = 0; camera_i < SPEC::N_CAMERAS_PER_AGENT; camera_i++) {
395
+ _sample_view_parameters<DEVICE, SPEC>(device, drone.cameras[camera_i], agent.cameras[camera_i], rng);
396
+ }
397
+ }
398
+ _sample_brightness<DEVICE, SPEC>(device, parameters, rng);
399
+ _sample_shutter_fraction<DEVICE, SPEC>(device, parameters, rng);
400
+ }
401
+ // agent view of the (possibly multi-agent) per-instance state
402
+ template <typename SPEC>
403
+ RL_TOOLS_FUNCTION_PLACEMENT const typename World<SPEC>::DYNAMICS_ENV::State& _agent_state(const typename World<SPEC>::State& state, typename SPEC::TI agent_i) {
404
+ if constexpr (SPEC::N_AGENTS == 1) {
405
+ return state;
406
+ } else {
407
+ return state.agent_states[agent_i];
408
+ }
409
+ }
410
+ template <typename SPEC>
411
+ RL_TOOLS_FUNCTION_PLACEMENT typename World<SPEC>::DYNAMICS_ENV::State& _agent_state(typename World<SPEC>::State& state, typename SPEC::TI agent_i) {
412
+ if constexpr (SPEC::N_AGENTS == 1) {
413
+ return state;
414
+ } else {
415
+ return state.agent_states[agent_i];
416
+ }
417
+ }
418
+ // the drone rig's coordinates (prop phases, one per rotor) of one agent at shutter open and
419
+ // close: the open phase trails the close phase by the spin during the shutter fraction;
420
+ // zero without a rotor-phase state
421
+ template <typename DEVICE, typename SPEC>
422
+ RL_TOOLS_FUNCTION_PLACEMENT void _drone_coordinates(DEVICE& device, const Parameters<SPEC>& parameters, typename SPEC::TI agent_i, const typename World<SPEC>::DYNAMICS_ENV::State& agent_state, float open[World<SPEC>::DYNAMICS_ENV::ACTION_DIM], float close[World<SPEC>::DYNAMICS_ENV::ACTION_DIM]) {
423
+ using T = typename SPEC::T;
424
+ using TI = typename SPEC::TI;
425
+ using WORLD = World<SPEC>;
426
+ constexpr TI ROTORS = WORLD::DYNAMICS_ENV::ACTION_DIM;
427
+ for (TI rotor_i = 0; rotor_i < ROTORS; rotor_i++) {
428
+ close[rotor_i] = 0;
429
+ if constexpr (world::HasRotorPhase<typename WORLD::DYNAMICS_ENV::State>::VALUE) {
430
+ close[rotor_i] = (float)agent_state.rotor_phase[rotor_i];
431
+ }
432
+ open[rotor_i] = close[rotor_i];
433
+ if constexpr (world::HasRotorPhase<typename WORLD::DYNAMICS_ENV::State>::VALUE && WORLD::RENDERER_CONFIG::ENABLE_DYNAMIC_MOTION_BLUR) {
434
+ const T dt = parameters.agents[agent_i].dynamics.integration.dt;
435
+ open[rotor_i] = (float)((T)agent_state.rotor_phase[rotor_i] - agent_state.rpm[rotor_i] * (T)2 * math::PI<T> / (T)60 * dt * parameters.shutter_fraction);
436
+ }
437
+ }
438
+ }
439
+ template <typename SPEC>
440
+ rendering::raytracing::OverlayPlacement _entity_placement(const World<SPEC>& world, const typename World<SPEC>::EntityKind& kind) {
441
+ return {kind.slot_offset, kind.rig.num_parts, world.slots[world.active_slot].renderer.assets[kind.asset.index].first_part};
442
+ }
443
+ // the host counterpart of the device drone rows: swaps the agent's region to the body of
444
+ // the instance's drone entry (a no-op when it already holds it) and poses it
445
+ template <typename DEVICE, typename SPEC, typename RENDERER>
446
+ void _drone_rows(DEVICE& device, const World<SPEC>& world, RENDERER& renderer, typename SPEC::TI instance_i, typename SPEC::TI agent_i, const DroneBody<SPEC>& body, const float base_open[12], const float base_close[12], const float coordinates_open[], const float coordinates_close[]) {
447
+ const rendering::raytracing::OverlayIndex overlay{instance_i};
448
+ const rendering::raytracing::OverlayPlacement region{world.drone_slot_offset + agent_i * world.drone_parts, world.drone_parts, 0};
449
+ const auto placement = replace(device, renderer, overlay, region, world.drone_meshes[body.mesh]);
450
+ if constexpr (World<SPEC>::RENDERER_CONFIG::ENABLE_DYNAMIC_MOTION_BLUR) {
451
+ set_transform_pair(device, renderer, overlay, placement, body.rig, base_open, base_close, coordinates_open, coordinates_close);
452
+ } else {
453
+ set_transform(device, renderer, overlay, placement, body.rig, base_close, coordinates_close);
454
+ }
455
+ }
456
+ // scene-under-drone: the dynamics state stays near the origin; the sampled indoor
457
+ // position and yaw place the scene via the parameters
458
+ template <typename DEVICE, typename SPEC, typename RNG>
459
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_dynamics_state(DEVICE& device, typename World<SPEC>::DYNAMICS_ENV& dynamics, Parameters<SPEC>& parameters, typename World<SPEC>::State& state, RNG& rng) {
460
+ using TI = typename SPEC::TI;
461
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
462
+ sample_initial_state(device, dynamics, parameters.agents[agent_i].dynamics, _agent_state<SPEC>(state, agent_i), rng);
463
+ }
464
+ }
465
+ template <typename DEVICE, typename SPEC, typename RNG>
466
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_scene_placement(DEVICE& device, const typename World<SPEC>::ANNOTATIONS& annotations, Parameters<SPEC>& parameters, RNG& rng) {
467
+ using T = typename SPEC::T;
468
+ auto indoor_pos = rendering::datasets::annotations::sample_free_position(device, annotations, rng);
469
+ parameters.scene_translation[0] = indoor_pos.position[0];
470
+ parameters.scene_translation[1] = indoor_pos.position[1];
471
+ parameters.scene_translation[2] = indoor_pos.position[2];
472
+ T scene_yaw = random::uniform_real_distribution(device.random, (T)0, (T)2 * math::PI<T>, rng);
473
+ parameters.scene_yaw_cos = math::cos(device.math, scene_yaw);
474
+ parameters.scene_yaw_sin = math::sin(device.math, scene_yaw);
475
+ }
476
+ template <typename DEVICE, typename SPEC, typename RNG>
477
+ RL_TOOLS_FUNCTION_PLACEMENT void _sample_initial_state(DEVICE& device, typename World<SPEC>::DYNAMICS_ENV& dynamics, const typename World<SPEC>::ANNOTATIONS& annotations, Parameters<SPEC>& parameters, typename World<SPEC>::State& state, RNG& rng) {
478
+ _sample_dynamics_state<DEVICE, SPEC>(device, dynamics, parameters, state, rng);
479
+ _sample_scene_placement<DEVICE, SPEC>(device, annotations, parameters, rng);
480
+ }
481
+ // device-capable per-instance dynamics verbs shared by the CPU loops and the CUDA
482
+ // kernels: agents step independently, the reward is the cooperative mean, termination is
483
+ // any-agent (including pairwise proximity)
484
+ template <typename DEVICE, typename SPEC, typename ACTION_SPEC, typename RNG>
485
+ RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::T _step(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, Parameters<SPEC>& parameters, const typename World<SPEC>::State& state, const Matrix<ACTION_SPEC>& action, typename World<SPEC>::State& next_state, RNG& rng) {
486
+ using T = typename SPEC::T;
487
+ using TI = typename SPEC::TI;
488
+ using WORLD = World<SPEC>;
489
+ constexpr TI PER_AGENT_ACTION_DIM = WORLD::DYNAMICS_ENV::ACTION_DIM;
490
+ T dt = 0;
491
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
492
+ Matrix<matrix::Specification<typename ACTION_SPEC::T, TI, 1, PER_AGENT_ACTION_DIM, false>> agent_action;
493
+ for (TI action_i = 0; action_i < PER_AGENT_ACTION_DIM; action_i++) {
494
+ set(agent_action, 0, action_i, get(action, 0, agent_i * PER_AGENT_ACTION_DIM + action_i));
495
+ }
496
+ T agent_dt = step(device, dynamics, parameters.agents[agent_i].dynamics, _agent_state<SPEC>(state, agent_i), agent_action, _agent_state<SPEC>(next_state, agent_i), rng);
497
+ dt = agent_i == 0 ? agent_dt : dt;
498
+ }
499
+ return dt;
500
+ }
501
+ template <typename DEVICE, typename SPEC, typename ACTION_SPEC, typename RNG>
502
+ RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::T _reward(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, Parameters<SPEC>& parameters, const typename World<SPEC>::State& state, const Matrix<ACTION_SPEC>& action, const typename World<SPEC>::State& next_state, RNG& rng) {
503
+ using T = typename SPEC::T;
504
+ using TI = typename SPEC::TI;
505
+ using WORLD = World<SPEC>;
506
+ constexpr TI PER_AGENT_ACTION_DIM = WORLD::DYNAMICS_ENV::ACTION_DIM;
507
+ T sum = 0;
508
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
509
+ Matrix<matrix::Specification<typename ACTION_SPEC::T, TI, 1, PER_AGENT_ACTION_DIM, false>> agent_action;
510
+ for (TI action_i = 0; action_i < PER_AGENT_ACTION_DIM; action_i++) {
511
+ set(agent_action, 0, action_i, get(action, 0, agent_i * PER_AGENT_ACTION_DIM + action_i));
512
+ }
513
+ sum += reward(device, dynamics, parameters.agents[agent_i].dynamics, _agent_state<SPEC>(state, agent_i), agent_action, _agent_state<SPEC>(next_state, agent_i), rng);
514
+ }
515
+ return sum / (T)SPEC::N_AGENTS;
516
+ }
517
+ template <typename DEVICE, typename SPEC, typename RNG>
518
+ RL_TOOLS_FUNCTION_PLACEMENT bool _terminated(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, const Parameters<SPEC>& parameters, const typename World<SPEC>::State& state, RNG& rng) {
519
+ using T = typename SPEC::T;
520
+ using TI = typename SPEC::TI;
521
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
522
+ if (terminated(device, dynamics, parameters.agents[agent_i].dynamics, _agent_state<SPEC>(state, agent_i), rng)) {
523
+ return true;
524
+ }
525
+ }
526
+ if constexpr (SPEC::N_AGENTS > 1) {
527
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
528
+ for (TI other_i = agent_i + 1; other_i < SPEC::N_AGENTS; other_i++) {
529
+ const auto& a = _agent_state<SPEC>(state, agent_i);
530
+ const auto& b = _agent_state<SPEC>(state, other_i);
531
+ T distance_squared = 0;
532
+ for (TI dim = 0; dim < 3; dim++) {
533
+ T delta = a.position[dim] - b.position[dim];
534
+ distance_squared += delta * delta;
535
+ }
536
+ if (distance_squared < SPEC::AGENT_COLLISION_DISTANCE * SPEC::AGENT_COLLISION_DISTANCE) {
537
+ return true;
538
+ }
539
+ }
540
+ }
541
+ }
542
+ return false;
543
+ }
544
+ template <typename DEVICE, typename SPEC, typename OBS_SPEC, typename RNG>
545
+ RL_TOOLS_FUNCTION_PLACEMENT void _observe_dynamics(DEVICE& device, const typename World<SPEC>::DYNAMICS_ENV& dynamics, Parameters<SPEC>& parameters, const typename World<SPEC>::State& state, Matrix<OBS_SPEC>& observation, RNG& rng) {
546
+ using TI = typename SPEC::TI;
547
+ using WORLD = World<SPEC>;
548
+ constexpr TI PER_AGENT_DIM = WORLD::DYNAMICS_ENV::ObservationPrivileged::DIM;
549
+ for (TI agent_i = 0; agent_i < SPEC::N_AGENTS; agent_i++) {
550
+ auto agent_observation = view(device, observation, matrix::ViewSpec<1, PER_AGENT_DIM>{}, 0, agent_i * PER_AGENT_DIM);
551
+ observe(device, dynamics, parameters.agents[agent_i].dynamics, _agent_state<SPEC>(state, agent_i), typename WORLD::DYNAMICS_ENV::ObservationPrivileged{}, agent_observation, rng);
552
+ }
553
+ }
554
+ }
555
+
556
+ template <typename DEVICE, typename SPEC, typename RNG>
557
+ void sample_initial_parameters(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, RNG& rng) {
558
+ rl::environments::hyperdrone::_sample_initial_parameters<DEVICE, SPEC>(device, world.dynamics, world.parameters, world.drone_parameters, world.num_drones, parameters, rng);
559
+ }
560
+
561
+ template <typename DEVICE, typename SPEC, typename RNG>
562
+ void sample_initial_state(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, typename rl::environments::hyperdrone::World<SPEC>::State& state, RNG& rng) {
563
+ rl::environments::hyperdrone::_sample_initial_state<DEVICE, SPEC, RNG>(device, world.dynamics, world.slots[world.active_slot].annotations, parameters, state, rng);
564
+ }
565
+
566
+ template <typename DEVICE, typename SPEC, typename ACTION_SPEC, typename RNG>
567
+ RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::T step(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, const typename rl::environments::hyperdrone::World<SPEC>::State& state, const Matrix<ACTION_SPEC>& action, typename rl::environments::hyperdrone::World<SPEC>::State& next_state, RNG& rng) {
568
+ return rl::environments::hyperdrone::_step<DEVICE, SPEC>(device, world.dynamics, parameters, state, action, next_state, rng);
569
+ }
570
+
571
+ template <typename DEVICE, typename SPEC, typename ACTION_SPEC, typename RNG>
572
+ RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::T reward(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, const typename rl::environments::hyperdrone::World<SPEC>::State& state, const Matrix<ACTION_SPEC>& action, const typename rl::environments::hyperdrone::World<SPEC>::State& next_state, RNG& rng) {
573
+ return rl::environments::hyperdrone::_reward<DEVICE, SPEC>(device, world.dynamics, parameters, state, action, next_state, rng);
574
+ }
575
+
576
+ template <typename DEVICE, typename SPEC, typename RNG>
577
+ RL_TOOLS_FUNCTION_PLACEMENT bool terminated(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, const typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, const typename rl::environments::hyperdrone::World<SPEC>::State& state, RNG& rng) {
578
+ return rl::environments::hyperdrone::_terminated<DEVICE, SPEC>(device, world.dynamics, parameters, state, rng);
579
+ }
580
+
581
+ template <typename DEVICE, typename SPEC, typename OBS_SPEC, typename RNG>
582
+ RL_TOOLS_FUNCTION_PLACEMENT void observe(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, typename rl::environments::hyperdrone::World<SPEC>::Parameters& parameters, const typename rl::environments::hyperdrone::World<SPEC>::State& state, const typename rl::environments::hyperdrone::World<SPEC>::ObservationPrivileged& observation_type, Matrix<OBS_SPEC>& observation, RNG& rng) {
583
+ rl::environments::hyperdrone::_observe_dynamics<DEVICE, SPEC>(device, world.dynamics, parameters, state, observation, rng);
584
+ }
585
+
586
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename RESET_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA, bool>::type = true>
587
+ void sample_initial_parameters(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, const Tensor<RESET_SPEC>& reset_mask, RNG& rng) {
588
+ using TI = typename SPEC::TI;
589
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
590
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
591
+ if (get(device, reset_mask, instance_i)) {
592
+ sample_initial_parameters(device, world, get_ref(device, parameters, instance_i), rng);
593
+ }
594
+ }
595
+ }
596
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA, bool>::type = true>
597
+ void sample_initial_state(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask, RNG& rng) {
598
+ using TI = typename SPEC::TI;
599
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
600
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
601
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
602
+ if (get(device, reset_mask, instance_i)) {
603
+ sample_initial_state(device, world, get_ref(device, parameters, instance_i), get_ref(device, states, instance_i), rng);
604
+ }
605
+ }
606
+ request_render(device, world, reset_mask);
607
+ }
608
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename ACTION_SPEC, typename NEXT_STATE_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA, bool>::type = true>
609
+ void step(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<ACTION_SPEC>& actions, Tensor<NEXT_STATE_SPEC>& next_states, RNG& rng) {
610
+ using TI = typename SPEC::TI;
611
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
612
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
613
+ static_assert(get<1>(typename ACTION_SPEC::SHAPE{}) == WORLD::ACTION_DIM);
614
+ if(world.render_pending){
615
+ if constexpr (SPEC::HISTORY_LENGTH > 1){
616
+ render(device, world, parameters, states, world.render_reset);
617
+ }
618
+ else{
619
+ if constexpr (SPEC::OUTPUT_FLOW){
620
+ prepare_render_inputs(device, world, parameters, states, world.render_reset);
621
+ }
622
+ reset_render_state(device, world, world.render_reset);
623
+ }
624
+ }
625
+ if constexpr (SPEC::OUTPUT_FLOW){
626
+ advance_flow(device, get_renderer(device, world));
627
+ }
628
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
629
+ if constexpr (SPEC::ENABLE_MOTION_BLUR){
630
+ const auto& instance_parameters = get_ref(device, parameters, instance_i);
631
+ const auto& state = get_ref(device, states, instance_i);
632
+ const typename SPEC::T aspect = static_cast<typename SPEC::T>(SPEC::CAM_WIDTH) / static_cast<typename SPEC::T>(SPEC::CAM_HEIGHT);
633
+ for(TI agent_i = 0; agent_i < WORLD::N_AGENTS; agent_i++){
634
+ const auto& agent = rl::environments::hyperdrone::_agent_state<SPEC>(state, agent_i);
635
+ for(TI camera_i = 0; camera_i < WORLD::N_CAMERAS_PER_AGENT; camera_i++){
636
+ const TI view_i = agent_i * WORLD::N_CAMERAS_PER_AGENT + camera_i;
637
+ set(device, world.prev_cameras, rl::environments::hyperdrone::make_camera<DEVICE, typename SPEC::T>(device, instance_parameters.agents[agent_i].cameras[camera_i], agent.orientation, agent.position, aspect, instance_parameters.scene_translation, instance_parameters.scene_yaw_cos, instance_parameters.scene_yaw_sin), instance_i * WORLD::N_VIEWS + view_i);
638
+ }
639
+ }
640
+ }
641
+ Matrix<matrix::Specification<typename ACTION_SPEC::T, TI, 1, WORLD::ACTION_DIM, false>> action_matrix;
642
+ for (TI action_i = 0; action_i < WORLD::ACTION_DIM; action_i++) {
643
+ set(action_matrix, 0, action_i, get(device, actions, instance_i, action_i));
644
+ }
645
+ step(device, world, get_ref(device, parameters, instance_i), get_ref(device, states, instance_i), action_matrix, get_ref(device, next_states, instance_i), rng);
646
+ }
647
+ world.history_step++;
648
+ set_all(device, world.render_reset, false);
649
+ request_render(device, world);
650
+ }
651
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename ACTION_SPEC, typename NEXT_STATE_SPEC, typename REWARD_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA, bool>::type = true>
652
+ void reward(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<ACTION_SPEC>& actions, Tensor<NEXT_STATE_SPEC>& next_states, Tensor<REWARD_SPEC>& rewards, RNG& rng) {
653
+ using TI = typename SPEC::TI;
654
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
655
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
656
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
657
+ Matrix<matrix::Specification<typename ACTION_SPEC::T, TI, 1, WORLD::ACTION_DIM, false>> action_matrix;
658
+ for (TI action_i = 0; action_i < WORLD::ACTION_DIM; action_i++) {
659
+ set(action_matrix, 0, action_i, get(device, actions, instance_i, action_i));
660
+ }
661
+ set(device, rewards, reward(device, world, get_ref(device, parameters, instance_i), get_ref(device, states, instance_i), action_matrix, get_ref(device, next_states, instance_i), rng), instance_i);
662
+ }
663
+ }
664
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename TERMINATED_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA, bool>::type = true>
665
+ void terminated(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, Tensor<TERMINATED_SPEC>& terminated_flags, RNG& rng) {
666
+ using TI = typename SPEC::TI;
667
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
668
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
669
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
670
+ set(device, terminated_flags, terminated(device, world, get_ref(device, parameters, instance_i), get_ref(device, states, instance_i), rng), instance_i);
671
+ }
672
+ }
673
+ // dynamics-side observations (privileged and reduced state-branch chains); the visual
674
+ // Image observation has its own overload below
675
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename OBSERVATION_TYPE, typename OBSERVATION_SPEC, typename RNG, typename utils::typing::enable_if<DEVICE::DEVICE_ID != devices::DeviceId::CUDA && !utils::typing::is_same_v<OBSERVATION_TYPE, typename rl::environments::hyperdrone::World<SPEC>::Observation>, bool>::type = true>
676
+ void observe(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, OBSERVATION_TYPE observation_type, Tensor<OBSERVATION_SPEC>& observations, RNG& rng) {
677
+ using TI = typename SPEC::TI;
678
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
679
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
680
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
681
+ auto observation_slice = view(device, observations, instance_i);
682
+ auto observation_matrix = matrix_view(device, observation_slice);
683
+ if constexpr (utils::typing::is_same_v<OBSERVATION_TYPE, typename WORLD::ObservationPrivileged>) {
684
+ rl::environments::hyperdrone::_observe_dynamics<DEVICE, SPEC>(device, world.dynamics, get_ref(device, parameters, instance_i), get_ref(device, states, instance_i), observation_matrix, rng);
685
+ } else {
686
+ static_assert(WORLD::N_AGENTS == 1, "multi-agent Worlds expose only the privileged observation on the dynamics side");
687
+ observe(device, world.dynamics, get_ref(device, parameters, instance_i).agents[0].dynamics, get_ref(device, states, instance_i), observation_type, observation_matrix, rng);
688
+ }
689
+ }
690
+ }
691
+
692
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC>
693
+ void prepare_render_inputs(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask_input) {
694
+ if(!world.render_pending){
695
+ return;
696
+ }
697
+ request_render(device, world, reset_mask_input);
698
+ auto& reset_mask = world.render_reset;
699
+ auto& renderer = get_renderer(device, world);
700
+ using T = typename SPEC::T;
701
+ using TI = typename SPEC::TI;
702
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
703
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
704
+ static_assert(SPEC::OUTPUT_RGB, "hyperdrone::World::render requires the RGB observation output");
705
+ constexpr TI INSTANCES = WORLD::INSTANCES;
706
+ constexpr TI NUM_CAMERAS = INSTANCES * WORLD::N_VIEWS;
707
+ const T aspect = static_cast<T>(SPEC::CAM_WIDTH) / static_cast<T>(SPEC::CAM_HEIGHT);
708
+
709
+ for (TI camera_i = 0; camera_i < NUM_CAMERAS; camera_i++) {
710
+ const TI instance_i = camera_i / WORLD::N_VIEWS;
711
+ const TI view_i = camera_i % WORLD::N_VIEWS;
712
+ const TI agent_i = view_i / WORLD::N_CAMERAS_PER_AGENT;
713
+ const TI mount_i = view_i % WORLD::N_CAMERAS_PER_AGENT;
714
+ const auto& instance_parameters = get_ref(device, parameters, instance_i);
715
+ const auto& agent_state = rl::environments::hyperdrone::_agent_state<SPEC>(get_ref(device, states, instance_i), agent_i);
716
+ set(device, world.camera_staging_close, rl::environments::hyperdrone::make_camera<DEVICE, T>(device, instance_parameters.agents[agent_i].cameras[mount_i], agent_state.orientation, agent_state.position, aspect, instance_parameters.scene_translation, instance_parameters.scene_yaw_cos, instance_parameters.scene_yaw_sin), camera_i);
717
+ }
718
+ copy(device, renderer.device, world.camera_staging_close, cameras(device, renderer));
719
+ if constexpr (SPEC::ENABLE_MOTION_BLUR) {
720
+ copy(device, device, world.prev_cameras, world.camera_staging_previous);
721
+ for (TI camera_i = 0; camera_i < NUM_CAMERAS; camera_i++) {
722
+ const TI instance_i = camera_i / WORLD::N_VIEWS;
723
+ const auto& instance_parameters = get_ref(device, parameters, instance_i);
724
+ bool reset = world.history_step <= 1 || get(device, reset_mask, instance_i);
725
+ const auto camera_close = get(device, world.camera_staging_close, camera_i);
726
+ set(device, world.camera_staging_open, reset ? camera_close : rl::environments::hyperdrone::interpolate_camera(camera_close, get(device, world.camera_staging_previous, camera_i), instance_parameters.shutter_fraction), camera_i);
727
+ }
728
+ copy(device, renderer.device, world.camera_staging_open, cameras_open(device, renderer));
729
+ }
730
+ if constexpr (SPEC::SELF_VISIBLE) {
731
+ for (TI instance_i = 0; instance_i < INSTANCES; instance_i++) {
732
+ const auto& instance_parameters = get_ref(device, parameters, instance_i);
733
+ for (TI agent_i = 0; agent_i < WORLD::N_AGENTS; agent_i++) {
734
+ const auto drone = instance_parameters.agents[agent_i].drone;
735
+ utils::assert_exit(device, drone < world.num_drones, "hyperdrone::World::render: drone entry out of range");
736
+ const auto& body = get_ref(device, world.drone_bodies, drone);
737
+ const auto& agent_state = rl::environments::hyperdrone::_agent_state<SPEC>(get_ref(device, states, instance_i), agent_i);
738
+ float base[12];
739
+ rl::environments::hyperdrone::rig::make_body_transform(device, agent_state.orientation, agent_state.position, instance_parameters.scene_translation, instance_parameters.scene_yaw_cos, instance_parameters.scene_yaw_sin, base);
740
+ float coordinates_open[WORLD::DYNAMICS_ENV::ACTION_DIM], coordinates_close[WORLD::DYNAMICS_ENV::ACTION_DIM];
741
+ rl::environments::hyperdrone::_drone_coordinates<DEVICE, SPEC>(device, instance_parameters, agent_i, agent_state, coordinates_open, coordinates_close);
742
+ // the body is posed at shutter close; only the props blur
743
+ rl::environments::hyperdrone::_drone_rows(device, world, renderer, instance_i, agent_i, body, base, base, coordinates_open, coordinates_close);
744
+ }
745
+ }
746
+ }
747
+ }
748
+
749
+ // Temporal resets are consumed even when no image is acquired.
750
+ template <typename DEVICE, typename SPEC, typename RESET_SPEC>
751
+ void reset_render_state(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, const Tensor<RESET_SPEC>& reset_mask){
752
+ using TI = typename SPEC::TI;
753
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
754
+ constexpr TI INSTANCES = WORLD::INSTANCES;
755
+ auto& renderer = get_renderer(device, world);
756
+ if constexpr (SPEC::OUTPUT_FLOW){
757
+ const bool first = world.flow_scene_version != world.scene_version;
758
+ if(!first){
759
+ copy(renderer.device, device, cameras_previous(device, renderer), world.camera_staging_previous);
760
+ }
761
+ for(TI instance_i = 0; instance_i < INSTANCES; instance_i++){
762
+ if(first || get(device, reset_mask, instance_i)){
763
+ for(TI view_i = 0; view_i < WORLD::N_VIEWS; view_i++){
764
+ const TI camera_i = instance_i * WORLD::N_VIEWS + view_i;
765
+ set(device, world.camera_staging_previous, get(device, world.camera_staging_close, camera_i), camera_i);
766
+ }
767
+ if constexpr (WORLD::RENDERER_SPEC::HAS_FLOW_OVERLAYS){
768
+ for(TI slot = 0; slot < SPEC::MAX_ENTITY_SLOTS_PER_INSTANCE; slot++){
769
+ const TI row = instance_i * SPEC::MAX_ENTITY_SLOTS_PER_INSTANCE + slot;
770
+ rendering::raytracing::detail::stage_previous(renderer, row, renderer.transforms_staging.data() + row * 12);
771
+ }
772
+ }
773
+ }
774
+ }
775
+ copy(device, renderer.device, world.camera_staging_previous, cameras_previous(device, renderer));
776
+ }
777
+ for(TI instance_i = 0; instance_i < INSTANCES; instance_i++){
778
+ if(get(device, reset_mask, instance_i)){
779
+ set(device, world.episode_start, world.history_step - 1, instance_i);
780
+ }
781
+ }
782
+ if constexpr (SPEC::OUTPUT_FLOW){
783
+ world.flow_scene_version = world.scene_version;
784
+ }
785
+ }
786
+
787
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC>
788
+ void render(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask_input) {
789
+ if(!world.render_pending){
790
+ return;
791
+ }
792
+ prepare_render_inputs(device, world, parameters, states, reset_mask_input);
793
+ reset_render_state(device, world, world.render_reset);
794
+ using TI = typename SPEC::TI;
795
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
796
+ constexpr TI NUM_CAMERAS = WORLD::INSTANCES * WORLD::N_VIEWS;
797
+ auto& renderer = get_renderer(device, world);
798
+ if constexpr (WORLD::RENDERER_CONFIG::NUM_OVERLAYS > 0){
799
+ update(device, renderer);
800
+ }
801
+ render(device, renderer);
802
+
803
+ const TI history_slot = (world.history_step - 1) % SPEC::HISTORY_LENGTH;
804
+ {
805
+ constexpr TI CAM_PIXELS = SPEC::CAM_WIDTH * SPEC::CAM_HEIGHT;
806
+ std::vector<float> observation_staging(NUM_CAMERAS * CAM_PIXELS * 3);
807
+ std::vector<float> frame_staging(NUM_CAMERAS * WORLD::FRAME_DIM);
808
+ {
809
+ Tensor<tensor::Specification<float, TI, typename decltype(renderer.observation)::SPEC::SHAPE>> observation_alias;
810
+ observation_alias._data = observation_staging.data();
811
+ copy(renderer.device, device, renderer.observation, observation_alias);
812
+ }
813
+ for (TI camera_i = 0; camera_i < NUM_CAMERAS; camera_i++) {
814
+ const auto& instance_parameters = get_ref(device, parameters, camera_i / WORLD::N_VIEWS);
815
+ const float scale = (float)instance_parameters.brightness_scale;
816
+ for (TI pixel_i = 0; pixel_i < CAM_PIXELS; pixel_i++) {
817
+ for (TI channel_i = 0; channel_i < 3; channel_i++) {
818
+ float value = observation_staging[(camera_i * CAM_PIXELS + pixel_i) * 3 + channel_i] * scale;
819
+ value = value < 0.0f ? 0.0f : (value > 1.0f ? 1.0f : value);
820
+ frame_staging[camera_i * WORLD::FRAME_DIM + pixel_i * WORLD::IMAGE_CHANNELS + channel_i] = value;
821
+ }
822
+ }
823
+ }
824
+ auto history_row = view(device, world.history, history_slot);
825
+ Tensor<tensor::Specification<float, TI, tensor::Shape<TI, NUM_CAMERAS, WORLD::FRAME_DIM>>> frame_alias;
826
+ frame_alias._data = frame_staging.data();
827
+ copy(device, device, frame_alias, history_row);
828
+ }
829
+ world.render_pending = false;
830
+ }
831
+
832
+ // the per-step visual observation is the latest rendered frame
833
+ template <typename DEVICE, typename SPEC, typename PARAMETER_SPEC, typename STATE_SPEC, typename OBSERVATION_SPEC, typename RNG>
834
+ void observe(DEVICE& device, rl::environments::hyperdrone::World<SPEC>& world, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, typename rl::environments::hyperdrone::World<SPEC>::Observation, Tensor<OBSERVATION_SPEC>& observations, RNG& rng) {
835
+ using T = typename SPEC::T;
836
+ using TI = typename SPEC::TI;
837
+ using WORLD = rl::environments::hyperdrone::World<SPEC>;
838
+ static_assert(rl::environments::hyperdrone::check_world_instance_tensors<WORLD, PARAMETER_SPEC, STATE_SPEC>());
839
+ static_assert(get<0>(typename OBSERVATION_SPEC::SHAPE{}) == WORLD::INSTANCES);
840
+ static_assert(get<1>(typename OBSERVATION_SPEC::SHAPE{}) == WORLD::OBSERVATION_DIM);
841
+ if(world.render_pending){
842
+ render(device, world, parameters, states, world.render_reset);
843
+ }
844
+ utils::assert_exit(device, world.history_step > 0, "hyperdrone::World::observe: no frame available");
845
+ const TI history_slot = (world.history_step - 1) % SPEC::HISTORY_LENGTH;
846
+ std::vector<float> frame_staging(WORLD::INSTANCES * WORLD::N_VIEWS * WORLD::FRAME_DIM);
847
+ auto history_row = view(device, world.history, history_slot);
848
+ Tensor<tensor::Specification<float, TI, tensor::Shape<TI, WORLD::INSTANCES * WORLD::N_VIEWS, WORLD::FRAME_DIM>>> frame_alias;
849
+ frame_alias._data = frame_staging.data();
850
+ copy(device, device, history_row, frame_alias);
851
+ for (TI instance_i = 0; instance_i < WORLD::INSTANCES; instance_i++) {
852
+ for (TI dim_i = 0; dim_i < WORLD::OBSERVATION_DIM; dim_i++) {
853
+ set(device, observations, (T)frame_staging[instance_i * WORLD::OBSERVATION_DIM + dim_i], instance_i, dim_i);
854
+ }
855
+ }
856
+ }
857
+
858
+ // MultiEnvironment over Worlds: owns the shared AssetLibrary and SceneSet; scenes are
859
+ // partitioned in contiguous blocks across the members
860
+ namespace rl::environments::hyperdrone {
861
+ template <typename MULTI_ENVIRONMENT, typename SPEC>
862
+ constexpr typename MULTI_ENVIRONMENT::TI instances_per_environment(){
863
+ static_assert(get<0>(typename SPEC::SHAPE{}) == MULTI_ENVIRONMENT::INSTANCES, "instance tensors must cover all members' instances contiguously");
864
+ return MULTI_ENVIRONMENT::INSTANCES_PER_ENVIRONMENT;
865
+ }
866
+ }
867
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS>
868
+ void malloc(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env) {
869
+ using TI = typename MEMBER::TI;
870
+ auto& render_device = get_rendering_device(device);
871
+ malloc(render_device, env.shared.library);
872
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
873
+ malloc(device, env.environments[environment_i]);
874
+ }
875
+ }
876
+ template <typename DEVICE, typename SPEC, typename DATASET>
877
+ void init_segmentation_taxonomy(DEVICE& device, rl::environments::hyperdrone::SharedContext<SPEC>& shared, const DATASET&){
878
+ if constexpr (SPEC::SEMANTIC_SEGMENTATION){
879
+ auto& render_device = get_rendering_device(device);
880
+ std::shared_ptr<const rendering::SegmentationTaxonomy> taxonomy;
881
+ std::string taxonomy_source;
882
+ std::vector<rendering::Object*> objects;
883
+ const std::string expected = DATASET::SEGMENTATION_TAXONOMY;
884
+ auto collect = [&](auto& container, const std::string& source, bool scene){
885
+ auto entries = segmentation_objects(render_device, container);
886
+ const auto candidate = segmentation_taxonomy(render_device, entries);
887
+ if(scene && !expected.empty() && (!candidate || candidate->name != expected)){
888
+ throw std::invalid_argument("hyperdrone: " + source + " requires segmentation taxonomy '" + expected + "'");
889
+ }
890
+ if(candidate){
891
+ if(taxonomy && (candidate->name != taxonomy->name || candidate->classes != taxonomy->classes)){
892
+ throw std::invalid_argument("hyperdrone: incompatible segmentation taxonomies in " + taxonomy_source + " and " + source + "; remap classes before loading");
893
+ }
894
+ taxonomy = candidate;
895
+ taxonomy_source = source;
896
+ }
897
+ objects.insert(objects.end(), entries.begin(), entries.end());
898
+ };
899
+ for(size_t scene_i = 0; scene_i < shared.library.scenes.size(); scene_i++){
900
+ collect(shared.library.scenes[scene_i], "scene " + shared.library.metadata[scene_i].content_hash, true);
901
+ }
902
+ collect(shared.library.pool, "overlay assets", false);
903
+ validate_semantic_segmentation(render_device, objects);
904
+ for(auto* object : objects){
905
+ if(object->segmentation_taxonomy){
906
+ object->segmentation_taxonomy = taxonomy;
907
+ }
908
+ }
909
+ shared.segmentation_taxonomy = std::move(taxonomy);
910
+ }
911
+ }
912
+
913
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename DATASET>
914
+ void init(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, const DATASET& dataset) {
915
+ using TI = typename MEMBER::TI;
916
+ auto& render_device = get_rendering_device(device);
917
+ typename DATASET::Corpus corpus;
918
+ enumerate(render_device, dataset, corpus);
919
+ const TI total_scenes = (TI)corpus.references.size();
920
+ utils::assert_exit(device, total_scenes >= NUMBER_OF_ENVIRONMENTS, "hyperdrone: fewer scenes than environments");
921
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
922
+ const TI first = environment_i * total_scenes / NUMBER_OF_ENVIRONMENTS;
923
+ const TI last = (environment_i + 1) * total_scenes / NUMBER_OF_ENVIRONMENTS;
924
+ env.environments[environment_i].rng_offset = environment_i * MEMBER::INSTANCES; // disjoint per-instance RNG partitions on devices with per-instance engines
925
+ init(device, env.environments[environment_i], env.shared, dataset, corpus, first, last - first, environment_i);
926
+ }
927
+ init_segmentation_taxonomy(device, env.shared, dataset);
928
+ }
929
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS>
930
+ void free(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env) {
931
+ using TI = typename MEMBER::TI;
932
+ auto& render_device = get_rendering_device(device);
933
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
934
+ free(device, env.environments[environment_i]);
935
+ }
936
+ free(render_device, env.shared.library);
937
+ env.shared.segmentation_taxonomy.reset();
938
+ }
939
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename RESET_SPEC, typename RNG>
940
+ void sample_initial_parameters(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, const Tensor<RESET_SPEC>& reset_mask, RNG& rng) {
941
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
942
+ using TI = typename MEMBER::TI;
943
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, PARAMETER_SPEC>();
944
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
945
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
946
+ auto reset_block = view_range(device, reset_mask, environment_i * M, tensor::ViewSpec<0, M>{});
947
+ sample_initial_parameters(device, env.environments[environment_i], parameters_block, reset_block, rng);
948
+ }
949
+ }
950
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC, typename RNG>
951
+ void sample_initial_state(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask, RNG& rng) {
952
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
953
+ using TI = typename MEMBER::TI;
954
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
955
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
956
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
957
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
958
+ auto reset_block = view_range(device, reset_mask, environment_i * M, tensor::ViewSpec<0, M>{});
959
+ sample_initial_state(device, env.environments[environment_i], parameters_block, states_block, reset_block, rng);
960
+ }
961
+ }
962
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename OBSERVATION_TYPE, typename OBSERVATION_SPEC, typename RNG>
963
+ void observe(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, OBSERVATION_TYPE observation_type, Tensor<OBSERVATION_SPEC>& observations, RNG& rng) {
964
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
965
+ using TI = typename MEMBER::TI;
966
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
967
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
968
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
969
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
970
+ auto observations_block = view_range(device, observations, environment_i * M, tensor::ViewSpec<0, M>{});
971
+ observe(device, env.environments[environment_i], parameters_block, states_block, observation_type, observations_block, rng);
972
+ }
973
+ }
974
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename ACTION_SPEC, typename NEXT_STATE_SPEC, typename RNG>
975
+ void step(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<ACTION_SPEC>& actions, Tensor<NEXT_STATE_SPEC>& next_states, RNG& rng) {
976
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
977
+ using TI = typename MEMBER::TI;
978
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
979
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
980
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
981
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
982
+ auto actions_block = view_range(device, actions, environment_i * M, tensor::ViewSpec<0, M>{});
983
+ auto next_states_block = view_range(device, next_states, environment_i * M, tensor::ViewSpec<0, M>{});
984
+ step(device, env.environments[environment_i], parameters_block, states_block, actions_block, next_states_block, rng);
985
+ }
986
+ }
987
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename ACTION_SPEC, typename NEXT_STATE_SPEC, typename REWARD_SPEC, typename RNG>
988
+ void reward(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<ACTION_SPEC>& actions, Tensor<NEXT_STATE_SPEC>& next_states, Tensor<REWARD_SPEC>& rewards, RNG& rng) {
989
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
990
+ using TI = typename MEMBER::TI;
991
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
992
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
993
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
994
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
995
+ auto actions_block = view_range(device, actions, environment_i * M, tensor::ViewSpec<0, M>{});
996
+ auto next_states_block = view_range(device, next_states, environment_i * M, tensor::ViewSpec<0, M>{});
997
+ auto rewards_block = view_range(device, rewards, environment_i * M, tensor::ViewSpec<0, M>{});
998
+ reward(device, env.environments[environment_i], parameters_block, states_block, actions_block, next_states_block, rewards_block, rng);
999
+ }
1000
+ }
1001
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename TERMINATED_SPEC, typename RNG>
1002
+ void terminated(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, Tensor<TERMINATED_SPEC>& terminated_flags, RNG& rng) {
1003
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
1004
+ using TI = typename MEMBER::TI;
1005
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
1006
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
1007
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
1008
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
1009
+ auto terminated_block = view_range(device, terminated_flags, environment_i * M, tensor::ViewSpec<0, M>{});
1010
+ terminated(device, env.environments[environment_i], parameters_block, states_block, terminated_block, rng);
1011
+ }
1012
+ }
1013
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS, typename PARAMETER_SPEC, typename STATE_SPEC, typename RESET_SPEC>
1014
+ void render(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env, Tensor<PARAMETER_SPEC>& parameters, Tensor<STATE_SPEC>& states, const Tensor<RESET_SPEC>& reset_mask) {
1015
+ using MULTI_ENVIRONMENT = rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>;
1016
+ using TI = typename MEMBER::TI;
1017
+ constexpr TI M = rl::environments::hyperdrone::instances_per_environment<MULTI_ENVIRONMENT, STATE_SPEC>();
1018
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
1019
+ auto parameters_block = view_range(device, parameters, environment_i * M, tensor::ViewSpec<0, M>{});
1020
+ auto states_block = view_range(device, states, environment_i * M, tensor::ViewSpec<0, M>{});
1021
+ auto reset_block = view_range(device, reset_mask, environment_i * M, tensor::ViewSpec<0, M>{});
1022
+ render(device, env.environments[environment_i], parameters_block, states_block, reset_block);
1023
+ }
1024
+ }
1025
+ template <typename DEVICE, typename MEMBER, typename MEMBER::TI NUMBER_OF_ENVIRONMENTS>
1026
+ void rotate_scene(DEVICE& device, rl::environments::hyperdrone::MultiEnvironment<MEMBER, NUMBER_OF_ENVIRONMENTS>& env) {
1027
+ using TI = typename MEMBER::TI;
1028
+ for (TI environment_i = 0; environment_i < NUMBER_OF_ENVIRONMENTS; environment_i++) {
1029
+ rotate_scene(device, env.environments[environment_i]);
1030
+ }
1031
+ }
1032
+
1033
+ template <typename DEVICE, typename SPEC>
1034
+ std::string json(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, const rl::environments::hyperdrone::Camera<typename SPEC::T>& camera){
1035
+ using rl::environments::l2f::detail::lossless_to_string;
1036
+ const auto& pose = camera.mount.pose;
1037
+ std::string json_string = "{\"mount\": {\"pose\": {\"position\": [";
1038
+ for (unsigned dim_i = 0; dim_i < 3; dim_i++) {
1039
+ json_string += lossless_to_string(pose.position[dim_i]) + (dim_i < 2 ? ", " : "");
1040
+ }
1041
+ json_string += "], \"orientation\": [";
1042
+ for (unsigned dim_i = 0; dim_i < 4; dim_i++) {
1043
+ json_string += lossless_to_string(pose.orientation[dim_i]) + (dim_i < 3 ? ", " : "");
1044
+ }
1045
+ json_string += "]}}, \"fov\": " + lossless_to_string(camera.fov) + "}";
1046
+ return json_string;
1047
+ }
1048
+ template <typename DEVICE, typename SPEC>
1049
+ void from_json(DEVICE& device, const rl::environments::hyperdrone::World<SPEC>& world, const nlohmann::json& json_object, rl::environments::hyperdrone::Camera<typename SPEC::T>& camera){
1050
+ using T = typename SPEC::T;
1051
+ const nlohmann::json& pose = json_object.at("mount").at("pose");
1052
+ for (unsigned dim_i = 0; dim_i < 3; dim_i++) {
1053
+ camera.mount.pose.position[dim_i] = pose.at("position").at(dim_i).get<T>();
1054
+ }
1055
+ for (unsigned dim_i = 0; dim_i < 4; dim_i++) {
1056
+ camera.mount.pose.orientation[dim_i] = pose.at("orientation").at(dim_i).get<T>();
1057
+ }
1058
+ camera.fov = json_object.at("fov").get<T>();
1059
+ }
1060
+ }
1061
+ RL_TOOLS_NAMESPACE_WRAPPER_END
1062
+
1063
+ #endif