Rebuild acado and add scons command to regenerate mpc (#19685)
* rebuild acado and add scons command to regenerate mpc * update scons helppull/19687/head
parent
61cf81502e
commit
7c43a60bda
|
@ -7,11 +7,11 @@
|
|||
*.ipynb filter=nbstripout -diff
|
||||
external/ffmpeg/bin/ffmpeg_cuda filter=lfs diff=lfs merge=lfs -text
|
||||
models/segnet.keras filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x64/lib/libacado_toolkit.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x64/lib/libacado_toolkit_s.so.1.2.2beta filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x64/lib/libacado_casadi.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x64/lib/libacado_csparse.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x64/lib/libacado_qpoases.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x86_64/lib/libacado_toolkit.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x86_64/lib/libacado_toolkit_s.so.1.2.2beta filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x86_64/lib/libacado_casadi.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x86_64/lib/libacado_csparse.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/x86_64/lib/libacado_qpoases.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/aarch64/lib/libacado_toolkit.a filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/aarch64/lib/libacado_toolkit_s.so.1.2.2beta filter=lfs diff=lfs merge=lfs -text
|
||||
phonelibs/acado/aarch64/lib/libacado_casadi.a filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
|
@ -25,6 +25,10 @@ AddOption('--compile_db',
|
|||
action='store_true',
|
||||
help='build clang compilation database')
|
||||
|
||||
AddOption('--mpc-generate',
|
||||
action='store_true',
|
||||
help='regenerates the mpc sources')
|
||||
|
||||
real_arch = arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
||||
if platform.system() == "Darwin":
|
||||
arch = "Darwin"
|
||||
|
|
BIN
phonelibs/acado/aarch64/lib/libacado_casadi.a (Stored with Git LFS)
BIN
phonelibs/acado/aarch64/lib/libacado_casadi.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/aarch64/lib/libacado_csparse.a (Stored with Git LFS)
BIN
phonelibs/acado/aarch64/lib/libacado_csparse.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/aarch64/lib/libacado_qpoases.a (Stored with Git LFS)
BIN
phonelibs/acado/aarch64/lib/libacado_qpoases.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/aarch64/lib/libacado_toolkit.a (Stored with Git LFS)
BIN
phonelibs/acado/aarch64/lib/libacado_toolkit.a (Stored with Git LFS)
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
libacado_toolkit_s.so.1
|
BIN
phonelibs/acado/aarch64/lib/libacado_toolkit_s.so.1.2.2beta (Stored with Git LFS)
BIN
phonelibs/acado/aarch64/lib/libacado_toolkit_s.so.1.2.2beta (Stored with Git LFS)
Binary file not shown.
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
rm -rf acado
|
||||
git clone https://github.com/acado/acado.git
|
||||
cd acado
|
||||
git reset --hard 5adb8cbcff5a5464706a48eaf073218ac87c9044
|
||||
|
||||
# Clang 8 fixes
|
||||
git apply ../01.patch
|
||||
sed -i '100d' cmake/CompilerOptions.cmake
|
||||
sed -i '100d' cmake/CompilerOptions.cmake
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DACADO_WITH_EXAMPLES=OFF -DACADO_BUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="$HOME/openpilot/phonelibs/acado" ..
|
||||
make -j$(nproc)
|
||||
make install
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
rm -r x86_64
|
||||
mkdir x86_64
|
||||
mv lib x86_64/lib
|
||||
cp acado/build/lib/* x86_64/lib/
|
||||
|
||||
rm -rf acado
|
||||
rm -r share
|
|
@ -1,16 +0,0 @@
|
|||
git clone https://github.com/acado/acado.git
|
||||
cd acado
|
||||
git reset --hard 5adb8cbcff5a5464706a48eaf073218ac87c9044
|
||||
|
||||
|
||||
# Clang 8 fixes
|
||||
# git apply 01.patch
|
||||
# sed -i '100d' cmake/CompilerOptions.cmake
|
||||
# sed -i '100d' cmake/CompilerOptions.cmake
|
||||
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DACADO_WITH_EXAMPLES=OFF -DACADO_BUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="$HOME/one/phonelibs/acado" ..
|
||||
make -j4
|
||||
make install
|
|
@ -1,221 +1,221 @@
|
|||
clear stages params outputs codeoptions
|
||||
|
||||
%% Generator for a FORCES QP solver used by the ACADO OCP solver
|
||||
|
||||
%
|
||||
% User options
|
||||
%
|
||||
|
||||
% Number of states
|
||||
nx = @NX@;
|
||||
% Number of controls
|
||||
nu = @NU@;
|
||||
% Number of discretization (shooting) nodes
|
||||
N = @N@;
|
||||
|
||||
% Lower and upper bounds on stage variables, for all N stages
|
||||
lbIdx = { ...
|
||||
@LB_IDX@ ...
|
||||
};
|
||||
ubIdx = { ...
|
||||
@UB_IDX@ ...
|
||||
};
|
||||
|
||||
% Polytopic constraints (A_i*z_i <= b_i) on stage variables, for all N stages
|
||||
AbDim = { ...
|
||||
@AB_DIM@ ...
|
||||
};
|
||||
|
||||
% Constant Hessian
|
||||
constHessian = @CONST_HESSIAN@;
|
||||
% Diagonal Hessian
|
||||
diagHessian = @DIAG_HESSIAN@;
|
||||
diagHessianN = @DIAG_HESSIAN_N@;
|
||||
% Fixed initial state
|
||||
fixedInitialState = @FIXED_INITIAL_STATE@;
|
||||
|
||||
%% Define FORCES multistage problem
|
||||
|
||||
stages = MultistageProblem( N );
|
||||
|
||||
for i = 1: N
|
||||
if (i == 1)
|
||||
|
||||
%
|
||||
% Initial stage
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx + nu; % number of stage variables
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (constHessian == 1)
|
||||
if (diagHessian == 1)
|
||||
params( 1 ) = newParam('H1', 1: 1: N - 1, 'cost.H', 'diag');
|
||||
else
|
||||
params( 1 ) = newParam('H1', 1: 1: N - 1, 'cost.H');
|
||||
end;
|
||||
else
|
||||
if (diagHessian == 1)
|
||||
params( 1 ) = newParam('H1', 1, 'cost.H', 'diag');
|
||||
else
|
||||
params( 1 ) = newParam('H1', 1, 'cost.H');
|
||||
end;
|
||||
end;
|
||||
params(end + 1) = newParam('f1', 1, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% equality constraints
|
||||
params(end + 1) = newParam('C1', 1, 'eq.C');
|
||||
params(end + 1) = newParam('d1', 1, 'eq.c');
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
stages(i).eq.D = [eye(nx), zeros(nx,nu)];
|
||||
end;
|
||||
|
||||
elseif (i < N)
|
||||
|
||||
%
|
||||
% Stages along horizon
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx + nu; % number of stage variables
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (constHessian == 0)
|
||||
if (diagHessian == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H', 'diag');
|
||||
else
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H');
|
||||
end;
|
||||
end;
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'f', i), i, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% Equality constraints
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'C', i), i, 'eq.C');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'd', i), i, 'eq.c');
|
||||
|
||||
stages(i).eq.D = [-eye( nx ), zeros(nx, nu)];
|
||||
|
||||
else
|
||||
|
||||
%
|
||||
% Final stage
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx; % number of stage variables
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
else
|
||||
stages(i).dims.r = 0;
|
||||
end;
|
||||
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (diagHessianN == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H', 'diag');
|
||||
else
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H');
|
||||
end;
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'f', i), i, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% Equality constraints
|
||||
stages(i).eq.D = -eye(nx);
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'd', i), i, 'eq.c');
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
%% Define outputs of the solver
|
||||
for i = 1: N
|
||||
outputs( i ) = newOutput(sprintf('%s%d', 'out', i), i, 1: 1: stages(i).dims.n);
|
||||
end;
|
||||
|
||||
%% Solver settings
|
||||
codeoptions = getOptions('@SOLVER_NAME@');
|
||||
|
||||
codeoptions.overwrite = 1; % Always overwrite the existing code
|
||||
codeoptions.printlevel = @PRINT_LEVEL@;
|
||||
codeoptions.maxit = @MAX_ITERATIONS@;
|
||||
codeoptions.parallel = @PARALLEL@;
|
||||
codeoptions.init = @WARM_START@;
|
||||
|
||||
|
||||
%% Generate code
|
||||
generateCode(stages, params, codeoptions, outputs);
|
||||
clear stages params outputs codeoptions
|
||||
|
||||
%% Generator for a FORCES QP solver used by the ACADO OCP solver
|
||||
|
||||
%
|
||||
% User options
|
||||
%
|
||||
|
||||
% Number of states
|
||||
nx = @NX@;
|
||||
% Number of controls
|
||||
nu = @NU@;
|
||||
% Number of discretization (shooting) nodes
|
||||
N = @N@;
|
||||
|
||||
% Lower and upper bounds on stage variables, for all N stages
|
||||
lbIdx = { ...
|
||||
@LB_IDX@ ...
|
||||
};
|
||||
ubIdx = { ...
|
||||
@UB_IDX@ ...
|
||||
};
|
||||
|
||||
% Polytopic constraints (A_i*z_i <= b_i) on stage variables, for all N stages
|
||||
AbDim = { ...
|
||||
@AB_DIM@ ...
|
||||
};
|
||||
|
||||
% Constant Hessian
|
||||
constHessian = @CONST_HESSIAN@;
|
||||
% Diagonal Hessian
|
||||
diagHessian = @DIAG_HESSIAN@;
|
||||
diagHessianN = @DIAG_HESSIAN_N@;
|
||||
% Fixed initial state
|
||||
fixedInitialState = @FIXED_INITIAL_STATE@;
|
||||
|
||||
%% Define FORCES multistage problem
|
||||
|
||||
stages = MultistageProblem( N );
|
||||
|
||||
for i = 1: N
|
||||
if (i == 1)
|
||||
|
||||
%
|
||||
% Initial stage
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx + nu; % number of stage variables
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (constHessian == 1)
|
||||
if (diagHessian == 1)
|
||||
params( 1 ) = newParam('H1', 1: 1: N - 1, 'cost.H', 'diag');
|
||||
else
|
||||
params( 1 ) = newParam('H1', 1: 1: N - 1, 'cost.H');
|
||||
end;
|
||||
else
|
||||
if (diagHessian == 1)
|
||||
params( 1 ) = newParam('H1', 1, 'cost.H', 'diag');
|
||||
else
|
||||
params( 1 ) = newParam('H1', 1, 'cost.H');
|
||||
end;
|
||||
end;
|
||||
params(end + 1) = newParam('f1', 1, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% equality constraints
|
||||
params(end + 1) = newParam('C1', 1, 'eq.C');
|
||||
params(end + 1) = newParam('d1', 1, 'eq.c');
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
stages(i).eq.D = [eye(nx), zeros(nx,nu)];
|
||||
end;
|
||||
|
||||
elseif (i < N)
|
||||
|
||||
%
|
||||
% Stages along horizon
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx + nu; % number of stage variables
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (constHessian == 0)
|
||||
if (diagHessian == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H', 'diag');
|
||||
else
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H');
|
||||
end;
|
||||
end;
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'f', i), i, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% Equality constraints
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'C', i), i, 'eq.C');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'd', i), i, 'eq.c');
|
||||
|
||||
stages(i).eq.D = [-eye( nx ), zeros(nx, nu)];
|
||||
|
||||
else
|
||||
|
||||
%
|
||||
% Final stage
|
||||
%
|
||||
|
||||
% Dimension
|
||||
stages(i).dims.n = nx; % number of stage variables
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
stages(i).dims.r = nx; % number of equality constraints
|
||||
else
|
||||
stages(i).dims.r = 0;
|
||||
end;
|
||||
|
||||
stages(i).dims.l = length( lbIdx{ i } ); % number of lower bounds
|
||||
stages(i).dims.u = length( ubIdx{ i } ); % number of upper bounds
|
||||
stages(i).dims.p = AbDim{ i }; % number of polytopic constraints
|
||||
stages(i).dims.q = 0; % number of quadratic constraints
|
||||
|
||||
% Cost
|
||||
if (diagHessianN == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H', 'diag');
|
||||
else
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'H', i), i, 'cost.H');
|
||||
end;
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'f', i), i, 'cost.f');
|
||||
|
||||
% Lower bounds
|
||||
stages(i).ineq.b.lbidx = cell2mat( lbIdx{ i } );
|
||||
if (~isempty( lbIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'lb', i), i, 'ineq.b.lb');
|
||||
end;
|
||||
|
||||
% Upper bounds
|
||||
stages(i).ineq.b.ubidx = cell2mat( ubIdx{ i } );
|
||||
if (~isempty( ubIdx{ i } ))
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'ub', i), i, 'ineq.b.ub');
|
||||
end;
|
||||
|
||||
% Polytopic constraints
|
||||
% stages(i).ineq.p.bidx = cell2mat( AbIdx{ i } );
|
||||
if (AbDim{ i } ~= 0)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'Ab', i), i, 'ineq.p.b');
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'A', i), i, 'ineq.p.A');
|
||||
end
|
||||
|
||||
% Equality constraints
|
||||
stages(i).eq.D = -eye(nx);
|
||||
|
||||
if (fixedInitialState == 1)
|
||||
params(end + 1) = newParam(sprintf('%s%d', 'd', i), i, 'eq.c');
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
%% Define outputs of the solver
|
||||
for i = 1: N
|
||||
outputs( i ) = newOutput(sprintf('%s%d', 'out', i), i, 1: 1: stages(i).dims.n);
|
||||
end;
|
||||
|
||||
%% Solver settings
|
||||
codeoptions = getOptions('@SOLVER_NAME@');
|
||||
|
||||
codeoptions.overwrite = 1; % Always overwrite the existing code
|
||||
codeoptions.printlevel = @PRINT_LEVEL@;
|
||||
codeoptions.maxit = @MAX_ITERATIONS@;
|
||||
codeoptions.parallel = @PARALLEL@;
|
||||
codeoptions.init = @WARM_START@;
|
||||
|
||||
|
||||
%% Generate code
|
||||
generateCode(stages, params, codeoptions, outputs);
|
||||
|
|
|
@ -1,77 +1,77 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* qpDUNES interface data and functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#include <qpDUNES.h>
|
||||
|
||||
qpData_t qpData;
|
||||
qpOptions_t qpOptions;
|
||||
|
||||
#if @DIAG_H@
|
||||
#define QPDUNES_LS_HOMOTOPY_GRID_SEARCH 0
|
||||
#endif
|
||||
|
||||
int initializeQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
int kk;
|
||||
|
||||
@QP_ND_ARRAY@
|
||||
|
||||
qpOptions = qpDUNES_setupDefaultOptions();
|
||||
qpOptions.maxIter = @MAX_ITER@;
|
||||
qpOptions.printLevel = @PRINT_LEVEL@;
|
||||
qpOptions.stationarityTolerance = 1.e-6;
|
||||
qpOptions.regParam = 1.e-6;
|
||||
qpOptions.newtonHessDiagRegTolerance = 1.e-8;
|
||||
qpOptions.lsType = @DIAG_H@ ? QPDUNES_LS_ACCELERATED_GRADIENT_BISECTION_LS : QPDUNES_LS_HOMOTOPY_GRID_SEARCH;
|
||||
/* qpOptions.lsType = QPDUNES_LS_BACKTRACKING_LS; */
|
||||
qpOptions.lineSearchReductionFactor = 0.1;
|
||||
qpOptions.lineSearchMaxStepSize = 1.;
|
||||
qpOptions.maxNumLineSearchIterations = 25;
|
||||
qpOptions.maxNumLineSearchRefinementIterations = 25;
|
||||
/* qpOptions.regType = QPDUNES_REG_SINGULAR_DIRECTIONS; */
|
||||
qpOptions.regType = QPDUNES_REG_LEVENBERG_MARQUARDT;
|
||||
|
||||
qpDUNES_setup(&qpData, @ACADO_N@, @ACADO_NX@, @ACADO_NU@, nD, &( qpOptions ));
|
||||
|
||||
for (kk = 0; kk < @ACADO_N@; ++kk)
|
||||
{
|
||||
qpData.intervals[ kk ]->H.sparsityType = @DIAG_H@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
}
|
||||
qpData.intervals[ @ACADO_N@ ]->H.sparsityType = @DIAG_HN@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
|
||||
statusFlag = qpDUNES_init(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
void cleanupQpDunes( void )
|
||||
{
|
||||
qpDUNES_cleanup( &qpData );
|
||||
}
|
||||
|
||||
int solveQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
|
||||
statusFlag = qpDUNES_updateData(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
|
||||
if ( @INITIAL_STATE_FIXED@ )
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ 0 ], 0, 0, 0, 0, @QP_LB_0@, @QP_UB_0@, 0, 0, 0, 0);
|
||||
else
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ @ACADO_N@ ], 0, @QP_G_N@, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
|
||||
statusFlag = qpDUNES_solve( &qpData );
|
||||
|
||||
qpDUNES_getPrimalSol(&qpData, @QP_PRIMAL@);
|
||||
qpDUNES_getDualSol(&qpData, @QP_LAMBDA@, @QP_MU@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* qpDUNES interface data and functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#include <qpDUNES.h>
|
||||
|
||||
qpData_t qpData;
|
||||
qpOptions_t qpOptions;
|
||||
|
||||
#if @DIAG_H@
|
||||
#define QPDUNES_LS_HOMOTOPY_GRID_SEARCH 0
|
||||
#endif
|
||||
|
||||
int initializeQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
int kk;
|
||||
|
||||
@QP_ND_ARRAY@
|
||||
|
||||
qpOptions = qpDUNES_setupDefaultOptions();
|
||||
qpOptions.maxIter = @MAX_ITER@;
|
||||
qpOptions.printLevel = @PRINT_LEVEL@;
|
||||
qpOptions.stationarityTolerance = 1.e-6;
|
||||
qpOptions.regParam = 1.e-6;
|
||||
qpOptions.newtonHessDiagRegTolerance = 1.e-8;
|
||||
qpOptions.lsType = @DIAG_H@ ? QPDUNES_LS_ACCELERATED_GRADIENT_BISECTION_LS : QPDUNES_LS_HOMOTOPY_GRID_SEARCH;
|
||||
/* qpOptions.lsType = QPDUNES_LS_BACKTRACKING_LS; */
|
||||
qpOptions.lineSearchReductionFactor = 0.1;
|
||||
qpOptions.lineSearchMaxStepSize = 1.;
|
||||
qpOptions.maxNumLineSearchIterations = 25;
|
||||
qpOptions.maxNumLineSearchRefinementIterations = 25;
|
||||
/* qpOptions.regType = QPDUNES_REG_SINGULAR_DIRECTIONS; */
|
||||
qpOptions.regType = QPDUNES_REG_LEVENBERG_MARQUARDT;
|
||||
|
||||
qpDUNES_setup(&qpData, @ACADO_N@, @ACADO_NX@, @ACADO_NU@, nD, &( qpOptions ));
|
||||
|
||||
for (kk = 0; kk < @ACADO_N@; ++kk)
|
||||
{
|
||||
qpData.intervals[ kk ]->H.sparsityType = @DIAG_H@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
}
|
||||
qpData.intervals[ @ACADO_N@ ]->H.sparsityType = @DIAG_HN@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
|
||||
statusFlag = qpDUNES_init(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
void cleanupQpDunes( void )
|
||||
{
|
||||
qpDUNES_cleanup( &qpData );
|
||||
}
|
||||
|
||||
int solveQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
|
||||
statusFlag = qpDUNES_updateData(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
|
||||
if ( @INITIAL_STATE_FIXED@ )
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ 0 ], 0, 0, 0, 0, @QP_LB_0@, @QP_UB_0@, 0, 0, 0, 0);
|
||||
else
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ @ACADO_N@ ], 0, @QP_G_N@, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
|
||||
statusFlag = qpDUNES_solve( &qpData );
|
||||
|
||||
qpDUNES_getPrimalSol(&qpData, @QP_PRIMAL@);
|
||||
qpDUNES_getDualSol(&qpData, @QP_LAMBDA@, @QP_MU@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
|
|
@ -1,96 +1,96 @@
|
|||
/******************************************************************************/
|
||||
/* */
|
||||
/* qpDUNES interface data and functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#include <qpDUNES.h>
|
||||
|
||||
qpData_t qpData;
|
||||
qpOptions_t qpOptions;
|
||||
|
||||
#if @DIAG_H@
|
||||
#define QPDUNES_LS_HOMOTOPY_GRID_SEARCH 0
|
||||
#endif
|
||||
|
||||
#include "@MODULE_NAME@_auxiliary_functions.h"
|
||||
real_t prepareQPtime, updateQPtime, solveQPtime;
|
||||
|
||||
int initializeQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
int kk;
|
||||
|
||||
@QP_ND_ARRAY@
|
||||
|
||||
qpOptions = qpDUNES_setupDefaultOptions();
|
||||
qpOptions.maxIter = @MAX_ITER@;
|
||||
qpOptions.printLevel = @PRINT_LEVEL@;
|
||||
qpOptions.stationarityTolerance = 1.e-6;
|
||||
qpOptions.regParam = 1.e-6;
|
||||
qpOptions.newtonHessDiagRegTolerance = 1.e-8;
|
||||
qpOptions.lsType = @DIAG_H@ ? QPDUNES_LS_ACCELERATED_GRADIENT_BISECTION_LS : QPDUNES_LS_HOMOTOPY_GRID_SEARCH;
|
||||
/* qpOptions.lsType = QPDUNES_LS_BACKTRACKING_LS; */
|
||||
qpOptions.lineSearchReductionFactor = 0.1;
|
||||
qpOptions.lineSearchMaxStepSize = 1.;
|
||||
qpOptions.maxNumLineSearchIterations = 25;
|
||||
qpOptions.maxNumLineSearchRefinementIterations = 25;
|
||||
/* qpOptions.regType = QPDUNES_REG_SINGULAR_DIRECTIONS; */
|
||||
qpOptions.regType = QPDUNES_REG_LEVENBERG_MARQUARDT;
|
||||
|
||||
qpDUNES_setup(&qpData, @ACADO_N@, @ACADO_NX@, @ACADO_NU@, nD, &( qpOptions ));
|
||||
|
||||
for (kk = 0; kk < @ACADO_N@; ++kk)
|
||||
{
|
||||
qpData.intervals[ kk ]->H.sparsityType = @DIAG_H@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
}
|
||||
qpData.intervals[ @ACADO_N@ ]->H.sparsityType = @DIAG_HN@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
|
||||
statusFlag = qpDUNES_init(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
void cleanupQpDunes( void )
|
||||
{
|
||||
qpDUNES_cleanup( &qpData );
|
||||
}
|
||||
|
||||
int prepareQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
@MODULE_NAME@_timer tmr;
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
statusFlag = qpDUNES_updateData(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
prepareQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
int solveQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
@MODULE_NAME@_timer tmr;
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
if ( @INITIAL_STATE_FIXED@ )
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ 0 ], 0, 0, 0, 0, @QP_LB_0@, @QP_UB_0@, 0, 0, 0, 0);
|
||||
else
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ @ACADO_N@ ], 0, @QP_G_N@, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
updateQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
statusFlag = qpDUNES_solve( &qpData );
|
||||
|
||||
qpDUNES_getPrimalSol(&qpData, @QP_PRIMAL@);
|
||||
qpDUNES_getDualSol(&qpData, @QP_LAMBDA@, @QP_MU@);
|
||||
solveQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* qpDUNES interface data and functions */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
#include <qpDUNES.h>
|
||||
|
||||
qpData_t qpData;
|
||||
qpOptions_t qpOptions;
|
||||
|
||||
#if @DIAG_H@
|
||||
#define QPDUNES_LS_HOMOTOPY_GRID_SEARCH 0
|
||||
#endif
|
||||
|
||||
#include "@MODULE_NAME@_auxiliary_functions.h"
|
||||
real_t prepareQPtime, updateQPtime, solveQPtime;
|
||||
|
||||
int initializeQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
int kk;
|
||||
|
||||
@QP_ND_ARRAY@
|
||||
|
||||
qpOptions = qpDUNES_setupDefaultOptions();
|
||||
qpOptions.maxIter = @MAX_ITER@;
|
||||
qpOptions.printLevel = @PRINT_LEVEL@;
|
||||
qpOptions.stationarityTolerance = 1.e-6;
|
||||
qpOptions.regParam = 1.e-6;
|
||||
qpOptions.newtonHessDiagRegTolerance = 1.e-8;
|
||||
qpOptions.lsType = @DIAG_H@ ? QPDUNES_LS_ACCELERATED_GRADIENT_BISECTION_LS : QPDUNES_LS_HOMOTOPY_GRID_SEARCH;
|
||||
/* qpOptions.lsType = QPDUNES_LS_BACKTRACKING_LS; */
|
||||
qpOptions.lineSearchReductionFactor = 0.1;
|
||||
qpOptions.lineSearchMaxStepSize = 1.;
|
||||
qpOptions.maxNumLineSearchIterations = 25;
|
||||
qpOptions.maxNumLineSearchRefinementIterations = 25;
|
||||
/* qpOptions.regType = QPDUNES_REG_SINGULAR_DIRECTIONS; */
|
||||
qpOptions.regType = QPDUNES_REG_LEVENBERG_MARQUARDT;
|
||||
|
||||
qpDUNES_setup(&qpData, @ACADO_N@, @ACADO_NX@, @ACADO_NU@, nD, &( qpOptions ));
|
||||
|
||||
for (kk = 0; kk < @ACADO_N@; ++kk)
|
||||
{
|
||||
qpData.intervals[ kk ]->H.sparsityType = @DIAG_H@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
}
|
||||
qpData.intervals[ @ACADO_N@ ]->H.sparsityType = @DIAG_HN@ ? QPDUNES_DIAGONAL : QPDUNES_DENSE;
|
||||
|
||||
statusFlag = qpDUNES_init(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
void cleanupQpDunes( void )
|
||||
{
|
||||
qpDUNES_cleanup( &qpData );
|
||||
}
|
||||
|
||||
int prepareQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
@MODULE_NAME@_timer tmr;
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
statusFlag = qpDUNES_updateData(&qpData, @QP_H@, @QP_G@, @QP_C@, @QP_c@, @QP_LB@, @QP_UB@, @QP_D@, @QP_LBA@, @QP_UBA@);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
prepareQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
int solveQpDunes( void )
|
||||
{
|
||||
return_t statusFlag;
|
||||
@MODULE_NAME@_timer tmr;
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
if ( @INITIAL_STATE_FIXED@ )
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ 0 ], 0, 0, 0, 0, @QP_LB_0@, @QP_UB_0@, 0, 0, 0, 0);
|
||||
else
|
||||
statusFlag = qpDUNES_updateIntervalData(&qpData, qpData.intervals[ @ACADO_N@ ], 0, @QP_G_N@, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (statusFlag != QPDUNES_OK)
|
||||
return (int)statusFlag;
|
||||
updateQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
@MODULE_NAME@_tic( &tmr );
|
||||
statusFlag = qpDUNES_solve( &qpData );
|
||||
|
||||
qpDUNES_getPrimalSol(&qpData, @QP_PRIMAL@);
|
||||
qpDUNES_getDualSol(&qpData, @QP_LAMBDA@, @QP_MU@);
|
||||
solveQPtime = @MODULE_NAME@_toc( &tmr );
|
||||
|
||||
return (int)statusFlag;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
#include <@ACADO_COMMON_HEADER@>
|
||||
|
||||
#include "qpOASES_e/@SOLVER_NAME@.h"
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
#include "qpOASES_e/extras/SolutionAnalysis.h"
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
static int @MODULE_NAME@_@PREFIX@nWSR;
|
||||
|
||||
@USE_NAMESPACE@
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
static SolutionAnalysis @MODULE_NAME@_sa;
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
int @MODULE_NAME@_@PREFIX@solve( void )
|
||||
{
|
||||
|
||||
returnValue retVal;
|
||||
@SOLVER_NAME@ qp;
|
||||
Options options;
|
||||
|
||||
@MODULE_NAME@_@PREFIX@nWSR = QPOASES_NWSRMAX;
|
||||
|
||||
@CTOR@;
|
||||
Options_setToMPC( &options );
|
||||
@SOLVER_NAME@_setOptions( &qp,options );
|
||||
|
||||
retVal = @SOLVER_NAME@_@CALL_SOLVER@
|
||||
retVal = qpOASES_getSimpleStatus( retVal,0 );
|
||||
|
||||
/* only use solution on success, if iteration limit has been reached or if QP is infeasible! */
|
||||
if ( ( retVal == 0 ) || ( retVal == 1 ) || ( retVal == -2 ) )
|
||||
{
|
||||
@SOLVER_NAME@_getPrimalSolution( &qp,@PRIMAL_SOLUTION@ );
|
||||
@SOLVER_NAME@_getDualSolution( &qp,@DUAL_SOLUTION@ );
|
||||
}
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
|
||||
if (retVal != SUCCESSFUL_RETURN)
|
||||
return (int)retVal;
|
||||
|
||||
retVal = @MODULE_NAME@_sa.getHessianInverse( &qp,@SIGMA@ );
|
||||
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
return (int)retVal;
|
||||
}
|
||||
|
||||
int @MODULE_NAME@_@PREFIX@getNWSR( void )
|
||||
{
|
||||
return @MODULE_NAME@_@PREFIX@nWSR;
|
||||
}
|
||||
|
||||
const char* @MODULE_NAME@_@PREFIX@getErrorString( int error )
|
||||
{
|
||||
return MessageHandling_getErrorCodeMessage( qpOASES_getGlobalMessageHandler(),error );
|
||||
}
|
||||
#include <@ACADO_COMMON_HEADER@>
|
||||
|
||||
#include "qpOASES_e/@SOLVER_NAME@.h"
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
#include "qpOASES_e/extras/SolutionAnalysis.h"
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
static int @MODULE_NAME@_@PREFIX@nWSR;
|
||||
|
||||
@USE_NAMESPACE@
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
static SolutionAnalysis @MODULE_NAME@_sa;
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
int @MODULE_NAME@_@PREFIX@solve( void )
|
||||
{
|
||||
|
||||
returnValue retVal;
|
||||
@SOLVER_NAME@ qp;
|
||||
Options options;
|
||||
|
||||
@MODULE_NAME@_@PREFIX@nWSR = QPOASES_NWSRMAX;
|
||||
|
||||
@CTOR@;
|
||||
Options_setToMPC( &options );
|
||||
@SOLVER_NAME@_setOptions( &qp,options );
|
||||
|
||||
retVal = @SOLVER_NAME@_@CALL_SOLVER@
|
||||
retVal = qpOASES_getSimpleStatus( retVal,0 );
|
||||
|
||||
/* only use solution on success, if iteration limit has been reached or if QP is infeasible! */
|
||||
if ( ( retVal == 0 ) || ( retVal == 1 ) || ( retVal == -2 ) )
|
||||
{
|
||||
@SOLVER_NAME@_getPrimalSolution( &qp,@PRIMAL_SOLUTION@ );
|
||||
@SOLVER_NAME@_getDualSolution( &qp,@DUAL_SOLUTION@ );
|
||||
}
|
||||
|
||||
#if @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX == 1
|
||||
|
||||
if (retVal != SUCCESSFUL_RETURN)
|
||||
return (int)retVal;
|
||||
|
||||
retVal = @MODULE_NAME@_sa.getHessianInverse( &qp,@SIGMA@ );
|
||||
|
||||
#endif /* @MODULE_PREFIX@_COMPUTE_COVARIANCE_MATRIX */
|
||||
|
||||
return (int)retVal;
|
||||
}
|
||||
|
||||
int @MODULE_NAME@_@PREFIX@getNWSR( void )
|
||||
{
|
||||
return @MODULE_NAME@_@PREFIX@nWSR;
|
||||
}
|
||||
|
||||
const char* @MODULE_NAME@_@PREFIX@getErrorString( int error )
|
||||
{
|
||||
return MessageHandling_getErrorCodeMessage( qpOASES_getGlobalMessageHandler(),error );
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ACADO_TOOLKIT_TEMPLATES_HPP
|
||||
#define ACADO_TOOLKIT_TEMPLATES_HPP
|
||||
|
||||
#define TEMPLATE_PATHS "/home/batman/tmpbld/acado/acado/code_generation/templates;/home/batman/one/phonelibs/acado/include/acado/code_generation/templates;/data/data/com.termux/files/home/one/phonelibs/acado/include/acado/code_generation/templates"
|
||||
#define TEMPLATE_PATHS "/home/batman/openpilot/phonelibs/acado/acado/acado/code_generation/templates;/home/batman/openpilot/phonelibs/acado/include/acado/code_generation/templates"
|
||||
|
||||
#define INTEGRATOR_MEX_TEMPLATE "integrator_mex.c.in"
|
||||
#define RHS_MEX_TEMPLATE "rhs_mex.c.in"
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. The end-user documentation included with the
|
||||
redistribution, if any, must include the following
|
||||
acknowledgment:
|
||||
|
||||
"This product includes software developed by the
|
||||
University of Chicago, as Operator of Argonne National
|
||||
Laboratory.
|
||||
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, if and wherever such third-party acknowledgments
|
||||
normally appear.
|
||||
|
||||
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
|
||||
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
|
||||
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
|
||||
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
|
||||
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
|
||||
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
|
||||
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
|
||||
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
|
||||
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
|
||||
BE CORRECTED.
|
||||
|
||||
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
|
||||
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
|
||||
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
|
||||
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
|
||||
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
|
||||
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
|
||||
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
|
||||
POSSIBILITY OF SUCH LOSS OR DAMAGES.
|
||||
|
||||
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. The end-user documentation included with the
|
||||
redistribution, if any, must include the following
|
||||
acknowledgment:
|
||||
|
||||
"This product includes software developed by the
|
||||
University of Chicago, as Operator of Argonne National
|
||||
Laboratory.
|
||||
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, if and wherever such third-party acknowledgments
|
||||
normally appear.
|
||||
|
||||
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
|
||||
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
|
||||
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
|
||||
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
|
||||
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
|
||||
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
|
||||
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
|
||||
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
|
||||
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
|
||||
BE CORRECTED.
|
||||
|
||||
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
|
||||
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
|
||||
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
|
||||
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
|
||||
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
|
||||
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
|
||||
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
|
||||
POSSIBILITY OF SUCH LOSS OR DAMAGES.
|
||||
|
||||
|
|
BIN
phonelibs/acado/x64/lib/libacado_casadi.a (Stored with Git LFS)
BIN
phonelibs/acado/x64/lib/libacado_casadi.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/x64/lib/libacado_csparse.a (Stored with Git LFS)
BIN
phonelibs/acado/x64/lib/libacado_csparse.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/x64/lib/libacado_qpoases.a (Stored with Git LFS)
BIN
phonelibs/acado/x64/lib/libacado_qpoases.a (Stored with Git LFS)
Binary file not shown.
BIN
phonelibs/acado/x64/lib/libacado_toolkit.a (Stored with Git LFS)
BIN
phonelibs/acado/x64/lib/libacado_toolkit.a (Stored with Git LFS)
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
libacado_toolkit_s.so.1
|
|
@ -1 +0,0 @@
|
|||
libacado_toolkit_s.so.1.2.2beta
|
BIN
phonelibs/acado/x64/lib/libacado_toolkit_s.so.1.2.2beta (Stored with Git LFS)
BIN
phonelibs/acado/x64/lib/libacado_toolkit_s.so.1.2.2beta (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
|
@ -7,23 +7,40 @@ cpp_path = [
|
|||
"#phonelibs/qpoases/INCLUDE/EXTRAS",
|
||||
"#phonelibs/qpoases/SRC/",
|
||||
"#phonelibs/qpoases",
|
||||
"lib_mpc_export"
|
||||
|
||||
"lib_mpc_export",
|
||||
]
|
||||
|
||||
mpc_files = [
|
||||
"lateral_mpc.c",
|
||||
Glob("lib_mpc_export/*.c"),
|
||||
Glob("lib_mpc_export/*.cpp"),
|
||||
generated_c = [
|
||||
'lib_mpc_export/acado_auxiliary_functions.c',
|
||||
'lib_mpc_export/acado_qpoases_interface.cpp',
|
||||
'lib_mpc_export/acado_integrator.c',
|
||||
'lib_mpc_export/acado_solver.c',
|
||||
]
|
||||
|
||||
generated_h = [
|
||||
'lib_mpc_export/acado_common.h',
|
||||
'lib_mpc_export/acado_auxiliary_functions.h',
|
||||
'lib_mpc_export/acado_qpoases_interface.hpp',
|
||||
]
|
||||
|
||||
interface_dir = Dir('lib_mpc_export')
|
||||
|
||||
SConscript(['#phonelibs/qpoases/SConscript'], variant_dir='lib_qp', exports=['interface_dir'])
|
||||
|
||||
if GetOption('mpc_generate'):
|
||||
generator_cpp = File('generator.cpp')
|
||||
|
||||
acado_libs = [File(f"#phonelibs/acado/{arch}/lib/libacado_toolkit.a"),
|
||||
File(f"#phonelibs/acado/{arch}/lib/libacado_casadi.a"),
|
||||
File(f"#phonelibs/acado/{arch}/lib/libacado_csparse.a")]
|
||||
|
||||
generator = env.Program('generator', generator_cpp, LIBS=acado_libs, CPPPATH=cpp_path,
|
||||
CCFLAGS=env['CCFLAGS'] + ["-Wno-deprecated", "-Wno-overloaded-shift-op-parentheses"])
|
||||
|
||||
cmd = f"cd {Dir('.').get_abspath()} && {generator[0].get_abspath()}"
|
||||
env.Command(generated_c + generated_h, generator, cmd)
|
||||
|
||||
|
||||
|
||||
mpc_files = ["lateral_mpc.c"] + generated_c
|
||||
env.SharedLibrary('mpc', mpc_files, LIBS=['m', 'qpoases'], LIBPATH=['lib_qp'], CPPPATH=cpp_path)
|
||||
# if arch != "aarch64":
|
||||
# acado_libs = [File("#phonelibs/acado/x64/lib/libacado_toolkit.a"),
|
||||
# File("#phonelibs/acado/x64/lib/libacado_casadi.a"),
|
||||
# File("#phonelibs/acado/x64/lib/libacado_csparse.a")]
|
||||
# env.Program('generator', 'generator.cpp', LIBS=acado_libs, CPPPATH=cpp_path)
|
||||
|
|
|
@ -8,25 +8,41 @@ cpp_path = [
|
|||
"#phonelibs/qpoases/INCLUDE/EXTRAS",
|
||||
"#phonelibs/qpoases/SRC/",
|
||||
"#phonelibs/qpoases",
|
||||
"lib_mpc_export"
|
||||
|
||||
"lib_mpc_export",
|
||||
]
|
||||
|
||||
mpc_files = [
|
||||
"longitudinal_mpc.c",
|
||||
Glob("lib_mpc_export/*.c"),
|
||||
Glob("lib_mpc_export/*.cpp"),
|
||||
generated_c = [
|
||||
'lib_mpc_export/acado_auxiliary_functions.c',
|
||||
'lib_mpc_export/acado_qpoases_interface.cpp',
|
||||
'lib_mpc_export/acado_integrator.c',
|
||||
'lib_mpc_export/acado_solver.c',
|
||||
]
|
||||
|
||||
generated_h = [
|
||||
'lib_mpc_export/acado_common.h',
|
||||
'lib_mpc_export/acado_auxiliary_functions.h',
|
||||
'lib_mpc_export/acado_qpoases_interface.hpp',
|
||||
]
|
||||
|
||||
|
||||
interface_dir = Dir('lib_mpc_export')
|
||||
|
||||
SConscript(['#phonelibs/qpoases/SConscript'], variant_dir='lib_qp', exports=['interface_dir'])
|
||||
|
||||
if GetOption('mpc_generate'):
|
||||
generator_cpp = File('generator.cpp')
|
||||
|
||||
acado_libs = [File(f"#phonelibs/acado/{arch}/lib/libacado_toolkit.a"),
|
||||
File(f"#phonelibs/acado/{arch}/lib/libacado_casadi.a"),
|
||||
File(f"#phonelibs/acado/{arch}/lib/libacado_csparse.a")]
|
||||
|
||||
generator = env.Program('generator', generator_cpp, LIBS=acado_libs, CPPPATH=cpp_path,
|
||||
CCFLAGS=env['CCFLAGS'] + ["-Wno-deprecated", "-Wno-overloaded-shift-op-parentheses"])
|
||||
|
||||
cmd = f"cd {Dir('.').get_abspath()} && {generator[0].get_abspath()}"
|
||||
env.Command(generated_c + generated_h, generator, cmd)
|
||||
|
||||
|
||||
mpc_files = ["longitudinal_mpc.c"] + generated_c
|
||||
env.SharedLibrary('mpc1', mpc_files, LIBS=['m', 'qpoases'], LIBPATH=['lib_qp'], CPPPATH=cpp_path)
|
||||
env.SharedLibrary('mpc2', mpc_files, LIBS=['m', 'qpoases'], LIBPATH=['lib_qp'], CPPPATH=cpp_path)
|
||||
|
||||
# if arch != "aarch64":
|
||||
# acado_libs = [File("#phonelibs/acado/x64/lib/libacado_toolkit.a"),
|
||||
# File("#phonelibs/acado/x64/lib/libacado_casadi.a"),
|
||||
# File("#phonelibs/acado/x64/lib/libacado_csparse.a")]
|
||||
# env.Program('generator', 'generator.cpp', LIBS=acado_libs, CPPPATH=cpp_path)
|
||||
|
|
Loading…
Reference in New Issue