plainmp 0.0.1__tar.gz

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 (399) hide show
  1. plainmp-0.0.1/.flake8 +8 -0
  2. plainmp-0.0.1/.gitignore +165 -0
  3. plainmp-0.0.1/.gitmodules +9 -0
  4. plainmp-0.0.1/CMakeLists.txt +22 -0
  5. plainmp-0.0.1/PKG-INFO +10 -0
  6. plainmp-0.0.1/cpp/bindings.cpp +11 -0
  7. plainmp-0.0.1/cpp/composite_constraint.hpp +85 -0
  8. plainmp-0.0.1/cpp/constraint.cpp +329 -0
  9. plainmp-0.0.1/cpp/constraint.hpp +212 -0
  10. plainmp-0.0.1/cpp/third/primitive_sdf_binding.cpp +45 -0
  11. plainmp-0.0.1/cpp/third/primitive_sdf_binding.hpp +10 -0
  12. plainmp-0.0.1/cpp/third/tinyfk_binding.cpp +41 -0
  13. plainmp-0.0.1/cpp/third/tinyfk_binding.hpp +6 -0
  14. plainmp-0.0.1/example/fetch_ik.py +41 -0
  15. plainmp-0.0.1/example/fetch_plan.py +59 -0
  16. plainmp-0.0.1/example/jaxon_ik.py +28 -0
  17. plainmp-0.0.1/format.sh +8 -0
  18. plainmp-0.0.1/primitive_sdf/.flake8 +8 -0
  19. plainmp-0.0.1/primitive_sdf/.github/workflows/build_and_test.yaml +39 -0
  20. plainmp-0.0.1/primitive_sdf/.github/workflows/format.yaml +33 -0
  21. plainmp-0.0.1/primitive_sdf/.gitignore +156 -0
  22. plainmp-0.0.1/primitive_sdf/.gitmodules +3 -0
  23. plainmp-0.0.1/primitive_sdf/CMakeLists.txt +19 -0
  24. plainmp-0.0.1/primitive_sdf/LICENSE +21 -0
  25. plainmp-0.0.1/primitive_sdf/README.md +27 -0
  26. plainmp-0.0.1/primitive_sdf/bench/bench.cpp +52 -0
  27. plainmp-0.0.1/primitive_sdf/bench/bench.py +13 -0
  28. plainmp-0.0.1/primitive_sdf/binding.cpp +39 -0
  29. plainmp-0.0.1/primitive_sdf/format.sh +6 -0
  30. plainmp-0.0.1/primitive_sdf/primitive_sdf.hpp +190 -0
  31. plainmp-0.0.1/primitive_sdf/python/psdf/__init__.py +3 -0
  32. plainmp-0.0.1/primitive_sdf/python/psdf/__init__.pyi +47 -0
  33. plainmp-0.0.1/primitive_sdf/python/test_psdf.py +102 -0
  34. plainmp-0.0.1/primitive_sdf/setup.py +17 -0
  35. plainmp-0.0.1/pybind11/.appveyor.yml +35 -0
  36. plainmp-0.0.1/pybind11/.clang-format +38 -0
  37. plainmp-0.0.1/pybind11/.clang-tidy +77 -0
  38. plainmp-0.0.1/pybind11/.cmake-format.yaml +73 -0
  39. plainmp-0.0.1/pybind11/.codespell-ignore-lines +24 -0
  40. plainmp-0.0.1/pybind11/.gitattributes +1 -0
  41. plainmp-0.0.1/pybind11/.github/CODEOWNERS +9 -0
  42. plainmp-0.0.1/pybind11/.github/CONTRIBUTING.md +388 -0
  43. plainmp-0.0.1/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +61 -0
  44. plainmp-0.0.1/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
  45. plainmp-0.0.1/pybind11/.github/dependabot.yml +15 -0
  46. plainmp-0.0.1/pybind11/.github/labeler.yml +13 -0
  47. plainmp-0.0.1/pybind11/.github/labeler_merged.yml +8 -0
  48. plainmp-0.0.1/pybind11/.github/matchers/pylint.json +32 -0
  49. plainmp-0.0.1/pybind11/.github/pull_request_template.md +19 -0
  50. plainmp-0.0.1/pybind11/.github/workflows/ci.yml +1235 -0
  51. plainmp-0.0.1/pybind11/.github/workflows/configure.yml +92 -0
  52. plainmp-0.0.1/pybind11/.github/workflows/emscripten.yaml +30 -0
  53. plainmp-0.0.1/pybind11/.github/workflows/format.yml +60 -0
  54. plainmp-0.0.1/pybind11/.github/workflows/labeler.yml +25 -0
  55. plainmp-0.0.1/pybind11/.github/workflows/pip.yml +117 -0
  56. plainmp-0.0.1/pybind11/.github/workflows/upstream.yml +116 -0
  57. plainmp-0.0.1/pybind11/.gitignore +46 -0
  58. plainmp-0.0.1/pybind11/.pre-commit-config.yaml +156 -0
  59. plainmp-0.0.1/pybind11/.readthedocs.yml +20 -0
  60. plainmp-0.0.1/pybind11/CMakeLists.txt +376 -0
  61. plainmp-0.0.1/pybind11/LICENSE +29 -0
  62. plainmp-0.0.1/pybind11/MANIFEST.in +6 -0
  63. plainmp-0.0.1/pybind11/README.rst +181 -0
  64. plainmp-0.0.1/pybind11/SECURITY.md +13 -0
  65. plainmp-0.0.1/pybind11/docs/Doxyfile +21 -0
  66. plainmp-0.0.1/pybind11/docs/Makefile +192 -0
  67. plainmp-0.0.1/pybind11/docs/_static/css/custom.css +3 -0
  68. plainmp-0.0.1/pybind11/docs/advanced/cast/chrono.rst +81 -0
  69. plainmp-0.0.1/pybind11/docs/advanced/cast/custom.rst +93 -0
  70. plainmp-0.0.1/pybind11/docs/advanced/cast/eigen.rst +310 -0
  71. plainmp-0.0.1/pybind11/docs/advanced/cast/functional.rst +109 -0
  72. plainmp-0.0.1/pybind11/docs/advanced/cast/index.rst +43 -0
  73. plainmp-0.0.1/pybind11/docs/advanced/cast/overview.rst +170 -0
  74. plainmp-0.0.1/pybind11/docs/advanced/cast/stl.rst +249 -0
  75. plainmp-0.0.1/pybind11/docs/advanced/cast/strings.rst +296 -0
  76. plainmp-0.0.1/pybind11/docs/advanced/classes.rst +1335 -0
  77. plainmp-0.0.1/pybind11/docs/advanced/embedding.rst +262 -0
  78. plainmp-0.0.1/pybind11/docs/advanced/exceptions.rst +401 -0
  79. plainmp-0.0.1/pybind11/docs/advanced/functions.rst +614 -0
  80. plainmp-0.0.1/pybind11/docs/advanced/misc.rst +429 -0
  81. plainmp-0.0.1/pybind11/docs/advanced/pycpp/index.rst +13 -0
  82. plainmp-0.0.1/pybind11/docs/advanced/pycpp/numpy.rst +453 -0
  83. plainmp-0.0.1/pybind11/docs/advanced/pycpp/object.rst +286 -0
  84. plainmp-0.0.1/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
  85. plainmp-0.0.1/pybind11/docs/advanced/smart_ptrs.rst +174 -0
  86. plainmp-0.0.1/pybind11/docs/basics.rst +307 -0
  87. plainmp-0.0.1/pybind11/docs/benchmark.py +89 -0
  88. plainmp-0.0.1/pybind11/docs/benchmark.rst +95 -0
  89. plainmp-0.0.1/pybind11/docs/changelog.rst +3121 -0
  90. plainmp-0.0.1/pybind11/docs/classes.rst +555 -0
  91. plainmp-0.0.1/pybind11/docs/cmake/index.rst +8 -0
  92. plainmp-0.0.1/pybind11/docs/compiling.rst +726 -0
  93. plainmp-0.0.1/pybind11/docs/conf.py +369 -0
  94. plainmp-0.0.1/pybind11/docs/faq.rst +308 -0
  95. plainmp-0.0.1/pybind11/docs/index.rst +48 -0
  96. plainmp-0.0.1/pybind11/docs/installing.rst +105 -0
  97. plainmp-0.0.1/pybind11/docs/limitations.rst +68 -0
  98. plainmp-0.0.1/pybind11/docs/pybind11-logo.png +0 -0
  99. plainmp-0.0.1/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  100. plainmp-0.0.1/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
  101. plainmp-0.0.1/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  102. plainmp-0.0.1/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
  103. plainmp-0.0.1/pybind11/docs/reference.rst +130 -0
  104. plainmp-0.0.1/pybind11/docs/release.rst +143 -0
  105. plainmp-0.0.1/pybind11/docs/requirements.in +6 -0
  106. plainmp-0.0.1/pybind11/docs/requirements.txt +275 -0
  107. plainmp-0.0.1/pybind11/docs/upgrade.rst +594 -0
  108. plainmp-0.0.1/pybind11/include/pybind11/attr.h +690 -0
  109. plainmp-0.0.1/pybind11/include/pybind11/buffer_info.h +208 -0
  110. plainmp-0.0.1/pybind11/include/pybind11/cast.h +1855 -0
  111. plainmp-0.0.1/pybind11/include/pybind11/chrono.h +225 -0
  112. plainmp-0.0.1/pybind11/include/pybind11/common.h +2 -0
  113. plainmp-0.0.1/pybind11/include/pybind11/complex.h +74 -0
  114. plainmp-0.0.1/pybind11/include/pybind11/detail/class.h +754 -0
  115. plainmp-0.0.1/pybind11/include/pybind11/detail/common.h +1284 -0
  116. plainmp-0.0.1/pybind11/include/pybind11/detail/descr.h +172 -0
  117. plainmp-0.0.1/pybind11/include/pybind11/detail/init.h +436 -0
  118. plainmp-0.0.1/pybind11/include/pybind11/detail/internals.h +764 -0
  119. plainmp-0.0.1/pybind11/include/pybind11/detail/type_caster_base.h +1154 -0
  120. plainmp-0.0.1/pybind11/include/pybind11/detail/typeid.h +65 -0
  121. plainmp-0.0.1/pybind11/include/pybind11/detail/value_and_holder.h +77 -0
  122. plainmp-0.0.1/pybind11/include/pybind11/eigen/common.h +9 -0
  123. plainmp-0.0.1/pybind11/include/pybind11/eigen/matrix.h +714 -0
  124. plainmp-0.0.1/pybind11/include/pybind11/eigen/tensor.h +517 -0
  125. plainmp-0.0.1/pybind11/include/pybind11/eigen.h +12 -0
  126. plainmp-0.0.1/pybind11/include/pybind11/embed.h +313 -0
  127. plainmp-0.0.1/pybind11/include/pybind11/eval.h +156 -0
  128. plainmp-0.0.1/pybind11/include/pybind11/functional.h +138 -0
  129. plainmp-0.0.1/pybind11/include/pybind11/gil.h +219 -0
  130. plainmp-0.0.1/pybind11/include/pybind11/gil_safe_call_once.h +100 -0
  131. plainmp-0.0.1/pybind11/include/pybind11/iostream.h +265 -0
  132. plainmp-0.0.1/pybind11/include/pybind11/numpy.h +2135 -0
  133. plainmp-0.0.1/pybind11/include/pybind11/operators.h +202 -0
  134. plainmp-0.0.1/pybind11/include/pybind11/options.h +92 -0
  135. plainmp-0.0.1/pybind11/include/pybind11/pybind11.h +3026 -0
  136. plainmp-0.0.1/pybind11/include/pybind11/pytypes.h +2604 -0
  137. plainmp-0.0.1/pybind11/include/pybind11/stl/filesystem.h +115 -0
  138. plainmp-0.0.1/pybind11/include/pybind11/stl.h +448 -0
  139. plainmp-0.0.1/pybind11/include/pybind11/stl_bind.h +822 -0
  140. plainmp-0.0.1/pybind11/include/pybind11/type_caster_pyobject_ptr.h +61 -0
  141. plainmp-0.0.1/pybind11/include/pybind11/typing.h +244 -0
  142. plainmp-0.0.1/pybind11/noxfile.py +107 -0
  143. plainmp-0.0.1/pybind11/pybind11/__init__.py +19 -0
  144. plainmp-0.0.1/pybind11/pybind11/__main__.py +63 -0
  145. plainmp-0.0.1/pybind11/pybind11/_version.py +12 -0
  146. plainmp-0.0.1/pybind11/pybind11/commands.py +39 -0
  147. plainmp-0.0.1/pybind11/pybind11/py.typed +0 -0
  148. plainmp-0.0.1/pybind11/pybind11/setup_helpers.py +500 -0
  149. plainmp-0.0.1/pybind11/pyproject.toml +87 -0
  150. plainmp-0.0.1/pybind11/setup.cfg +43 -0
  151. plainmp-0.0.1/pybind11/setup.py +149 -0
  152. plainmp-0.0.1/pybind11/tests/CMakeLists.txt +597 -0
  153. plainmp-0.0.1/pybind11/tests/conftest.py +224 -0
  154. plainmp-0.0.1/pybind11/tests/constructor_stats.h +322 -0
  155. plainmp-0.0.1/pybind11/tests/cross_module_gil_utils.cpp +111 -0
  156. plainmp-0.0.1/pybind11/tests/cross_module_interleaved_error_already_set.cpp +54 -0
  157. plainmp-0.0.1/pybind11/tests/eigen_tensor_avoid_stl_array.cpp +16 -0
  158. plainmp-0.0.1/pybind11/tests/env.py +31 -0
  159. plainmp-0.0.1/pybind11/tests/extra_python_package/pytest.ini +0 -0
  160. plainmp-0.0.1/pybind11/tests/extra_python_package/test_files.py +297 -0
  161. plainmp-0.0.1/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  162. plainmp-0.0.1/pybind11/tests/extra_setuptools/test_setuphelper.py +153 -0
  163. plainmp-0.0.1/pybind11/tests/local_bindings.h +92 -0
  164. plainmp-0.0.1/pybind11/tests/object.h +205 -0
  165. plainmp-0.0.1/pybind11/tests/pybind11_cross_module_tests.cpp +149 -0
  166. plainmp-0.0.1/pybind11/tests/pybind11_tests.cpp +131 -0
  167. plainmp-0.0.1/pybind11/tests/pybind11_tests.h +98 -0
  168. plainmp-0.0.1/pybind11/tests/pyproject.toml +17 -0
  169. plainmp-0.0.1/pybind11/tests/pytest.ini +23 -0
  170. plainmp-0.0.1/pybind11/tests/requirements.txt +13 -0
  171. plainmp-0.0.1/pybind11/tests/test_async.cpp +25 -0
  172. plainmp-0.0.1/pybind11/tests/test_async.py +31 -0
  173. plainmp-0.0.1/pybind11/tests/test_buffers.cpp +259 -0
  174. plainmp-0.0.1/pybind11/tests/test_buffers.py +230 -0
  175. plainmp-0.0.1/pybind11/tests/test_builtin_casters.cpp +387 -0
  176. plainmp-0.0.1/pybind11/tests/test_builtin_casters.py +532 -0
  177. plainmp-0.0.1/pybind11/tests/test_call_policies.cpp +113 -0
  178. plainmp-0.0.1/pybind11/tests/test_call_policies.py +249 -0
  179. plainmp-0.0.1/pybind11/tests/test_callbacks.cpp +280 -0
  180. plainmp-0.0.1/pybind11/tests/test_callbacks.py +230 -0
  181. plainmp-0.0.1/pybind11/tests/test_chrono.cpp +81 -0
  182. plainmp-0.0.1/pybind11/tests/test_chrono.py +207 -0
  183. plainmp-0.0.1/pybind11/tests/test_class.cpp +656 -0
  184. plainmp-0.0.1/pybind11/tests/test_class.py +503 -0
  185. plainmp-0.0.1/pybind11/tests/test_cmake_build/CMakeLists.txt +80 -0
  186. plainmp-0.0.1/pybind11/tests/test_cmake_build/embed.cpp +23 -0
  187. plainmp-0.0.1/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
  188. plainmp-0.0.1/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
  189. plainmp-0.0.1/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
  190. plainmp-0.0.1/pybind11/tests/test_cmake_build/main.cpp +6 -0
  191. plainmp-0.0.1/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +47 -0
  192. plainmp-0.0.1/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +41 -0
  193. plainmp-0.0.1/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +47 -0
  194. plainmp-0.0.1/pybind11/tests/test_cmake_build/test.py +10 -0
  195. plainmp-0.0.1/pybind11/tests/test_const_name.cpp +55 -0
  196. plainmp-0.0.1/pybind11/tests/test_const_name.py +31 -0
  197. plainmp-0.0.1/pybind11/tests/test_constants_and_functions.cpp +158 -0
  198. plainmp-0.0.1/pybind11/tests/test_constants_and_functions.py +58 -0
  199. plainmp-0.0.1/pybind11/tests/test_copy_move.cpp +544 -0
  200. plainmp-0.0.1/pybind11/tests/test_copy_move.py +140 -0
  201. plainmp-0.0.1/pybind11/tests/test_custom_type_casters.cpp +217 -0
  202. plainmp-0.0.1/pybind11/tests/test_custom_type_casters.py +124 -0
  203. plainmp-0.0.1/pybind11/tests/test_custom_type_setup.cpp +41 -0
  204. plainmp-0.0.1/pybind11/tests/test_custom_type_setup.py +50 -0
  205. plainmp-0.0.1/pybind11/tests/test_docstring_options.cpp +129 -0
  206. plainmp-0.0.1/pybind11/tests/test_docstring_options.py +66 -0
  207. plainmp-0.0.1/pybind11/tests/test_eigen_matrix.cpp +443 -0
  208. plainmp-0.0.1/pybind11/tests/test_eigen_matrix.py +816 -0
  209. plainmp-0.0.1/pybind11/tests/test_eigen_tensor.cpp +18 -0
  210. plainmp-0.0.1/pybind11/tests/test_eigen_tensor.inl +332 -0
  211. plainmp-0.0.1/pybind11/tests/test_eigen_tensor.py +290 -0
  212. plainmp-0.0.1/pybind11/tests/test_embed/CMakeLists.txt +54 -0
  213. plainmp-0.0.1/pybind11/tests/test_embed/catch.cpp +43 -0
  214. plainmp-0.0.1/pybind11/tests/test_embed/external_module.cpp +20 -0
  215. plainmp-0.0.1/pybind11/tests/test_embed/test_interpreter.cpp +488 -0
  216. plainmp-0.0.1/pybind11/tests/test_embed/test_interpreter.py +16 -0
  217. plainmp-0.0.1/pybind11/tests/test_embed/test_trampoline.py +18 -0
  218. plainmp-0.0.1/pybind11/tests/test_enum.cpp +133 -0
  219. plainmp-0.0.1/pybind11/tests/test_enum.py +270 -0
  220. plainmp-0.0.1/pybind11/tests/test_eval.cpp +118 -0
  221. plainmp-0.0.1/pybind11/tests/test_eval.py +52 -0
  222. plainmp-0.0.1/pybind11/tests/test_eval_call.py +5 -0
  223. plainmp-0.0.1/pybind11/tests/test_exceptions.cpp +388 -0
  224. plainmp-0.0.1/pybind11/tests/test_exceptions.h +13 -0
  225. plainmp-0.0.1/pybind11/tests/test_exceptions.py +434 -0
  226. plainmp-0.0.1/pybind11/tests/test_factory_constructors.cpp +430 -0
  227. plainmp-0.0.1/pybind11/tests/test_factory_constructors.py +518 -0
  228. plainmp-0.0.1/pybind11/tests/test_gil_scoped.cpp +144 -0
  229. plainmp-0.0.1/pybind11/tests/test_gil_scoped.py +249 -0
  230. plainmp-0.0.1/pybind11/tests/test_iostream.cpp +126 -0
  231. plainmp-0.0.1/pybind11/tests/test_iostream.py +297 -0
  232. plainmp-0.0.1/pybind11/tests/test_kwargs_and_defaults.cpp +325 -0
  233. plainmp-0.0.1/pybind11/tests/test_kwargs_and_defaults.py +428 -0
  234. plainmp-0.0.1/pybind11/tests/test_local_bindings.cpp +106 -0
  235. plainmp-0.0.1/pybind11/tests/test_local_bindings.py +259 -0
  236. plainmp-0.0.1/pybind11/tests/test_methods_and_attributes.cpp +492 -0
  237. plainmp-0.0.1/pybind11/tests/test_methods_and_attributes.py +539 -0
  238. plainmp-0.0.1/pybind11/tests/test_modules.cpp +125 -0
  239. plainmp-0.0.1/pybind11/tests/test_modules.py +118 -0
  240. plainmp-0.0.1/pybind11/tests/test_multiple_inheritance.cpp +341 -0
  241. plainmp-0.0.1/pybind11/tests/test_multiple_inheritance.py +495 -0
  242. plainmp-0.0.1/pybind11/tests/test_numpy_array.cpp +547 -0
  243. plainmp-0.0.1/pybind11/tests/test_numpy_array.py +672 -0
  244. plainmp-0.0.1/pybind11/tests/test_numpy_dtypes.cpp +639 -0
  245. plainmp-0.0.1/pybind11/tests/test_numpy_dtypes.py +448 -0
  246. plainmp-0.0.1/pybind11/tests/test_numpy_vectorize.cpp +107 -0
  247. plainmp-0.0.1/pybind11/tests/test_numpy_vectorize.py +268 -0
  248. plainmp-0.0.1/pybind11/tests/test_opaque_types.cpp +77 -0
  249. plainmp-0.0.1/pybind11/tests/test_opaque_types.py +60 -0
  250. plainmp-0.0.1/pybind11/tests/test_operator_overloading.cpp +281 -0
  251. plainmp-0.0.1/pybind11/tests/test_operator_overloading.py +153 -0
  252. plainmp-0.0.1/pybind11/tests/test_pickling.cpp +194 -0
  253. plainmp-0.0.1/pybind11/tests/test_pickling.py +95 -0
  254. plainmp-0.0.1/pybind11/tests/test_python_multiple_inheritance.cpp +45 -0
  255. plainmp-0.0.1/pybind11/tests/test_python_multiple_inheritance.py +36 -0
  256. plainmp-0.0.1/pybind11/tests/test_pytypes.cpp +926 -0
  257. plainmp-0.0.1/pybind11/tests/test_pytypes.py +1050 -0
  258. plainmp-0.0.1/pybind11/tests/test_sequences_and_iterators.cpp +600 -0
  259. plainmp-0.0.1/pybind11/tests/test_sequences_and_iterators.py +267 -0
  260. plainmp-0.0.1/pybind11/tests/test_smart_ptr.cpp +473 -0
  261. plainmp-0.0.1/pybind11/tests/test_smart_ptr.py +317 -0
  262. plainmp-0.0.1/pybind11/tests/test_stl.cpp +549 -0
  263. plainmp-0.0.1/pybind11/tests/test_stl.py +383 -0
  264. plainmp-0.0.1/pybind11/tests/test_stl_binders.cpp +275 -0
  265. plainmp-0.0.1/pybind11/tests/test_stl_binders.py +395 -0
  266. plainmp-0.0.1/pybind11/tests/test_tagbased_polymorphic.cpp +147 -0
  267. plainmp-0.0.1/pybind11/tests/test_tagbased_polymorphic.py +30 -0
  268. plainmp-0.0.1/pybind11/tests/test_thread.cpp +66 -0
  269. plainmp-0.0.1/pybind11/tests/test_thread.py +49 -0
  270. plainmp-0.0.1/pybind11/tests/test_type_caster_pyobject_ptr.cpp +167 -0
  271. plainmp-0.0.1/pybind11/tests/test_type_caster_pyobject_ptr.py +122 -0
  272. plainmp-0.0.1/pybind11/tests/test_union.cpp +22 -0
  273. plainmp-0.0.1/pybind11/tests/test_union.py +10 -0
  274. plainmp-0.0.1/pybind11/tests/test_unnamed_namespace_a.cpp +38 -0
  275. plainmp-0.0.1/pybind11/tests/test_unnamed_namespace_a.py +36 -0
  276. plainmp-0.0.1/pybind11/tests/test_unnamed_namespace_b.cpp +13 -0
  277. plainmp-0.0.1/pybind11/tests/test_unnamed_namespace_b.py +7 -0
  278. plainmp-0.0.1/pybind11/tests/test_vector_unique_ptr_member.cpp +54 -0
  279. plainmp-0.0.1/pybind11/tests/test_vector_unique_ptr_member.py +16 -0
  280. plainmp-0.0.1/pybind11/tests/test_virtual_functions.cpp +592 -0
  281. plainmp-0.0.1/pybind11/tests/test_virtual_functions.py +463 -0
  282. plainmp-0.0.1/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
  283. plainmp-0.0.1/pybind11/tests/valgrind-python.supp +117 -0
  284. plainmp-0.0.1/pybind11/tools/FindCatch.cmake +76 -0
  285. plainmp-0.0.1/pybind11/tools/FindEigen3.cmake +86 -0
  286. plainmp-0.0.1/pybind11/tools/FindPythonLibsNew.cmake +310 -0
  287. plainmp-0.0.1/pybind11/tools/JoinPaths.cmake +23 -0
  288. plainmp-0.0.1/pybind11/tools/check-style.sh +44 -0
  289. plainmp-0.0.1/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  290. plainmp-0.0.1/pybind11/tools/codespell_ignore_lines_from_errors.py +40 -0
  291. plainmp-0.0.1/pybind11/tools/libsize.py +38 -0
  292. plainmp-0.0.1/pybind11/tools/make_changelog.py +92 -0
  293. plainmp-0.0.1/pybind11/tools/pybind11.pc.in +7 -0
  294. plainmp-0.0.1/pybind11/tools/pybind11Common.cmake +429 -0
  295. plainmp-0.0.1/pybind11/tools/pybind11Config.cmake.in +233 -0
  296. plainmp-0.0.1/pybind11/tools/pybind11GuessPythonExtSuffix.cmake +86 -0
  297. plainmp-0.0.1/pybind11/tools/pybind11NewTools.cmake +341 -0
  298. plainmp-0.0.1/pybind11/tools/pybind11Tools.cmake +239 -0
  299. plainmp-0.0.1/pybind11/tools/pyproject.toml +3 -0
  300. plainmp-0.0.1/pybind11/tools/setup_global.py.in +63 -0
  301. plainmp-0.0.1/pybind11/tools/setup_main.py.in +44 -0
  302. plainmp-0.0.1/pybind11/tools/test-pybind11GuessPythonExtSuffix.cmake +161 -0
  303. plainmp-0.0.1/python/plainmp/__init__.py +0 -0
  304. plainmp-0.0.1/python/plainmp/conf/fetch.yaml +135 -0
  305. plainmp-0.0.1/python/plainmp/conf/jaxon.yaml +174 -0
  306. plainmp-0.0.1/python/plainmp/constraint.py +12 -0
  307. plainmp-0.0.1/python/plainmp/constraint.pyi +34 -0
  308. plainmp-0.0.1/python/plainmp/ik.py +102 -0
  309. plainmp-0.0.1/python/plainmp/ompl_solver.py +120 -0
  310. plainmp-0.0.1/python/plainmp/problem.py +25 -0
  311. plainmp-0.0.1/python/plainmp/psdf.py +9 -0
  312. plainmp-0.0.1/python/plainmp/psdf.pyi +32 -0
  313. plainmp-0.0.1/python/plainmp/robot_spec.py +362 -0
  314. plainmp-0.0.1/python/plainmp/tinyfk.py +1 -0
  315. plainmp-0.0.1/python/plainmp/tinyfk.pyi +9 -0
  316. plainmp-0.0.1/python/plainmp/trajectory.py +181 -0
  317. plainmp-0.0.1/python/plainmp/utils.py +21 -0
  318. plainmp-0.0.1/python/plainmp.egg-info/PKG-INFO +10 -0
  319. plainmp-0.0.1/python/plainmp.egg-info/SOURCES.txt +397 -0
  320. plainmp-0.0.1/python/plainmp.egg-info/dependency_links.txt +1 -0
  321. plainmp-0.0.1/python/plainmp.egg-info/requires.txt +1 -0
  322. plainmp-0.0.1/python/plainmp.egg-info/top_level.txt +1 -0
  323. plainmp-0.0.1/python/tests/test_constraints.py +101 -0
  324. plainmp-0.0.1/python/tests/test_ik.py +30 -0
  325. plainmp-0.0.1/setup.cfg +4 -0
  326. plainmp-0.0.1/setup.py +17 -0
  327. plainmp-0.0.1/tinyfk/.clang-format +137 -0
  328. plainmp-0.0.1/tinyfk/.flake8 +8 -0
  329. plainmp-0.0.1/tinyfk/.github/workflows/cpp_format.yaml +23 -0
  330. plainmp-0.0.1/tinyfk/.github/workflows/release_src.yaml +25 -0
  331. plainmp-0.0.1/tinyfk/.github/workflows/release_wheel.yml +32 -0
  332. plainmp-0.0.1/tinyfk/.github/workflows/test_core_cpp.yaml +37 -0
  333. plainmp-0.0.1/tinyfk/.github/workflows/test_python_wrapper.yaml +41 -0
  334. plainmp-0.0.1/tinyfk/.gitignore +8 -0
  335. plainmp-0.0.1/tinyfk/.gitmodules +6 -0
  336. plainmp-0.0.1/tinyfk/CMakeLists.txt +93 -0
  337. plainmp-0.0.1/tinyfk/LICENSE +21 -0
  338. plainmp-0.0.1/tinyfk/README.md +67 -0
  339. plainmp-0.0.1/tinyfk/bench/bench_kdl.cpp +60 -0
  340. plainmp-0.0.1/tinyfk/bench/bench_tinyfk.cpp +60 -0
  341. plainmp-0.0.1/tinyfk/bench/compare_eus.l +33 -0
  342. plainmp-0.0.1/tinyfk/bench/compare_skrobot.py +69 -0
  343. plainmp-0.0.1/tinyfk/bench/kdl_parser/kdl_parser.cpp +236 -0
  344. plainmp-0.0.1/tinyfk/bench/kdl_parser/kdl_parser.hpp +92 -0
  345. plainmp-0.0.1/tinyfk/bench/kdl_parser/visibility_control.hpp +79 -0
  346. plainmp-0.0.1/tinyfk/data/fetch.urdf +328 -0
  347. plainmp-0.0.1/tinyfk/data/kuka.urdf +184 -0
  348. plainmp-0.0.1/tinyfk/data/pr2.urdf +1433 -0
  349. plainmp-0.0.1/tinyfk/format.sh +7 -0
  350. plainmp-0.0.1/tinyfk/include/data_structure.hpp +63 -0
  351. plainmp-0.0.1/tinyfk/include/tinyfk.hpp +166 -0
  352. plainmp-0.0.1/tinyfk/pyproject.toml +9 -0
  353. plainmp-0.0.1/tinyfk/python/.gitignore +138 -0
  354. plainmp-0.0.1/tinyfk/python/example/fk.py +31 -0
  355. plainmp-0.0.1/tinyfk/python/example/ik.py +37 -0
  356. plainmp-0.0.1/tinyfk/python/tests/test_pickle.py +47 -0
  357. plainmp-0.0.1/tinyfk/python/tests/test_tinyfk.py +204 -0
  358. plainmp-0.0.1/tinyfk/python/tinyfk/__init__.py +290 -0
  359. plainmp-0.0.1/tinyfk/python/tinyfk/py.typed +0 -0
  360. plainmp-0.0.1/tinyfk/release/Dockerfile +49 -0
  361. plainmp-0.0.1/tinyfk/release/check_glibcxx.sh +10 -0
  362. plainmp-0.0.1/tinyfk/release/python_versions.txt +5 -0
  363. plainmp-0.0.1/tinyfk/setup.py +19 -0
  364. plainmp-0.0.1/tinyfk/src/kinematics.cpp +319 -0
  365. plainmp-0.0.1/tinyfk/src/tinyfk.cpp +297 -0
  366. plainmp-0.0.1/tinyfk/src/wrapper.cpp +283 -0
  367. plainmp-0.0.1/tinyfk/test/.gitignore +1 -0
  368. plainmp-0.0.1/tinyfk/test/data/ground_truth_gen.py +59 -0
  369. plainmp-0.0.1/tinyfk/test/data/test_data.json +1 -0
  370. plainmp-0.0.1/tinyfk/test/test_data_structure.cpp +24 -0
  371. plainmp-0.0.1/tinyfk/test/test_kinematics.cpp +227 -0
  372. plainmp-0.0.1/tinyfk/test/test_others.cpp +35 -0
  373. plainmp-0.0.1/tinyfk/test/test_parse.cpp +45 -0
  374. plainmp-0.0.1/tinyfk/urdf_parser/.gitignore +1 -0
  375. plainmp-0.0.1/tinyfk/urdf_parser/CMakeLists.txt +17 -0
  376. plainmp-0.0.1/tinyfk/urdf_parser/README.md +5 -0
  377. plainmp-0.0.1/tinyfk/urdf_parser/include/LICENSE +33 -0
  378. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_exception/exception.h +53 -0
  379. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/color.h +105 -0
  380. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/joint.h +281 -0
  381. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/link.h +250 -0
  382. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/model.h +206 -0
  383. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/pose.h +348 -0
  384. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/types.h +91 -0
  385. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_model/utils.h +92 -0
  386. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_parser/exportdecl.h +84 -0
  387. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_parser/urdf_parser.h +149 -0
  388. plainmp-0.0.1/tinyfk/urdf_parser/include/urdf_world/types.h +52 -0
  389. plainmp-0.0.1/tinyfk/urdf_parser/src/joint.cpp +642 -0
  390. plainmp-0.0.1/tinyfk/urdf_parser/src/link.cpp +668 -0
  391. plainmp-0.0.1/tinyfk/urdf_parser/src/model.cpp +312 -0
  392. plainmp-0.0.1/tinyfk/urdf_parser/src/pose.cpp +150 -0
  393. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/CMakeLists.txt +2 -0
  394. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinystr.cpp +111 -0
  395. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinystr.h +305 -0
  396. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinyxml.cpp +1886 -0
  397. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinyxml.h +1807 -0
  398. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinyxmlerror.cpp +52 -0
  399. plainmp-0.0.1/tinyfk/urdf_parser/tinyxml/tinyxmlparser.cpp +1638 -0
