diff --git a/demos/prepare_demo_trailer.m b/demos/prepare_demo_trailer.m index 72288b5..7feade0 100644 --- a/demos/prepare_demo_trailer.m +++ b/demos/prepare_demo_trailer.m @@ -4,7 +4,8 @@ % enviroment. (output location is repo/test_controller_builds/demo_controller_matlab) % generate static files - trailer_controller_output_location = ['../test_controller_builds/' controller_folder_name]; + rootdir = get_nmpc_codegen_matlab_rootdir(); + trailer_controller_output_location = fullfile(rootdir, 'test_controller_builds', controller_folder_name); nmpccodegen.tools.Bootstrapper.bootstrap(trailer_controller_output_location, true); % get example model from lib diff --git a/get_nmpc_codegen_matlab_rootdir.m b/get_nmpc_codegen_matlab_rootdir.m new file mode 100644 index 0000000..87fb2c2 --- /dev/null +++ b/get_nmpc_codegen_matlab_rootdir.m @@ -0,0 +1,4 @@ +function rootdir = get_nmpc_codegen_matlab_rootdir() +rootdir = which('get_nmpc_codegen_matlab_rootdir'); +tokens = strsplit(rootdir, 'get_nmpc_codegen_matlab_rootdir.m'); +rootdir = tokens{1}; \ No newline at end of file