servo-py 0.3.0__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 (91) hide show
  1. servo_py-0.3.0/.github/workflows/docs.yml +59 -0
  2. servo_py-0.3.0/.github/workflows/release.yml +216 -0
  3. servo_py-0.3.0/.gitignore +11 -0
  4. servo_py-0.3.0/CHANGELOG.md +3 -0
  5. servo_py-0.3.0/CMakeLists.txt +64 -0
  6. servo_py-0.3.0/CONTRIBUTING.md +5 -0
  7. servo_py-0.3.0/LICENSE +21 -0
  8. servo_py-0.3.0/LICENSES/Eigen-MPL2.txt +373 -0
  9. servo_py-0.3.0/LICENSES/pybind11-BSD.txt +29 -0
  10. servo_py-0.3.0/NOTICE +23 -0
  11. servo_py-0.3.0/PKG-INFO +92 -0
  12. servo_py-0.3.0/README.en.md +5 -0
  13. servo_py-0.3.0/README.md +153 -0
  14. servo_py-0.3.0/README.pypi.md +48 -0
  15. servo_py-0.3.0/README.zh-CN.md +153 -0
  16. servo_py-0.3.0/cmake/servo_pyConfig.cmake.in +4 -0
  17. servo_py-0.3.0/cpp/bindings.cpp +154 -0
  18. servo_py-0.3.0/cpp/kinematics.cpp +144 -0
  19. servo_py-0.3.0/cpp/servo.cpp +459 -0
  20. servo_py-0.3.0/cpp/solvers.cpp +90 -0
  21. servo_py-0.3.0/docs/advanced-control.md +25 -0
  22. servo_py-0.3.0/docs/api.md +137 -0
  23. servo_py-0.3.0/docs/assets/brand/logo-dark.svg +14 -0
  24. servo_py-0.3.0/docs/assets/brand/logo-light.svg +14 -0
  25. servo_py-0.3.0/docs/assets/brand/mark.svg +11 -0
  26. servo_py-0.3.0/docs/benchmark.json +16 -0
  27. servo_py-0.3.0/docs/changelog.md +58 -0
  28. servo_py-0.3.0/docs/cli.md +75 -0
  29. servo_py-0.3.0/docs/concepts.md +71 -0
  30. servo_py-0.3.0/docs/configuration.md +78 -0
  31. servo_py-0.3.0/docs/contributing.md +86 -0
  32. servo_py-0.3.0/docs/cpp.md +78 -0
  33. servo_py-0.3.0/docs/design.md +178 -0
  34. servo_py-0.3.0/docs/getting-started.md +125 -0
  35. servo_py-0.3.0/docs/index.md +39 -0
  36. servo_py-0.3.0/docs/joint-position.md +81 -0
  37. servo_py-0.3.0/docs/media/panda-servo.gif +0 -0
  38. servo_py-0.3.0/docs/media/panda-servo.json +40 -0
  39. servo_py-0.3.0/docs/media/panda-servo.mp4 +0 -0
  40. servo_py-0.3.0/docs/mujoco-panda.md +113 -0
  41. servo_py-0.3.0/docs/publishing.md +108 -0
  42. servo_py-0.3.0/docs/python-ik.md +113 -0
  43. servo_py-0.3.0/docs/recording.md +121 -0
  44. servo_py-0.3.0/docs/roadmap.md +36 -0
  45. servo_py-0.3.0/docs/runtime.md +67 -0
  46. servo_py-0.3.0/docs/smoothing.md +67 -0
  47. servo_py-0.3.0/docs/solvers.md +63 -0
  48. servo_py-0.3.0/docs/status.md +84 -0
  49. servo_py-0.3.0/docs/troubleshooting.md +70 -0
  50. servo_py-0.3.0/docs/validation.md +356 -0
  51. servo_py-0.3.0/examples/arm6.urdf +33 -0
  52. servo_py-0.3.0/examples/assets/PANDA-LICENSE.txt +176 -0
  53. servo_py-0.3.0/examples/assets/README.md +28 -0
  54. servo_py-0.3.0/examples/assets/panda-source.json +364 -0
  55. servo_py-0.3.0/examples/benchmark.py +54 -0
  56. servo_py-0.3.0/examples/compare_references.py +31 -0
  57. servo_py-0.3.0/examples/mujoco_panda.py +592 -0
  58. servo_py-0.3.0/examples/periodic_servo.py +26 -0
  59. servo_py-0.3.0/examples/planar2.urdf +20 -0
  60. servo_py-0.3.0/examples/track_pose.py +46 -0
  61. servo_py-0.3.0/include/servo_py/servo.hpp +250 -0
  62. servo_py-0.3.0/mkdocs.yml +89 -0
  63. servo_py-0.3.0/pyproject.toml +70 -0
  64. servo_py-0.3.0/scripts/check_docs.py +222 -0
  65. servo_py-0.3.0/scripts/check_release.py +78 -0
  66. servo_py-0.3.0/scripts/smoke_wheel.py +64 -0
  67. servo_py-0.3.0/src/servo_py/__init__.py +23 -0
  68. servo_py-0.3.0/src/servo_py/api.py +272 -0
  69. servo_py-0.3.0/src/servo_py/backends/__init__.py +1 -0
  70. servo_py-0.3.0/src/servo_py/backends/pinocchio.py +95 -0
  71. servo_py-0.3.0/src/servo_py/examples/__init__.py +6 -0
  72. servo_py-0.3.0/src/servo_py/examples/_panda_assets.py +63 -0
  73. servo_py-0.3.0/src/servo_py/ik.py +128 -0
  74. servo_py-0.3.0/src/servo_py/py.typed +0 -0
  75. servo_py-0.3.0/src/servo_py/recording.py +200 -0
  76. servo_py-0.3.0/src/servo_py/runtime.py +241 -0
  77. servo_py-0.3.0/src/servo_py/smoothing.py +167 -0
  78. servo_py-0.3.0/src/servo_py/urdf.py +149 -0
  79. servo_py-0.3.0/tests/conftest.py +60 -0
  80. servo_py-0.3.0/tests/cpp_smoke.cpp +62 -0
  81. servo_py-0.3.0/tests/test_joint_position.py +120 -0
  82. servo_py-0.3.0/tests/test_kinematics.py +80 -0
  83. servo_py-0.3.0/tests/test_mujoco_panda.py +209 -0
  84. servo_py-0.3.0/tests/test_panda_assets.py +122 -0
  85. servo_py-0.3.0/tests/test_pinocchio.py +43 -0
  86. servo_py-0.3.0/tests/test_position_ik.py +112 -0
  87. servo_py-0.3.0/tests/test_recording.py +85 -0
  88. servo_py-0.3.0/tests/test_runtime.py +127 -0
  89. servo_py-0.3.0/tests/test_servo.py +332 -0
  90. servo_py-0.3.0/tests/test_smoothing.py +102 -0
  91. servo_py-0.3.0/tests/test_solvers.py +99 -0
