Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3d46bc

Browse files
committed
rebase cleanup
1 parentb2e86b8 commitf3d46bc

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

‎control/optimal.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
importlogging
1717
importtime
1818

19-
from .timerespimportTimeResponseData
2019
from .importconfig
20+
from .exceptionimportControlNotImplemented
21+
from .timerespimportTimeResponseData
2122

2223
__all__= ['find_optimal_input']
2324

@@ -155,11 +156,7 @@ def __init__(
155156

156157
# Make sure all input arguments got parsed
157158
ifkwargs:
158-
raiseTypeError("unknown parameters %s"%kwargs)
159-
160-
iflen(kwargs)>0:
161-
raiseValueError(
162-
f'unrecognized keyword(s):{list(kwargs.keys())}')
159+
raiseTypeError("unrecognized keyword(s): ",str(kwargs))
163160

164161
# Process trajectory constraints
165162
ifisinstance(trajectory_constraints,tuple):
@@ -997,16 +994,12 @@ def solve_ocp(
997994
# Process keyword arguments
998995
iftrajectory_constraintsisNone:
999996
# Backwards compatibility
1000-
trajectory_constraints=kwargs.pop('constraints',None)
997+
trajectory_constraints=kwargs.pop('constraints',[])
1001998

1002999
# Allow 'return_x` as a synonym for 'return_states'
10031000
return_states=ct.config._get_param(
10041001
'optimal','return_x',kwargs,return_states,pop=True)
10051002

1006-
# Process terminal constraints keyword
1007-
ifconstraintsisNone:
1008-
constraints=kwargs.pop('trajectory_constraints', [])
1009-
10101003
# Process (legacy) method keyword
10111004
ifkwargs.get('method'):
10121005
ifkwargs.get('minimize_method'):

‎control/tests/optimal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def test_ocp_argument_errors():
455455
sys,time,x0,cost,constraints,initial_guess=np.zeros((4,1,1)))
456456

457457
# Unrecognized arguments
458-
withpytest.raises(ValueError,match="unrecognized keyword"):
458+
withpytest.raises(TypeError,match="unrecognized keyword"):
459459
res=opt.solve_ocp(
460460
sys,time,x0,cost,constraints,terminal_constraint=None)
461461

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp