Skip to content

Commit 2df0a52

Browse files
committed
Add planning modules and improve docs, rename model to dynamics.
Signed-off-by: James Goppert <james.goppert@gmail.com>
1 parent ce472c3 commit 2df0a52

30 files changed

+2326
-808
lines changed

README.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ X = lie.SE3Quat.elem(ca.DM([1, 2, 3, 1, 0, 0, 0])) # position + quaternion
3737
X_inv = X.inverse()
3838

3939
# Type-safe modeling with full autocomplete
40-
from cyecca.model import ModelSX, state, input_var, param, symbolic
40+
from cyecca.dynamics import ModelSX, state, input_var, param, output_var, symbolic
4141

4242
@symbolic
4343
class States:
44-
x: ca.SX = state(1, 0.0, "position")
44+
x: ca.SX = state(1, 1.0, "position") # Start at x=1
4545
v: ca.SX = state(1, 0.0, "velocity")
4646

4747
@symbolic
@@ -52,12 +52,31 @@ class Inputs:
5252
class Params:
5353
m: ca.SX = param(1.0, "mass")
5454
c: ca.SX = param(0.1, "damping")
55+
k: ca.SX = param(1.0, "spring constant")
5556

56-
model = ModelSX.create(States, Inputs, Params)
57-
x, u, p = model.x, model.u, model.p
58-
f_x = ca.vertcat(x.v, (u.F - p.c * x.v) / p.m)
59-
model.build(f_x=f_x, integrator='rk4')
57+
@symbolic
58+
class Outputs:
59+
position: ca.SX = output_var(desc="position output")
60+
velocity: ca.SX = output_var(desc="velocity output")
61+
62+
model = ModelSX.create(States, Inputs, Params, output_type=Outputs)
63+
x, u, p, y = model.x, model.u, model.p, model.y
64+
65+
# Mass-spring-damper: mx'' + cx' + kx = F
66+
f_x = ca.vertcat(x.v, (u.F - p.c * x.v - p.k * x.x) / p.m)
67+
68+
# Output the full state
69+
f_y = ca.vertcat(x.x, x.v)
70+
71+
model.build(f_x=f_x, f_y=f_y, integrator='rk4')
72+
73+
# Simulate free oscillation from x0=1
6074
result = model.simulate(0.0, 10.0, 0.01)
75+
# Output:
76+
# Final position: -0.529209
77+
# Final velocity: 0.323980
78+
# result['out'][0, :] contains position trajectory
79+
# result['out'][1, :] contains velocity trajectory
6180
```
6281

6382
## Documentation
@@ -82,18 +101,24 @@ cd docs && poetry run make html
82101
### Lie Groups (`cyecca.lie`)
83102
Complete implementations of SO(2), SO(3), SE(2), SE(3), SE_2(3), and R^n with multiple parameterizations.
84103

85-
**Key features:** Group operations, Lie algebra, Jacobians, conversions
104+
**Key features:** Group operations, Lie algebra, Jacobians, conversions
86105
**Learn more:** [Lie Groups Guide](docs/user_guide/lie_groups.rst)
87106

88-
### Modeling Framework (`cyecca.model`)
107+
### Dynamics Framework (`cyecca.dynamics`)
89108
Type-safe declarative API for building hybrid dynamical systems with IDE autocomplete.
90109

91-
**Key features:** Continuous/discrete states, events, DAE, composition, linearization
110+
**Key features:** Continuous/discrete states, events, DAE, composition, linearization
92111
**Learn more:** [Modeling Guide](docs/user_guide/modeling.rst)
93112

94113
### Pre-Built Models (`cyecca.models`)
95114
Ready-to-use dynamics models: quadrotor, fixed-wing aircraft, RDD2 controller, Bezier trajectories
96115

116+
### Path Planning (`cyecca.planning`)
117+
Dubins path planner for fixed-wing aircraft with forward-only, fixed turn radius constraints.
118+
119+
**Key features:** CasADi-based symbolic planning, RSL/LSR/LSL/RSR path types, branch-free implementation
120+
**Learn more:** [Planning Module](cyecca/planning/)
121+
97122
### Other Modules
98123
- **integrators** - RK4, RK8 (DOP853), Euler with adaptive stepping
99124
- **symbolic** - SymPy ↔ CasADi conversion, Taylor series

cyecca/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from . import lie
2-
from . import model
2+
from . import dynamics
3+
from . import planning
34

4-
__all__ = ["lie", "model"]
5+
__all__ = ["lie", "dynamics", "planning"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Models: ModelSX/ModelMX for building and simulating systems
1010
1111
Quick Start:
12-
from cyecca.model import ModelSX, state, input_var, param, symbolic
12+
from cyecca.dynamics import ModelSX, state, input_var, param, symbolic
1313
1414
@symbolic
1515
class States:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def state(dim: int = 1, default: Union[float, list, None] = None, desc: str = ""
4141
Examples
4242
--------
4343
>>> import casadi as ca
44-
>>> from cyecca.model import state, symbolic
44+
>>> from cyecca.dynamics import state, symbolic
4545
>>> @symbolic
4646
... class States:
4747
... x: ca.SX = state(1, 0.0, "position (m)")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Linearizing dynamics around operating points
88
- Modal analysis (eigenvalue decomposition, stability, frequencies)
99
10-
Works with any ModelSX/ModelMX instance from cyecca.model.
10+
Works with any ModelSX/ModelMX instance from cyecca.dynamics.
1111
"""
1212

1313
import casadi as ca

cyecca/planning/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Planning Module
3+
===============
4+
5+
Path planning algorithms for robotics.
6+
7+
Available planners:
8+
- dubins: Forward-only, fixed turn radius path planner for 2D motion
9+
"""
10+
11+
from .dubins import derive_dubins, plot_dubins_path, DubinsPathType
12+
13+
__all__ = ["derive_dubins", "plot_dubins_path", "DubinsPathType"]

0 commit comments

Comments
 (0)