Skip to content

Commit

Permalink
WIP: fix symbolic function expansions
Browse files Browse the repository at this point in the history
  • Loading branch information
SGeeversAtVortech committed Feb 18, 2025
1 parent d25610b commit af52198
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/rtctools/_internal/casadi_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
logger = logging.getLogger("rtctools")


def is_affine(e, v):
def is_affine(expr, symbols):
try:
Af = ca.Function("f", [v], [ca.jacobian(e, v)]).expand()
except RuntimeError as e:
if "'eval_sx' not defined for" in str(e):
Af = ca.Function("f", [v], [ca.jacobian(e, v)])
Af = ca.Function("f", [symbols], [ca.jacobian(expr, symbols)]).expand()
except RuntimeError as error:
if "'eval_sx' not defined for" in str(error):
Af = ca.Function("f", [symbols], [ca.jacobian(expr, symbols)])
else:
raise
return Af.sparsity_jac(0, 0).nnz() == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def _interpolate_constant_inputs(variables, raw_constant_inputs):
)
except RuntimeError as e:
# We only expect to fail if the DAE was an external function
if "'eval_sx' not defined for External" in str(e):
if "'eval_sx' not defined for" in str(e):
pass
else:
raise
Expand Down

0 comments on commit af52198

Please sign in to comment.