27 lines
681 B
Markdown
27 lines
681 B
Markdown
|
|
# SCurve Python Bridge
|
||
|
|
|
||
|
|
This folder now exposes the C++ `SCurve` class as a native Python extension built with `pybind11`.
|
||
|
|
|
||
|
|
## Build
|
||
|
|
|
||
|
|
From the repository root:
|
||
|
|
|
||
|
|
```powershell
|
||
|
|
powershell -ExecutionPolicy Bypass -File .\cpp\common\curve\build_python.ps1 -PythonExecutable "C:\Users\Administrator\miniconda3\envs\cmvr-head-client\python.exe"
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected output:
|
||
|
|
|
||
|
|
- `cpp/common/curve/build/_s_curve_native*.pyd`
|
||
|
|
|
||
|
|
## Python usage
|
||
|
|
|
||
|
|
```python
|
||
|
|
from s_curve import SCurve
|
||
|
|
|
||
|
|
curve = SCurve(max_velocity=3.0, max_acceleration=10.0, max_jerk=50.0)
|
||
|
|
curve.setConstraints(4.0, 12.0, 80.0)
|
||
|
|
profile = curve.calculateProfile(0.0, 30.0, 0.0, 0.0)
|
||
|
|
samples = curve.sampleTrajectory(profile, 0.01)
|
||
|
|
```
|