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