Skip to content

Commit c90781d

Browse files
committed
require at least 3 points for point_to_point w/ cost, constraints
1 parent cd89353 commit c90781d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

control/flatsys/flatsys.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ def point_to_point(
436436
warnings.warn("basis too small; solution may not exist")
437437

438438
if cost is not None or trajectory_constraints is not None:
439+
# Make sure that we have enough timepoints to evaluate
440+
if timepts.size < 3:
441+
raise ControlArgument(
442+
"There must be at least three time points if trajectory"
443+
" cost or constraints are specified")
444+
439445
# Search over the null space to minimize cost/satisfy constraints
440446
N = sp.linalg.null_space(M)
441447

0 commit comments

Comments
 (0)