Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix construction (free variables g_Stewart_fun) #56

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()