Skip to content

Commit

Permalink
Fix construction (free variables g_Stewart_fun)
Browse files Browse the repository at this point in the history
  • Loading branch information
WimVanRoy committed Oct 19, 2023
1 parent 4dafab2 commit af82897
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nosnoc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ def preprocess_model(self, opts: NosnocOpts):
self.std_compl_res_fun = ca.Function('std_compl_res_fun', [z, self.p], [std_compl_res])
if opts.pss_mode == PssMode.STEWART:
mu00_stewart = casadi_vertcat_list([ca.mmin(g_Stewart_list[ii]) for ii in range(n_sys)])
self.mu00_stewart_fun = ca.Function('mu00_stewart_fun', [self.x, self.p], [mu00_stewart])
self.g_Stewart_fun = ca.Function('g_Stewart_fun', [self.x, self.p], [g_Stewart])
self.mu00_stewart_fun = ca.Function('mu00_stewart_fun', [self.x, self.z, self.p], [mu00_stewart])
self.g_Stewart_fun = ca.Function('g_Stewart_fun', [self.x, self.z, self.p], [g_Stewart])

def create_stage_vars(self, opts: NosnocOpts):
"""
Expand Down
4 changes: 2 additions & 2 deletions nosnoc/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def create_function_calculate_vector_field(self, sigma, p=[], v=[]):
ca.sum1(theta)-1
)
))
def fun(x, u):
g = self.model.g_Stewart_fun(x, p)
def fun(x, u, z=[0]):
g = self.model.g_Stewart_fun(x, z, p)
theta = theta_fun(0, g)[:-1]
F = self.model.F_fun(x, u, p, v)
return np.dot(F, theta)
Expand Down
12 changes: 12 additions & 0 deletions test/test_simple_car_algebraics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import unittest
from examples.simple_car_algebraics.simple_car_algebraic import solve_ocp


class TestSimpleCarAlgebraics(unittest.TestCase):

def test_simple_solving(self):
solve_ocp()


if __name__ == "__main__":
unittest.main()

0 comments on commit af82897

Please sign in to comment.