8000 MATLAB/Octave: add note on interfaces to examples by sandmaennchen · Pull Request #1232 · acados/acados · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MATLAB/Octave: add note on interfaces to examples #1232

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

Merged
merged 1 commit into from
Sep 2, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


clear all; clc;
check_acados_requirements()
addpath('../linear_mass_spring_model/');
Expand Down Expand Up @@ -121,7 +128,7 @@
ocp_model.set('cost_source_ext_cost_0', 'generic_ext_cost.c');
ocp_model.set('cost_function_ext_cost_0', 'ext_cost');
% Generic stage cost
ocp_model.set('cost_ext_fun_type', 'generic');
ocp_model.set('cost_ext_fun_type', 'generic');
ocp_model.set('cost_source_ext_cost', 'generic_ext_cost.c');
ocp_model.set('cost_function_ext_cost', 'ext_cost');
% Generic terminal cost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%


% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

import casadi.*

%% test of native matlab interface
clear all; clc;
check_acados_requirements()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all; clc;

addpath('../pendulum_on_cart_model')
Expand Down Expand Up @@ -360,9 +366,9 @@
% time_linearize = sum(time_lin);
% time_regulariz = sum(time_reg);
% time_qp_solution = sum(time_qp_sol);
%
%
% figure;
%
%
% bar_vals = 1000 * [time_linearize; time_regulariz; time_qp_solution; ...
% time_total - time_linearize - time_regulariz - time_qp_solution] / n_executions;
% bar([1; nan], [bar_vals, nan(size(bar_vals))]' ,'stacked')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all; clc;

model_path = fullfile(pwd,'..','pendulum_on_cart_model');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface


% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


% options needed for the Simulink example
if ~exist('simulink_opts','var')
disp('using acados simulink default options')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%



% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


%% minimal example of acados integrator matlab interface
clear all; clc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%


% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

%% example of closed loop simulation
clear all; clc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


clear all; clc;
check_acados_requirements()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


clear all; clc;
check_acados_requirements();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%




% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


function model = linear_mass_spring_model()

Expand Down
11 changes: 9 additions & 2 deletions examples/acados_matlab_octave/linear_mpc/example_closed_loop.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

< 3D11 /td>
clear all; clc; close all;
check_acados_requirements()

Expand Down
13 changes: 12 additions & 1 deletion examples/acados_matlab_octave/linear_mpc/quadcopter.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
% POSSIBILITY OF SUCH DAMAGE.;
%




% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


% this function implements the quadcopter model from https://osqp.org/docs/examples/mpc.html
% more infomation can be found here: https://github.com/orgs/osqp/discussions/558

Expand Down Expand Up @@ -80,7 +91,7 @@
cost_expr_ext_cost = cost_expr_ext_cost_e + sym_u'*R*sym_u; % stage cost (states and inputs)
cost_expr_ext_cost = 1/h * cost_expr_ext_cost; % scale the stage cost to match the discrete formulation
cost_expr_ext_cost_0 = 1/h * sym_u'*R*sym_u; % penalize only the inputs in the first stage
% more info on discrete cost scaling:
% more info on discrete cost scaling:
% https://docs.acados.org/python_interface/index.html#acados_template.acados_ocp_cost.AcadosOcpCost

% linear least-squares cost formulation (alternative)
Expand Down
10 changes: 10 additions & 0 deletions examples/acados_matlab_octave/lorentz/example_mhe.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
%
% author: Katrin Baumgaertner




% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all

%% model
Expand Down
13 changes: 13 additions & 0 deletions examples/acados_matlab_octave/lorentz/lorentz_model.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
%
% author: Katrin Baumgaertner





% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)



function [model] = lorentz_model()

import casadi.*
Expand Down
8 changes: 8 additions & 0 deletions examples/acados_matlab_octave/lorentz/setup_estimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@



% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


function [estimator] = setup_estimator(model)

N = model.N;
Expand Down
10 changes: 10 additions & 0 deletions examples/acados_matlab_octave/lorentz/setup_integrator.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
% POSSIBILITY OF SUCH DAMAGE.;




% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


function [sim_solver] = setup_integrator(model)

model_name = 'lorentz_model_integrator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%



% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)


%% example of closed loop simulation
clear all
Expand Down
11 changes: 9 additions & 2 deletions examples/acados_matlab_octave/masses_chain_model/example_ocp.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface


% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all


Expand Down
10 changes: 8 additions & 2 deletions examples/acados_matlab_octave/pendulum_dae/example_closed_loop.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%

%% test of native matlab interface

% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all; clc;

% check that env.sh has been run
Expand Down
9 changes: 8 additions & 1 deletion examples/acados_matlab_octave/pendulum_dae/example_sim.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.;

%


% NOTE: `acados` currently supports both an old MATLAB/Octave interface (< v0.4.0)
% as well as a new interface (>= v0.4.0).

% THIS EXAMPLE still uses the OLD interface. If you are new to `acados` please start
% with the examples that have been ported to the new interface already.
% see https://github.com/acados/acados/issues/1196#issuecomment-2311822122)

clear all; clc;

Expand Down
Loading
Loading
0