PyClothoids
raw JSON → 0.2.0 verified Sat May 09 auth: no python
A library for clothoid curves (also known as Euler spirals or Cornu spirals) in Python. Current version is 0.2.0, released with support for closest point calculations, projections, and caching. The library is under active development.
pip install pyclothoids Common errors
error ModuleNotFoundError: No module named 'clothoid' ↓
cause Incorrect import path; the module is named pyclothoids, not clothoid.
fix
Use 'from pyclothoids import Clothoid' or 'import pyclothoids'.
error TypeError: 'ClothoidType' object is not callable ↓
cause Attempting to create a Clothoid by calling Clothoid() directly, but the class requires a factory method.
fix
Use Clothoid.G1Hermite(...) or other class methods to instantiate.
Warnings
gotcha The Clothoid class is not exported; use Clothoid.G1Hermite (or other class methods) to create instances. Direct instantiation with Clothoid() will fail. ↓
fix Always use a factory class method like Clothoid.G1Hermite(...), Clothoid.G2Hermite(...), or Clothoid.BiArclength(...).
gotcha The library is not yet stable; API may change between minor versions. Version 0.2.0 introduced new methods like ClosestPoint and Distance, but existing code may break if it relied on internal attributes. ↓
fix Check the changelog and adapt calls if upgrading from 0.1.x. Use the public API documented in the README.
Imports
- Clothoid wrong
from clothoid import Clothoidcorrectfrom pyclothoids import Clothoid
Quickstart
from pyclothoids import Clothoid
# Create a clothoid from start and end states
x0, y0, theta0 = 0.0, 0.0, 0.0 # start
x1, y1, theta1 = 10.0, 5.0, 1.0 # end
clothoid = Clothoid.G1Hermite(x0, y0, theta0, x1, y1, theta1)
# Sample points along the clothoid
points = clothoid.SampleXY(100)
print(points)