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