plainmp-0.0.1/.flake8 ADDED
@@ -0,0 +1,8 @@
1
+ [flake8]
2
+ ignore =
3
+ I, H
4
+ E501
5
+ E203
6
+ E741
7
+ W503
8
+ A, B, C, CNL, D, Q
@@ -0,0 +1,165 @@
1
+ compile_commands.json
2
+ /pybind11
3
+ /build
4
+ /_skbuild
5
+ /dist
6
+ *.egg/
7
+ *.egg-info/
8
+ action.sh
9
+
10
+ # other stuff
11
+ *.new
12
+ *.bak
13
+
14
+ # Byte-compiled / optimized / DLL files
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+
19
+ # C extensions
20
+ *.so
21
+
22
+ # Distribution / packaging
23
+ .Python
24
+ build/
25
+ develop-eggs/
26
+ dist/
27
+ downloads/
28
+ eggs/
29
+ .eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ wheels/
36
+ share/python-wheels/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+ MANIFEST
41
+
42
+ # PyInstaller
43
+ # Usually these files are written by a python script from a template
44
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
45
+ *.manifest
46
+ *.spec
47
+
48
+ # Installer logs
49
+ pip-log.txt
50
+ pip-delete-this-directory.txt
51
+
52
+ # Unit test / coverage reports
53
+ htmlcov/
54
+ .tox/
55
+ .nox/
56
+ .coverage
57
+ .coverage.*
58
+ .cache
59
+ nosetests.xml
60
+ coverage.xml
61
+ *.cover
62
+ *.py,cover
63
+ .hypothesis/
64
+ .pytest_cache/
65
+ cover/
66
+
67
+ # Translations
68
+ *.mo
69
+ *.pot
70
+
71
+ # Django stuff:
72
+ *.log
73
+ local_settings.py
74
+ db.sqlite3
75
+ db.sqlite3-journal
76
+
77
+ # Flask stuff:
78
+ instance/
79
+ .webassets-cache
80
+
81
+ # Scrapy stuff:
82
+ .scrapy
83
+
84
+ # Sphinx documentation
85
+ docs/_build/
86
+
87
+ # PyBuilder
88
+ .pybuilder/
89
+ target/
90
+
91
+ # Jupyter Notebook
92
+ .ipynb_checkpoints
93
+
94
+ # IPython
95
+ profile_default/
96
+ ipython_config.py
97
+
98
+ # pyenv
99
+ # For a library or package, you might want to ignore these files since the code is
100
+ # intended to run in multiple environments; otherwise, check them in:
101
+ # .python-version
102
+
103
+ # pipenv
104
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
105
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
106
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
107
+ # install all needed dependencies.
108
+ #Pipfile.lock
109
+
110
+ # poetry
111
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
112
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
113
+ # commonly ignored for libraries.
114
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
115
+ #poetry.lock
116
+
117
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
118
+ __pypackages__/
119
+
120
+ # Celery stuff
121
+ celerybeat-schedule
122
+ celerybeat.pid
123
+
124
+ # SageMath parsed files
125
+ *.sage.py
126
+
127
+ # Environments
128
+ .env
129
+ .venv
130
+ env/
131
+ venv/
132
+ ENV/
133
+ env.bak/
134
+ venv.bak/
135
+
136
+ # Spyder project settings
137
+ .spyderproject
138
+ .spyproject
139
+
140
+ # Rope project settings
141
+ .ropeproject
142
+
143
+ # mkdocs documentation
144
+ /site
145
+
146
+ # mypy
147
+ .mypy_cache/
148
+ .dmypy.json
149
+ dmypy.json
150
+
151
+ # Pyre type checker
152
+ .pyre/
153
+
154
+ # pytype static type analyzer
155
+ .pytype/
156
+
157
+ # Cython debug symbols
158
+ cython_debug/
159
+
160
+ # PyCharm
161
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
162
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
163
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
164
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
165
+ #.idea/
@@ -0,0 +1,9 @@
1
+ [submodule "tinyfk"]
2
+ path = tinyfk
3
+ url = git@github.com:HiroIshida/tinyfk.git
4
+ [submodule "primitive_sdf"]
5
+ path = primitive_sdf
6
+ url = git@github.com:HiroIshida/primitive_sdf.git
7
+ [submodule "pybind11"]
8
+ path = pybind11
9
+ url = git@github.com:pybind/pybind11.git
@@ -0,0 +1,22 @@
1
+ set(CMAKE_CXX_STANDARD 17)
2
+ if(NOT CMAKE_BUILD_TYPE)
3
+ set(CMAKE_BUILD_TYPE Release)
4
+ endif(NOT CMAKE_BUILD_TYPE)
5
+ set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS_INIT} -Wall -fPIC")
6
+
7
+ find_package(Eigen3 REQUIRED)
8
+ ADD_DEFINITIONS(-DEIGEN_NO_DEBUG)
9
+ include_directories(${EIGEN3_INCLUDE_DIR})
10
+
11
+ option(BUILD_PYTHON_INTERFACE OFF)
12
+ add_subdirectory("tinyfk")
13
+ include_directories("tinyfk/include")
14
+ include_directories("primitive_sdf")
15
+ # add_executable(main main.cpp)
16
+ # target_link_libraries(main tinyfk)
17
+
18
+ file(GLOB_RECURSE SRC_FILES cpp/*.cpp)
19
+ add_subdirectory(pybind11)
20
+ pybind11_add_module(_plainmp ${SRC_FILES})
21
+ target_link_libraries(_plainmp PRIVATE tinyfk)
22
+ install(TARGETS _plainmp DESTINATION .)
plainmp-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 1.0
2
+ Name: plainmp
3
+ Version: 0.0.1
4
+ Summary: experimental
5
+ Home-page: UNKNOWN
6
+ Author: Hirokazu Ishida
7
+ Author-email: UNKNOWN
8
+ License: MIT
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN
@@ -0,0 +1,11 @@
1
+ #include <pybind11/pybind11.h>
2
+ #include "constraint.hpp"
3
+ #include "third/primitive_sdf_binding.hpp"
4
+ #include "third/tinyfk_binding.hpp"
5
+ namespace py = pybind11;
6
+
7
+ PYBIND11_MODULE(_plainmp, m) {
8
+ primitive_sdf::bind_primitive_sdf(m);
9
+ cst::bind_collision_constraints(m);
10
+ tinyfk::bind_tinyfk(m);
11
+ }
@@ -0,0 +1,85 @@
1
+ #include <pybind11/eigen.h>
2
+ #include <pybind11/pybind11.h>
3
+ #include <Eigen/Dense>
4
+ #include <Eigen/Geometry>
5
+ #include <algorithm>
6
+ #include <memory>
7
+ #include <tinyfk.hpp>
8
+ #include <utility>
9
+ #include "constraint.hpp"
10
+ #include "primitive_sdf.hpp"
11
+
12
+ namespace cst {
13
+ template <typename T>
14
+ class CompositeConstraintBase {
15
+ public:
16
+ using Ptr = std::shared_ptr<CompositeConstraintBase>;
17
+ CompositeConstraintBase(std::vector<T> constraints)
18
+ : constraints_(constraints) {
19
+ // all constraints must have the same kinematic chain
20
+ // otherwise, the jacobian will be wrong
21
+ for (auto cst : constraints_) {
22
+ if (cst->kin_ != constraints_.front()->kin_) {
23
+ throw std::runtime_error(
24
+ "All constraints must have the same kinematic chain");
25
+ }
26
+ }
27
+ }
28
+
29
+ void update_kintree(const std::vector<double>& q) {
30
+ constraints_.front()->update_kintree(q);
31
+ }
32
+
33
+ std::pair<Eigen::VectorXd, Eigen::MatrixXd> evaluate(
34
+ const std::vector<double>& q) {
35
+ update_kintree(q);
36
+
37
+ size_t dim = this->cst_dim();
38
+ Eigen::VectorXd vals(dim);
39
+ Eigen::MatrixXd jac(dim, q_dim());
40
+ size_t head = 0;
41
+ for (const auto& cst : constraints_) {
42
+ size_t dim_local = cst->cst_dim();
43
+ auto [vals_sub, jac_sub] = cst->evaluate_dirty();
44
+ vals.segment(head, dim_local) = vals_sub;
45
+ jac.block(head, 0, dim_local, q_dim()) = jac_sub;
46
+ head += dim_local;
47
+ }
48
+ return {vals, jac};
49
+ }
50
+
51
+ size_t q_dim() const { return constraints_.front()->q_dim(); }
52
+
53
+ size_t cst_dim() const {
54
+ return std::accumulate(
55
+ constraints_.begin(), constraints_.end(), 0,
56
+ [](size_t sum, const T& cst) { return sum + cst->cst_dim(); });
57
+ }
58
+ std::vector<T> constraints_;
59
+ };
60
+
61
+ class EqCompositeCst : public CompositeConstraintBase<EqConstraintBase::Ptr> {
62
+ public:
63
+ using Ptr = std::shared_ptr<EqCompositeCst>;
64
+ using CompositeConstraintBase::CompositeConstraintBase;
65
+ size_t cst_dim() const;
66
+ bool is_equality() const { return true; }
67
+ };
68
+
69
+ class IneqCompositeCst
70
+ : public CompositeConstraintBase<IneqConstraintBase::Ptr> {
71
+ public:
72
+ using Ptr = std::shared_ptr<IneqCompositeCst>;
73
+ using CompositeConstraintBase::CompositeConstraintBase;
74
+ bool is_valid(const std::vector<double>& q) {
75
+ update_kintree(q);
76
+ for (const auto& cst : constraints_) {
77
+ if (!cst->is_valid_dirty())
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ size_t cst_dim() const;
83
+ bool is_equality() const { return false; }
84
+ };
85
+ } // namespace cst
@@ -0,0 +1,329 @@
1
+ #include "constraint.hpp"
2
+ #include <pybind11/stl.h>
3
+ #include <optional>
4
+ #include <stdexcept>
5
+ #include "composite_constraint.hpp"
6
+ #include "primitive_sdf.hpp"
7
+ #include "tinyfk.hpp"
8
+
9
+ namespace cst {
10
+
11
+ namespace py = pybind11;
12
+
13
+ std::pair<Eigen::VectorXd, Eigen::MatrixXd> LinkPoseCst::evaluate_dirty()
14
+ const {
15
+ Eigen::VectorXd vals(cst_dim());
16
+ Eigen::MatrixXd jac(cst_dim(), q_dim());
17
+ tinyfk::Transform pose;
18
+ size_t head = 0;
19
+ for (size_t i = 0; i < link_ids_.size(); i++) {
20
+ kin_->get_link_pose(link_ids_[i], pose);
21
+ if (poses_[i].size() == 3) {
22
+ vals.segment(head, 3) =
23
+ Eigen::Vector3d(pose.position.x, pose.position.y, pose.position.z) -
24
+ poses_[i];
25
+ jac.block(head, 0, 3, q_dim()) =
26
+ kin_->get_jacobian(link_ids_[i], control_joint_ids_,
27
+ tinyfk::RotationType::IGNORE, with_base_);
28
+ head += 3;
29
+ } else {
30
+ vals.segment(head, 3) =
31
+ Eigen::Vector3d(pose.position.x, pose.position.y, pose.position.z) -
32
+ poses_[i];
33
+ auto rpy = pose.rotation.getRPY();
34
+ vals.segment(head + 3, 3) =
35
+ Eigen::Vector3d(rpy.x, rpy.y, rpy.z) - poses_[i].segment(3, 3);
36
+ jac.block(head, 0, 6, q_dim()) =
37
+ kin_->get_jacobian(link_ids_[i], control_joint_ids_,
38
+ tinyfk::RotationType::RPY, with_base_);
39
+ head += 6;
40
+ }
41
+ }
42
+ return {vals, jac};
43
+ }
44
+
45
+ SphereCollisionCst::SphereCollisionCst(
46
+ std::shared_ptr<tinyfk::KinematicModel> kin,
47
+ const std::vector<std::string>& control_joint_names,
48
+ bool with_base,
49
+ const std::vector<SphereAttachentSpec>& sphere_specs,
50
+ const std::vector<std::pair<std::string, std::string>>& selcol_pairs,
51
+ const std::vector<primitive_sdf::PrimitiveSDFBase::Ptr>& fixed_sdfs)
52
+ : IneqConstraintBase(kin, control_joint_names, with_base),
53
+ sphere_specs_(sphere_specs),
54
+ fixed_sdfs_(fixed_sdfs) {
55
+ std::vector<std::string> parent_link_names;
56
+ for (const auto& spec : sphere_specs) {
57
+ auto parent_id = kin_->get_link_ids({spec.parent_link_name})[0];
58
+ auto name = "sphere" + std::to_string(sphere_ids_.size());
59
+ kin_->add_new_link(name, parent_id,
60
+ {spec.relative_position.x(), spec.relative_position.y(),
61
+ spec.relative_position.z()},
62
+ {0.0, 0.0, 0.0});
63
+ sphere_ids_.push_back(kin_->get_link_ids({name})[0]);
64
+ parent_link_names.push_back(spec.parent_link_name);
65
+ }
66
+ std::vector<std::pair<size_t, size_t>> selcol_pairs_ids;
67
+ for (const auto& pair : selcol_pairs) {
68
+ std::vector<size_t> first_ids;
69
+ std::vector<size_t> second_ids;
70
+ for (size_t i = 0; i < parent_link_names.size(); i++) {
71
+ if (parent_link_names[i] == pair.first) {
72
+ first_ids.push_back(i);
73
+ }
74
+ if (parent_link_names[i] == pair.second) {
75
+ second_ids.push_back(i);
76
+ }
77
+ }
78
+ for (auto& first_id : first_ids) {
79
+ for (auto& second_id : second_ids) {
80
+ selcol_pairs_ids.push_back({first_id, second_id});
81
+ }
82
+ }
83
+ }
84
+ selcol_pairs_ids_ = selcol_pairs_ids;
85
+ }
86
+
87
+ bool SphereCollisionCst::is_valid_dirty() const {
88
+ tinyfk::Transform pose;
89
+ for (size_t i = 0; i < sphere_ids_.size(); i++) {
90
+ if (sphere_specs_[i].ignore_collision) {
91
+ continue;
92
+ }
93
+ kin_->get_link_pose(sphere_ids_[i], pose);
94
+ Eigen::Vector3d center(pose.position.x, pose.position.y, pose.position.z);
95
+ for (auto& sdf : get_all_sdfs()) {
96
+ if (!sdf->is_outside(center, sphere_specs_[i].radius)) {
97
+ return false;
98
+ }
99
+ }
100
+ }
101
+ tinyfk::Transform pose1, pose2;
102
+ for (const auto& pair : selcol_pairs_ids_) {
103
+ kin_->get_link_pose(sphere_ids_[pair.first], pose1);
104
+ kin_->get_link_pose(sphere_ids_[pair.second], pose2);
105
+ Eigen::Vector3d center1(pose1.position.x, pose1.position.y,
106
+ pose1.position.z);
107
+ Eigen::Vector3d center2(pose2.position.x, pose2.position.y,
108
+ pose2.position.z);
109
+ if ((center1 - center2).norm() <
110
+ sphere_specs_[pair.first].radius + sphere_specs_[pair.second].radius) {
111
+ return false;
112
+ }
113
+ }
114
+ return true;
115
+ }
116
+ std::pair<Eigen::VectorXd, Eigen::MatrixXd> SphereCollisionCst::evaluate_dirty()
117
+ const {
118
+ auto all_sdfs = get_all_sdfs();
119
+
120
+ // collision vs outers
121
+ tinyfk::Transform pose;
122
+ Eigen::VectorXd grad_in_cspace_other(q_dim());
123
+ double min_val_other = std::numeric_limits<double>::max();
124
+ std::optional<size_t> min_sphere_idx = std::nullopt;
125
+ std::optional<size_t> min_sdf_idx = std::nullopt;
126
+ {
127
+ for (size_t i = 0; i < sphere_ids_.size(); i++) {
128
+ if (sphere_specs_[i].ignore_collision) {
129
+ continue;
130
+ }
131
+ kin_->get_link_pose(sphere_ids_[i], pose);
132
+ Eigen::Vector3d center(pose.position.x, pose.position.y, pose.position.z);
133
+ for (size_t j = 0; j < all_sdfs.size(); j++) {
134
+ double val = all_sdfs[j]->evaluate(center) - sphere_specs_[i].radius;
135
+ if (val < min_val_other) {
136
+ min_val_other = val;
137
+ min_sphere_idx = i;
138
+ min_sdf_idx = j;
139
+ }
140
+ }
141
+ }
142
+
143
+ Eigen::Vector3d grad;
144
+ kin_->get_link_pose(sphere_ids_[*min_sphere_idx], pose);
145
+ Eigen::Vector3d center(pose.position.x, pose.position.y, pose.position.z);
146
+ for (size_t i = 0; i < 3; i++) {
147
+ Eigen::Vector3d perturbed_center = center;
148
+ perturbed_center[i] += 1e-6;
149
+ double val = all_sdfs[*min_sdf_idx]->evaluate(perturbed_center) -
150
+ sphere_specs_[*min_sphere_idx].radius;
151
+ grad[i] = (val - min_val_other) / 1e-6;
152
+ }
153
+ auto sphere_jac =
154
+ kin_->get_jacobian(sphere_ids_[*min_sphere_idx], control_joint_ids_,
155
+ tinyfk::RotationType::IGNORE, with_base_);
156
+ grad_in_cspace_other = sphere_jac.transpose() * grad;
157
+ }
158
+
159
+ if (selcol_pairs_ids_.size() == 0) {
160
+ Eigen::MatrixXd jac(1, grad_in_cspace_other.size());
161
+ jac.row(0) = grad_in_cspace_other;
162
+ return {Eigen::VectorXd::Constant(1, min_val_other), jac};
163
+ } else {
164
+ // collision vs inners (self collision)
165
+ Eigen::VectorXd grad_in_cspace_self(control_joint_ids_.size());
166
+ double min_val_self = std::numeric_limits<double>::max();
167
+ {
168
+ std::optional<std::pair<size_t, size_t>> min_pair = std::nullopt;
169
+ for (const auto& pair : selcol_pairs_ids_) {
170
+ kin_->get_link_pose(sphere_ids_[pair.first], pose);
171
+ Eigen::Vector3d center1(pose.position.x, pose.position.y,
172
+ pose.position.z);
173
+ kin_->get_link_pose(sphere_ids_[pair.second], pose);
174
+ Eigen::Vector3d center2(pose.position.x, pose.position.y,
175
+ pose.position.z);
176
+ double val = (center1 - center2).norm() -
177
+ sphere_specs_[pair.first].radius -
178
+ sphere_specs_[pair.second].radius;
179
+ if (val < min_val_self) {
180
+ min_val_self = val;
181
+ min_pair = pair;
182
+ }
183
+ }
184
+ Eigen::Vector3d center1, center2;
185
+ kin_->get_link_pose(sphere_ids_[min_pair->first], pose);
186
+ center1 << pose.position.x, pose.position.y, pose.position.z;
187
+ kin_->get_link_pose(sphere_ids_[min_pair->second], pose);
188
+ center2 << pose.position.x, pose.position.y, pose.position.z;
189
+ Eigen::MatrixXd&& jac1 =
190
+ kin_->get_jacobian(sphere_ids_[min_pair->first], control_joint_ids_,
191
+ tinyfk::RotationType::IGNORE, with_base_);
192
+ Eigen::MatrixXd&& jac2 =
193
+ kin_->get_jacobian(sphere_ids_[min_pair->second], control_joint_ids_,
194
+ tinyfk::RotationType::IGNORE, with_base_);
195
+ double norminv = 1.0 / (center1 - center2).norm();
196
+ grad_in_cspace_self =
197
+ norminv * (center1 - center2).transpose() * (jac1 - jac2);
198
+ }
199
+
200
+ Eigen::Vector2d vals(min_val_other, min_val_self);
201
+ Eigen::MatrixXd jac(2, grad_in_cspace_other.size());
202
+ jac.row(0) = grad_in_cspace_other;
203
+ jac.row(1) = grad_in_cspace_self;
204
+ return {vals, jac};
205
+ }
206
+ }
207
+
208
+ bool ComInPolytopeCst::is_valid_dirty() const {
209
+ // COPIED from evaluate() >> START
210
+ auto com_tmp = kin_->get_com();
211
+ Eigen::Vector3d com(com_tmp.x, com_tmp.y, com_tmp.z);
212
+ if (force_link_ids_.size() > 0) {
213
+ double vertical_force_sum = 1.0; // 1.0 for normalized self
214
+ tinyfk::Transform pose;
215
+ for (size_t j = 0; j < force_link_ids_.size(); ++j) {
216
+ double force = applied_force_values_[j] / kin_->total_mass_;
217
+ vertical_force_sum += force;
218
+ kin_->get_link_pose(force_link_ids_[j], pose);
219
+ Eigen::Vector3d force_pos(pose.position.x, pose.position.y,
220
+ pose.position.z);
221
+ com += force * force_pos;
222
+ }
223
+ com /= vertical_force_sum;
224
+ }
225
+ // COPIED from evaluate() >> END
226
+ return polytope_sdf_->evaluate(com) < 0;
227
+ }
228
+
229
+ std::pair<Eigen::VectorXd, Eigen::MatrixXd> ComInPolytopeCst::evaluate_dirty()
230
+ const {
231
+ Eigen::VectorXd vals(cst_dim());
232
+ Eigen::MatrixXd jac(cst_dim(), q_dim());
233
+
234
+ auto com_tmp = kin_->get_com();
235
+ Eigen::Vector3d com(com_tmp.x, com_tmp.y, com_tmp.z);
236
+
237
+ auto com_jaco = kin_->get_com_jacobian(control_joint_ids_, q_dim());
238
+ if (force_link_ids_.size() > 0) {
239
+ double vertical_force_sum = 1.0; // 1.0 for normalized self
240
+ tinyfk::Transform pose;
241
+ for (size_t j = 0; j < force_link_ids_.size(); ++j) {
242
+ double force = applied_force_values_[j] / kin_->total_mass_;
243
+ vertical_force_sum += force;
244
+ kin_->get_link_pose(force_link_ids_[j], pose);
245
+ Eigen::Vector3d force_pos(pose.position.x, pose.position.y,
246
+ pose.position.z);
247
+ com += force * force_pos;
248
+
249
+ com_jaco += kin_->get_jacobian(force_link_ids_[j], control_joint_ids_,
250
+ tinyfk::RotationType::IGNORE, with_base_) *
251
+ force;
252
+ }
253
+ double inv = 1.0 / vertical_force_sum;
254
+ com *= inv;
255
+ com_jaco *= inv;
256
+ }
257
+ double val = -polytope_sdf_->evaluate(com);
258
+ vals[0] = val;
259
+
260
+ Eigen::Vector3d grad;
261
+ for (size_t i = 0; i < 3; i++) {
262
+ Eigen::Vector3d perturbed_com = com;
263
+ perturbed_com[i] += 1e-6;
264
+ double val_perturbed = -polytope_sdf_->evaluate(perturbed_com);
265
+ grad[i] = (val_perturbed - val) / 1e-6;
266
+ }
267
+ jac.row(0) = com_jaco.transpose() * grad;
268
+
269
+ return {vals, jac};
270
+ };
271
+
272
+ void bind_collision_constraints(py::module& m) {
273
+ auto cst_m = m.def_submodule("constraint");
274
+ py::class_<ConstraintBase, ConstraintBase::Ptr>(cst_m, "ConstraintBase");
275
+ py::class_<EqConstraintBase, EqConstraintBase::Ptr, ConstraintBase>(
276
+ cst_m, "EqConstraintBase");
277
+ py::class_<IneqConstraintBase, IneqConstraintBase::Ptr, ConstraintBase>(
278
+ cst_m, "IneqConstraintBase");
279
+ py::class_<LinkPoseCst, LinkPoseCst::Ptr, EqConstraintBase>(cst_m,
280
+ "LinkPoseCst")
281
+ .def(py::init<std::shared_ptr<tinyfk::KinematicModel>,
282
+ const std::vector<std::string>&, bool,
283
+ const std::vector<std::string>&,
284
+ const std::vector<Eigen::VectorXd>&>())
285
+ .def("update_kintree", &LinkPoseCst::update_kintree)
286
+ .def("evaluate", &LinkPoseCst::evaluate)
287
+ .def("cst_dim", &LinkPoseCst::cst_dim);
288
+ py::class_<SphereAttachentSpec>(cst_m, "SphereAttachentSpec")
289
+ .def(py::init<const std::string&, const Eigen::Vector3d&, double, bool>())
290
+ .def_readonly("parent_link_name", &SphereAttachentSpec::parent_link_name);
291
+
292
+ py::class_<SphereCollisionCst, SphereCollisionCst::Ptr, IneqConstraintBase>(
293
+ cst_m, "SphereCollisionCst")
294
+ .def(py::init<std::shared_ptr<tinyfk::KinematicModel>,
295
+ const std::vector<std::string>&, bool,
296
+ const std::vector<SphereAttachentSpec>&,
297
+ const std::vector<std::pair<std::string, std::string>>&,
298
+ const std::vector<primitive_sdf::PrimitiveSDFBase::Ptr>&>())
299
+ .def("set_sdfs", &SphereCollisionCst::set_sdfs)
300
+ .def("update_kintree", &SphereCollisionCst::update_kintree)
301
+ .def("is_valid", &SphereCollisionCst::is_valid)
302
+ .def("evaluate", &SphereCollisionCst::evaluate);
303
+
304
+ py::class_<AppliedForceSpec>(cst_m, "AppliedForceSpec")
305
+ .def(py::init<const std::string&, double>())
306
+ .def_readonly("link_name", &AppliedForceSpec::link_name)
307
+ .def_readonly("force", &AppliedForceSpec::force);
308
+
309
+ py::class_<ComInPolytopeCst, ComInPolytopeCst::Ptr, IneqConstraintBase>(
310
+ cst_m, "ComInPolytopeCst")
311
+ .def(py::init<std::shared_ptr<tinyfk::KinematicModel>,
312
+ const std::vector<std::string>&, bool,
313
+ primitive_sdf::BoxSDF::Ptr,
314
+ const std::vector<AppliedForceSpec>&>())
315
+ .def("update_kintree", &ComInPolytopeCst::update_kintree)
316
+ .def("is_valid", &ComInPolytopeCst::is_valid)
317
+ .def("evaluate", &ComInPolytopeCst::evaluate);
318
+ py::class_<EqCompositeCst, EqCompositeCst::Ptr>(cst_m, "EqCompositeCst")
319
+ .def(py::init<std::vector<EqConstraintBase::Ptr>>())
320
+ .def("update_kintree", &EqCompositeCst::update_kintree)
321
+ .def("evaluate", &EqCompositeCst::evaluate);
322
+ py::class_<IneqCompositeCst, IneqCompositeCst::Ptr>(cst_m, "IneqCompositeCst")
323
+ .def(py::init<std::vector<IneqConstraintBase::Ptr>>())
324
+ .def("update_kintree", &IneqCompositeCst::update_kintree)
325
+ .def("evaluate", &IneqCompositeCst::evaluate)
326
+ .def("is_valid", &IneqCompositeCst::is_valid);
327
+ }
328
+
329
+ } // namespace cst