Skip to content

Commit 6fb5f95

Browse files
committed
readme
1 parent 1103e44 commit 6fb5f95

File tree

1 file changed

+139
-31
lines changed

1 file changed

+139
-31
lines changed

README.md

Lines changed: 139 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,29 @@
33
![Python](https://img.shields.io/badge/python-3.10+-blue)
44
[![pre-commit](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/pre-commit.yml)
55
[![ci-test](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/test.yml/badge.svg)](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/test.yml)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
67

78
## Overview
89

9-
InterpolatePy provides a collection of algorithms for generating smooth trajectories and curves with precise control over position, velocity, acceleration, and jerk. The library implements numerous interpolation techniques ranging from simple linear interpolation to advanced B-splines and motion profiles.
10+
InterpolatePy is a comprehensive Python library for generating smooth trajectories and curves with precise control over position, velocity, acceleration, and jerk profiles. Designed for robotics, motion planning, computer graphics, and scientific computing applications, it provides a wide range of interpolation techniques from simple linear interpolation to advanced B-splines and motion profiles.
11+
12+
Whether you need to generate smooth robotic joint motions, create path planning for autonomous vehicles, or design animation curves with specific dynamic properties, InterpolatePy offers the tools to create trajectories that maintain continuity while adhering to physical constraints.
1013

1114
## Key Features
1215

1316
### Spline Interpolation
1417

1518
#### B-Splines
16-
- **BSpline**: Base implementation of B-splines with customizable degree and knot vectors
17-
- **ApproximationBSpline**: B-spline curve approximation of sets of points
18-
- **CubicBSplineInterpolation**: Specialized cubic B-spline interpolation
19-
- **BSplineInterpolator**: General B-spline interpolation with controllable continuity
20-
- **SmoothingCubicBSpline**: B-splines with smoothness-vs-accuracy tradeoff
19+
20+
- **BSpline**: Versatile implementation with customizable degree and knot vectors
21+
- **ApproximationBSpline**: Efficiently approximates sets of points with a B-spline curve
22+
- **CubicBSplineInterpolation**: Specialized cubic B-spline interpolation that passes through all points
23+
- **BSplineInterpolator**: General B-spline interpolation with controllable continuity (C²-C⁴)
24+
- **SmoothingCubicBSpline**: B-splines with adjustable smoothness-vs-accuracy tradeoff
2125

2226
#### Cubic Splines
23-
- **CubicSpline**: Basic cubic spline with velocity constraints
27+
28+
- **CubicSpline**: Standard cubic spline with velocity constraints at endpoints
2429
- **CubicSplineWithAcceleration1**: Cubic spline with velocity and acceleration constraints (extra points method)
2530
- **CubicSplineWithAcceleration2**: Alternative cubic spline with acceleration constraints (quintic segments method)
2631
- **CubicSmoothingSpline**: Cubic splines with μ parameter for smoothness control
@@ -29,14 +34,14 @@ InterpolatePy provides a collection of algorithms for generating smooth trajecto
2934
### Motion Profiles
3035

3136
- **DoubleSTrajectory**: S-curve motion profile with bounded velocity, acceleration, and jerk
32-
- **linear_traj**: Linear interpolation with constant velocity
37+
- **linear_traj**: Simple linear interpolation with constant velocity
3338
- **PolynomialTrajectory**: Trajectory generation using polynomials of orders 3, 5, and 7
34-
- **TrapezoidalTrajectory**: Trapezoidal velocity profiles with various constraints
39+
- **TrapezoidalTrajectory**: Trapezoidal velocity profiles with various constraint options
3540

3641
### Path Generation
3742

3843
- **LinearPath**: Simple linear paths with constant velocity
39-
- **CircularPath**: Circular arcs and paths
44+
- **CircularPath**: Circular arcs and paths in 3D
4045
- **Frenet Frames**: Tools for computing and visualizing Frenet frames along parametric curves
4146

4247
### Utility Functions
@@ -45,17 +50,39 @@ InterpolatePy provides a collection of algorithms for generating smooth trajecto
4550

4651
## Installation
4752

53+
### From Source
54+
55+
To install the latest development version with all dependencies:
56+
4857
```bash
49-
# Install directly from PyPI
50-
pip install interpolatepy
58+
# Clone the repository
59+
git clone https://github.com/GiorgioMedico/InterpolatePy.git
60+
cd InterpolatePy
5161

52-
# Install from source with development dependencies
62+
# Install with development dependencies
5363
pip install -e ".[all]"
5464
```
5565

66+
### Optional Dependencies
67+
68+
You can install specific dependency groups:
69+
70+
```bash
71+
# For testing dependencies only
72+
pip install -e ".[test]"
73+
74+
# For documentation dependencies only
75+
pip install -e ".[doc]"
76+
77+
# For development tools only
78+
pip install -e ".[dev]"
79+
```
80+
5681
## Usage Examples
5782

58-
### Creating a Cubic Spline Trajectory
83+
### Cubic Spline Trajectory
84+
85+
Create a smooth trajectory through waypoints with velocity constraints:
5986

6087
```python
6188
from interpolatepy.cubic_spline import CubicSpline
@@ -72,11 +99,13 @@ position = spline.evaluate(6.0)
7299
velocity = spline.evaluate_velocity(6.0)
73100
acceleration = spline.evaluate_acceleration(6.0)
74101

75-
# Plot the trajectory
102+
# Plot the trajectory with position, velocity, and acceleration profiles
76103
spline.plot()
77104
```
78105

79-
### Generating a Double-S Trajectory
106+
### Double-S Trajectory
107+
108+
Generate a trajectory with bounded jerk for smooth motion profiles:
80109

81110
```python
82111
from interpolatepy.double_s import DoubleSTrajectory, StateParams, TrajectoryBounds
@@ -98,7 +127,9 @@ time_points = np.linspace(0, duration, 100)
98127
positions, velocities, accelerations, jerks = trajectory.evaluate(time_points)
99128
```
100129

101-
### Creating a B-Spline Curve
130+
### B-Spline Curve
131+
132+
Create and manipulate a B-spline curve with control points:
102133

103134
```python
104135
import numpy as np
@@ -118,12 +149,14 @@ point = bspline.evaluate(0.5)
118149
# Generate curve points for plotting
119150
u_values, curve_points = bspline.generate_curve_points(100)
120151

121-
# Plot the curve
152+
# Plot the curve with control polygon
122153
bspline.plot_2d(show_control_polygon=True)
123154
```
124155

125156
### Trapezoidal Trajectory with Waypoints
126157

158+
Generate a trajectory with trapezoidal velocity profile through multiple points:
159+
127160
```python
128161
from interpolatepy.trapezoidal import TrapezoidalTrajectory, InterpolationParams
129162

@@ -146,16 +179,55 @@ traj_func, duration = TrapezoidalTrajectory.interpolate_waypoints(params)
146179
position, velocity, acceleration = traj_func(2.5)
147180
```
148181

182+
### 3D Path with Frenet Frames
183+
184+
Create and visualize a trajectory with coordinate frames along the path:
185+
186+
```python
187+
import numpy as np
188+
import matplotlib.pyplot as plt
189+
from interpolatepy.frenet_frame import (
190+
helicoidal_trajectory_with_derivatives,
191+
compute_trajectory_frames,
192+
plot_frames
193+
)
194+
195+
# Create a helicoidal path
196+
u_values = np.linspace(0, 4 * np.pi, 100)
197+
def helix_func(u):
198+
return helicoidal_trajectory_with_derivatives(u, r=2.0, d=0.5)
199+
200+
# Compute Frenet frames along the path
201+
points, frames = compute_trajectory_frames(helix_func, u_values)
202+
203+
# Visualize
204+
fig = plt.figure(figsize=(10, 8))
205+
ax = fig.add_subplot(111, projection='3d')
206+
plot_frames(ax, points, frames, scale=0.5, skip=10)
207+
plt.show()
208+
```
209+
149210
## Mathematical Concepts
150211

151-
The library implements several key mathematical concepts for trajectory generation:
212+
InterpolatePy implements several key mathematical concepts for trajectory generation:
213+
214+
### B-splines
215+
Piecewise parametric curves defined by control points and a knot vector. B-splines offer local control (changes to a control point only affect the curve locally) and customizable continuity.
216+
217+
### Cubic Splines
218+
Piecewise polynomials with C² continuity (continuous position, velocity, and acceleration) that interpolate a given set of points.
219+
220+
### Smoothing Splines
221+
Splines with a controllable balance between accuracy (passing through points exactly) and smoothness (minimizing curvature). The μ parameter controls this tradeoff.
222+
223+
### Trapezoidal Velocity Profiles
224+
Trajectories with linear segments of constant acceleration and velocity, creating a trapezoidal shape in the velocity profile.
152225

153-
- **B-splines**: Parametric curves defined by control points and a knot vector, offering local control and customizable continuity
154-
- **Cubic splines**: Piecewise polynomials with C2 continuity (continuous position, velocity, and acceleration)
155-
- **Smoothing splines**: Splines with a controllable balance between accuracy and smoothness
156-
- **Trapezoidal velocity profiles**: Trajectories with linear segments of constant acceleration and velocity
157-
- **Double-S trajectories**: Motions with bounded jerk, acceleration, and velocity, creating smooth S-curves
158-
- **Frenet frames**: Local coordinate systems defined by tangent, normal, and binormal vectors along a curve
226+
### Double-S Trajectories
227+
Motion profiles with bounded jerk, acceleration, and velocity, creating smooth S-curves in the acceleration profile. These are ideal for robotic motion to reduce stress on mechanical systems.
228+
229+
### Frenet Frames
230+
Local coordinate systems defined by tangent, normal, and binormal vectors along a curve, useful for tool orientation and trajectory tracking.
159231

160232
## Requirements
161233

@@ -166,12 +238,11 @@ The library implements several key mathematical concepts for trajectory generati
166238

167239
## Development
168240

169-
InterpolatePy uses modern Python tools for development:
241+
InterpolatePy uses modern Python tooling for development:
170242

171-
- Black and isort for code formatting
172-
- Ruff and mypy for linting and type checking
173-
- pytest for testing
174-
- mkdocs for documentation
243+
- **Code Quality**: Black and isort for formatting, Ruff and mypy for linting and type checking
244+
- **Testing**: pytest for unit tests and benchmarks
245+
- **Documentation**: mkdocs for documentation generation
175246

176247
To set up the development environment:
177248

@@ -180,6 +251,43 @@ pip install -e ".[all]"
180251
pre-commit install
181252
```
182253

254+
### Running Tests
255+
256+
```bash
257+
python -m pytest tests
258+
```
259+
260+
### Building Documentation
261+
262+
```bash
263+
mkdocs build
264+
# or to serve locally
265+
mkdocs serve
266+
```
267+
268+
## Contributing
269+
270+
Contributions to InterpolatePy are welcome! To contribute:
271+
272+
1. Fork the repository
273+
2. Create a feature branch
274+
3. Add your changes
275+
4. Run tests to ensure they pass
276+
5. Submit a pull request
277+
278+
Please follow the existing code style and include appropriate tests for new features.
279+
183280
## License
184281

185-
MIT License
282+
InterpolatePy is released under the MIT License. See the [LICENSE](LICENSE) file for more details.
283+
284+
## Acknowledgments
285+
286+
InterpolatePy implements algorithms and mathematical concepts primarily from the following authoritative textbooks:
287+
288+
- Biagiotti, L., & Melchiorri, C. (2008). *Trajectory Planning for Automatic Machines and Robots*. Springer.
289+
- Siciliano, B., Sciavicco, L., Villani, L., & Oriolo, G. (2010). *Robotics: Modelling, Planning and Control*. Springer.
290+
291+
The library's implementation draws heavily from the theoretical frameworks, mathematical formulations, and algorithms presented in these works.
292+
293+
I express my gratitude to these authors for their significant contributions to the field of trajectory planning and robotics, which have made this library possible.

0 commit comments

Comments
 (0)