Skip to content

Commit 44db126

Browse files
committed
Import ControlArgument in flatsys.py, with test
1 parent 67fa35d commit 44db126

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

control/flatsys/flatsys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import warnings
99
from .poly import PolyFamily
1010
from .systraj import SystemTrajectory
11+
from ..exception import ControlArgument
1112
from ..nlsys import NonlinearIOSystem
1213
from ..timeresp import _check_convert_array
1314

control/tests/flatsys_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,11 @@ def test_point_to_point_errors(self):
618618
flat_sys, timepts, x0, u0, xf, uf,
619619
constraints=[(None, 0, 0, 0)], basis=fs.PolyFamily(8))
620620

621+
# too few timepoints
622+
with pytest.raises(ct.ControlArgument, match="at least three time points"):
623+
fs.point_to_point(
624+
flat_sys, timepts[:2], x0, u0, xf, uf, basis=fs.PolyFamily(10), cost=cost_fcn)
625+
621626
# Unsolvable optimization
622627
constraint = [opt.input_range_constraint(flat_sys, -0.01, 0.01)]
623628
with pytest.warns(UserWarning, match="unable to solve"):

0 commit comments

Comments
 (0)