1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
"""Options for TOPP2 reachable-set based solvers.
Omitted fields use Rust ``ReachSet2OptionsBuilder::new()`` defaults:
``lp_feas_tol=1e-8``, ``a_cmp_abs_tol=1e-8``,
``a_cmp_rel_tol=1e-8``, and ``verbosity=Verbosity.SILENT``. The same
options object is intended to be reused by ``topp2_ra`` and reach-set
helpers.
"""
:
"""Feasibility tolerance used by LP subproblems. Rust default: ``1e-8``."""
:
"""Absolute tolerance for comparing reachable ``a`` bounds. Rust default: ``1e-8``."""
:
"""Relative tolerance for comparing reachable ``a`` bounds. Rust default: ``1e-8``."""
:
"""Diagnostic verbosity level. Rust default: ``Verbosity.SILENT``."""
"""Construct TOPP2 reachability options.
Defaults mirror Rust and are listed in the class docstring. Invalid
tolerances are rejected by the Rust options builder and reported as
``CoppError``.
"""
...
"""Reachable interval bounds for a TOPP2/COPP2 station grid.
For each station ``k`` in the associated ``Topp2Problem`` interval, the
reachable state is ``a_min[k] <= a[k] <= a_max[k]`` where
``a = (ds/dt)^2``. The result owns its data. Accessing ``a_min`` or
``a_max`` returns a NumPy array copy, so mutating the returned array does
not affect the result object or any Rust solver state.
"""
:
"""Upper reachable bound at each station."""
:
"""Lower reachable bound at each station."""
:
"""Number of stations covered by this reachable set."""
"""Borrowed TOPP2 problem descriptor.
``Topp2Problem`` stores a reference to a ``Constraints`` proxy plus the
closed station interval and endpoint state values. It does not copy
constraint data. Each solver call rebuilds and validates the Rust
``Topp2Problem`` from the current constraint buffer.
Examples
--------
Construct the problem from ``robot.constraints`` and solve it with default
reach-set options::
problem = copp.solver.topp2_ra.Problem(
robot.constraints,
idx_s_interval=(0, len(robot) - 1),
a_boundary=(0.0, 0.0),
)
a = copp.solver.topp2_ra.solve(problem)
"""
"""Constraint proxy referenced by this immutable descriptor."""
...
"""Closed station-index interval ``(idx_s_start, idx_s_final)``."""
...
"""Endpoint state values ``(a_start, a_final)``."""
...
"""Number of station samples in the closed interval."""
...
"""Construct and validate a TOPP2 problem descriptor.
Parameters
----------
constraints:
Usually ``robot.constraints``.
idx_s_interval:
Closed station-index interval ``(idx_s_start, idx_s_final)``.
a_boundary:
Boundary values of ``a = ds/dt squared`` at the start and final
station.
Raises
------
CoppError
If the interval or boundary values are invalid for the current
constraints.
"""
...
"""Validate the descriptor against the current constraint buffer."""
...
"""Compute backward-only TOPP2 reachable intervals.
The backward pass enforces the terminal boundary in ``problem.a_boundary``
and checks the start boundary for basic feasibility, but it does not clip
intervals with a forward pass.
Parameters
----------
problem:
TOPP2 problem descriptor, normally created from ``robot.constraints``.
options:
Optional reachable-set options. ``None`` uses Rust defaults.
Returns
-------
ReachSet2
Owned reachable intervals with ``a_min`` and ``a_max`` arrays.
Raises
------
CoppError
If Rust problem validation, options validation, or reachable-set
construction fails.
"""
...
"""Compute bidirectional TOPP2 reachable intervals.
The bidirectional variant performs the backward pass and then clips the
result with a forward pass, enforcing both start and terminal boundary
values in ``problem.a_boundary``.
Parameters
----------
problem:
TOPP2 problem descriptor, normally created from ``robot.constraints``.
options:
Optional reachable-set options. ``None`` uses Rust defaults.
Returns
-------
ReachSet2
Owned reachable intervals with ``a_min`` and ``a_max`` arrays.
Raises
------
CoppError
If Rust problem validation, options validation, or reachable-set
construction fails.
"""
...
"""Solve a TOPP2 problem with reachability analysis.
Parameters
----------
problem:
TOPP2 problem descriptor, normally created from ``robot.constraints``.
options:
Optional reachable-set options. ``None`` uses Rust defaults.
Returns
-------
numpy.ndarray
Node profile ``a`` with length ``problem.s_len`` where
``a = (ds/dt)^2``.
Raises
------
CoppError
If Rust problem validation, options validation, or the RA solve fails.
"""
...