@@ -0,0 +1,59 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: docs-${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
+
16
+ jobs:
17
+ check:
18
+ runs-on: ubuntu-24.04
19
+ timeout-minutes: 15
20
+ env:
21
+ CMAKE_BUILD_PARALLEL_LEVEL: "2"
22
+ steps:
23
+ - uses: actions/checkout@v7
24
+ with:
25
+ persist-credentials: false
26
+ - uses: actions/setup-python@v7
27
+ with:
28
+ python-version: "3.12"
29
+ cache: pip
30
+ cache-dependency-path: pyproject.toml
31
+ - name: Install package and documentation dependencies
32
+ run: python -m pip install '.[docs,ruckig]'
33
+ - name: Check links, reference coverage and runnable examples
34
+ run: python scripts/check_docs.py --run
35
+ - name: Build documentation
36
+ run: python -m mkdocs build --strict
37
+ - name: Upload GitHub Pages artifact
38
+ if: github.repository == 'OpenGHz/servopy' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
39
+ uses: actions/upload-pages-artifact@v4
40
+ with:
41
+ path: site
42
+
43
+ deploy:
44
+ if: github.repository == 'OpenGHz/servopy' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
45
+ needs: check
46
+ runs-on: ubuntu-24.04
47
+ timeout-minutes: 10
48
+ permissions:
49
+ pages: write
50
+ id-token: write
51
+ environment:
52
+ name: github-pages
53
+ url: ${{ steps.deployment.outputs.page_url }}
54
+ steps:
55
+ - name: Configure GitHub Pages
56
+ uses: actions/configure-pages@v5
57
+ - name: Deploy documentation
58
+ id: deployment
59
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,216 @@
1
+ name: Python distributions
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - .github/workflows/release.yml
7
+ - pyproject.toml
8
+ - CMakeLists.txt
9
+ - cmake/**
10
+ - cpp/**
11
+ - include/**
12
+ - src/**
13
+ - tests/**
14
+ - examples/**
15
+ - scripts/check_release.py
16
+ - scripts/smoke_wheel.py
17
+ - README.pypi.md
18
+ - LICENSE
19
+ - LICENSES/**
20
+ - NOTICE
21
+ push:
22
+ branches: [main]
23
+ paths:
24
+ - .github/workflows/release.yml
25
+ - pyproject.toml
26
+ - CMakeLists.txt
27
+ - cmake/**
28
+ - cpp/**
29
+ - include/**
30
+ - src/**
31
+ - tests/**
32
+ - examples/**
33
+ - scripts/check_release.py
34
+ - scripts/smoke_wheel.py
35
+ - README.pypi.md
36
+ - LICENSE
37
+ - LICENSES/**
38
+ - NOTICE
39
+ release:
40
+ types: [published]
41
+ workflow_dispatch:
42
+ inputs:
43
+ destination:
44
+ description: Build only, or publish to TestPyPI after all checks pass
45
+ type: choice
46
+ options: [build, testpypi]
47
+ default: build
48
+
49
+ permissions:
50
+ contents: read
51
+
52
+ concurrency:
53
+ group: distributions-${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
54
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
55
+
56
+ jobs:
57
+ sdist:
58
+ runs-on: ubuntu-24.04
59
+ timeout-minutes: 10
60
+ steps:
61
+ - uses: actions/checkout@v7
62
+ with:
63
+ persist-credentials: false
64
+ - uses: actions/setup-python@v7
65
+ with:
66
+ python-version: "3.12"
67
+ - run: python -m pip install build twine
68
+ - name: Check source versions and release tag
69
+ env:
70
+ RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
71
+ run: python scripts/check_release.py --tag "$RELEASE_TAG"
72
+ - run: python -m build --sdist
73
+ - run: python -m twine check --strict dist/*
74
+ - uses: actions/upload-artifact@v7
75
+ with:
76
+ name: dist-sdist
77
+ path: dist/*.tar.gz
78
+ if-no-files-found: error
79
+
80
+ wheels:
81
+ needs: sdist
82
+ strategy:
83
+ fail-fast: false
84
+ matrix:
85
+ include:
86
+ - runner: ubuntu-24.04
87
+ arch: x86_64
88
+ - runner: ubuntu-24.04-arm
89
+ arch: aarch64
90
+ runs-on: ${{ matrix.runner }}
91
+ timeout-minutes: 45
92
+ steps:
93
+ - uses: actions/download-artifact@v8
94
+ with:
95
+ name: dist-sdist
96
+ path: sdist
97
+ - uses: actions/setup-python@v7
98
+ with:
99
+ python-version: "3.12"
100
+ - run: python -m pip install cibuildwheel==4.2.1
101
+ - name: Build from sdist, auditwheel repair, and test each installed wheel
102
+ env:
103
+ CIBW_ARCHS_LINUX: ${{ matrix.arch }}
104
+ run: python -m cibuildwheel sdist/*.tar.gz --platform linux --output-dir wheelhouse
105
+ - uses: actions/upload-artifact@v7
106
+ with:
107
+ name: dist-wheels-${{ matrix.arch }}
108
+ path: wheelhouse/*.whl
109
+ if-no-files-found: error
110
+
111
+ ubuntu:
112
+ name: Install on ${{ matrix.runner }} / Python ${{ matrix.python }}
113
+ needs: wheels
114
+ strategy:
115
+ fail-fast: false
116
+ matrix:
117
+ include:
118
+ - runner: ubuntu-22.04
119
+ python: "3.10"
120
+ extras: mujoco,pinocchio,ruckig,test
121
+ - runner: ubuntu-24.04
122
+ python: "3.12"
123
+ extras: mujoco,pinocchio,ruckig,test
124
+ - runner: ubuntu-24.04-arm
125
+ python: "3.12"
126
+ extras: mujoco,pinocchio,test
127
+ runs-on: ${{ matrix.runner }}
128
+ timeout-minutes: 15
129
+ steps:
130
+ - uses: actions/checkout@v7
131
+ with:
132
+ persist-credentials: false
133
+ - uses: actions/setup-python@v7
134
+ with:
135
+ python-version: ${{ matrix.python }}
136
+ - uses: actions/download-artifact@v8
137
+ with:
138
+ pattern: dist-wheels-*
139
+ merge-multiple: true
140
+ path: wheelhouse
141
+ - name: Install only binary distributions
142
+ env:
143
+ EXTRAS: ${{ matrix.extras }}
144
+ run: |
145
+ python -m pip install --upgrade pip
146
+ python -m pip install --only-binary=:all: --no-index --no-deps --find-links wheelhouse servo-py
147
+ VERSION=$(python -c 'from importlib.metadata import version; print(version("servo-py"))')
148
+ python -m pip install --only-binary=:all: --find-links wheelhouse "servo-py[$EXTRAS]==$VERSION"
149
+ python -m pip check
150
+ - name: Test installed extension and optional backends
151
+ run: python -m pytest
152
+ - name: Check installed examples and on-demand Panda download/cache
153
+ run: python scripts/smoke_wheel.py --mujoco
154
+
155
+ verify:
156
+ needs: [sdist, wheels, ubuntu]
157
+ runs-on: ubuntu-24.04
158
+ timeout-minutes: 10
159
+ steps:
160
+ - uses: actions/checkout@v7
161
+ with:
162
+ persist-credentials: false
163
+ - uses: actions/setup-python@v7
164
+ with:
165
+ python-version: "3.12"
166
+ - uses: actions/download-artifact@v8
167
+ with:
168
+ pattern: dist-*
169
+ merge-multiple: true
170
+ path: dist
171
+ - run: python -m pip install twine
172
+ - run: python -m twine check --strict dist/*
173
+ - run: python scripts/check_release.py --dist dist
174
+ - uses: actions/upload-artifact@v7
175
+ with:
176
+ name: publish-distributions
177
+ path: dist/*
178
+ if-no-files-found: error
179
+
180
+ testpypi:
181
+ if: github.repository == 'OpenGHz/servopy' && github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && inputs.destination == 'testpypi'
182
+ needs: verify
183
+ runs-on: ubuntu-24.04
184
+ timeout-minutes: 10
185
+ environment:
186
+ name: testpypi
187
+ url: https://test.pypi.org/project/servo-py/
188
+ permissions:
189
+ id-token: write
190
+ steps:
191
+ - uses: actions/download-artifact@v8
192
+ with:
193
+ name: publish-distributions
194
+ path: dist
195
+ - name: Publish via Trusted Publishing
196
+ uses: pypa/gh-action-pypi-publish@release/v1
197
+ with:
198
+ repository-url: https://test.pypi.org/legacy/
199
+
200
+ pypi:
201
+ if: github.repository == 'OpenGHz/servopy' && github.event_name == 'release'
202
+ needs: verify
203
+ runs-on: ubuntu-24.04
204
+ timeout-minutes: 10
205
+ environment:
206
+ name: pypi
207
+ url: https://pypi.org/project/servo-py/
208
+ permissions:
209
+ id-token: write
210
+ steps:
211
+ - uses: actions/download-artifact@v8
212
+ with:
213
+ name: publish-distributions
214
+ path: dist
215
+ - name: Publish via Trusted Publishing
216
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ build/
2
+ build-*/
3
+ dist/
4
+ .venv/
5
+ __pycache__/
6
+ *.pyc
7
+ .pytest_cache/
8
+ *.egg-info/
9
+ MUJOCO_LOG.TXT
10
+ site/
11
+ outputs/
@@ -0,0 +1,3 @@
1
+ # 更新记录
2
+
3
+ 完整版本变化、兼容性说明和迁移步骤见 [文档中的更新记录](docs/changelog.md)。当前版本为 **0.3.0**。
@@ -0,0 +1,64 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ project(servo_py VERSION 0.3.0 LANGUAGES CXX)
3
+
4
+ option(SERVO_PY_BUILD_PYTHON "Build the Python extension" ON)
5
+ option(SERVO_PY_BUILD_TESTS "Build standalone C++ smoke test" OFF)
6
+
7
+ if(SERVO_PY_BUILD_PYTHON)
8
+ find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
9
+ # cmeel-eigen supplies headers during isolated Python builds. A system Eigen
10
+ # installation also works for standalone C++ builds via CMAKE_PREFIX_PATH.
11
+ execute_process(COMMAND "${Python_EXECUTABLE}" -c
12
+ "import sys,pathlib; print(';'.join(str(pathlib.Path(p)/'cmeel.prefix') for p in sys.path if (pathlib.Path(p)/'cmeel.prefix').is_dir()))"
13
+ OUTPUT_VARIABLE _cmeel_prefixes OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
14
+ list(APPEND CMAKE_PREFIX_PATH ${_cmeel_prefixes})
15
+ find_package(pybind11 CONFIG REQUIRED)
16
+ endif()
17
+ find_package(Eigen3 3.4 REQUIRED NO_MODULE)
18
+
19
+ add_library(servo_core STATIC cpp/kinematics.cpp cpp/servo.cpp cpp/solvers.cpp)
20
+ add_library(servo_py::core ALIAS servo_core)
21
+ set_target_properties(servo_core PROPERTIES POSITION_INDEPENDENT_CODE ON EXPORT_NAME core)
22
+ target_compile_features(servo_core PUBLIC cxx_std_17)
23
+ target_link_libraries(servo_core PUBLIC Eigen3::Eigen)
24
+ target_include_directories(servo_core PUBLIC
25
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
26
+ $<INSTALL_INTERFACE:include>)
27
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
28
+ target_compile_options(servo_core PRIVATE -Wall -Wextra -Wpedantic)
29
+ endif()
30
+
31
+ if(SERVO_PY_BUILD_PYTHON)
32
+ pybind11_add_module(_core MODULE NO_EXTRAS cpp/bindings.cpp)
33
+ target_link_libraries(_core PRIVATE servo_core)
34
+ install(TARGETS _core LIBRARY DESTINATION servo_py RUNTIME DESTINATION servo_py)
35
+ # Keep one source for checkout examples and installed Python modules. Include
36
+ # the small URDFs, provenance and licenses; Panda meshes are fetched on demand.
37
+ install(DIRECTORY examples/ DESTINATION servo_py/examples
38
+ FILES_MATCHING PATTERN "*.py" PATTERN "*.urdf"
39
+ PATTERN "*.json" PATTERN "*.txt" PATTERN "*.md"
40
+ PATTERN "__pycache__" EXCLUDE)
41
+ endif()
42
+
43
+ if(SERVO_PY_BUILD_TESTS)
44
+ enable_testing()
45
+ add_executable(servo_cpp_smoke tests/cpp_smoke.cpp)
46
+ target_link_libraries(servo_cpp_smoke PRIVATE servo_core)
47
+ add_test(NAME servo_cpp_smoke COMMAND servo_cpp_smoke)
48
+ endif()
49
+
50
+ if(NOT SKBUILD)
51
+ include(GNUInstallDirs)
52
+ include(CMakePackageConfigHelpers)
53
+ install(TARGETS servo_core EXPORT servo_pyTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
54
+ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
55
+ install(EXPORT servo_pyTargets NAMESPACE servo_py:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/servo_py)
56
+ configure_package_config_file(cmake/servo_pyConfig.cmake.in
57
+ "${CMAKE_CURRENT_BINARY_DIR}/servo_pyConfig.cmake"
58
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/servo_py)
59
+ write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/servo_pyConfigVersion.cmake"
60
+ VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion)
61
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/servo_pyConfig.cmake"
62
+ "${CMAKE_CURRENT_BINARY_DIR}/servo_pyConfigVersion.cmake"
63
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/servo_py)
64
+ endif()
@@ -0,0 +1,5 @@
1
+ # 参与 ServoPy
2
+
3
+ 请从 [贡献指南](docs/contributing.md) 开始:环境准备、源码结构、Python/C++ 验证、文档预览与修改约定都维护在那里。
4
+
5
+ 报告问题时,附上版本、最小复现、模型/任务轴、时间戳与 `Action` / `SafetyFlag`。提交前运行与修改范围相关的检查;具体命令见指南。
servo_py-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ServoPy contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.