To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 55975c35 authored by roangel's avatar roangel
Browse files

added different trials to solve a simple QP. Having problems and do not know why

parent 64c5ca9f
......@@ -246,6 +246,15 @@ find_library( GUROBI_LIBRARY
PATHS "${GUROBI_HOME}/lib"
)
find_library( GUROBI_LIBRARY_CXX
NAMES gurobi_c++
libgurobi_c++.a
libgurobi80.so
PATHS "${GUROBI_HOME}/src/build"
)
set(GUROBI_LIBRARIES "${GUROBI_LIBRARY};${GUROBI_LIBRARY_CXX}" )
## Declare a C++ library
##add_library(${PROJECT_NAME}
## src/blablalba.cpp
......@@ -350,7 +359,7 @@ target_link_libraries(PPSClient ${catkin_LIBRARIES})
target_link_libraries(SafeControllerService ${catkin_LIBRARIES})
target_link_libraries(DemoControllerService ${catkin_LIBRARIES})
target_link_libraries(StudentControllerService ${catkin_LIBRARIES})
target_link_libraries(MpcControllerService ${catkin_LIBRARIES} Eigen3::Eigen ${GUROBI_LIBRARY})
target_link_libraries(MpcControllerService ${catkin_LIBRARIES} Eigen3::Eigen ${GUROBI_LIBRARIES})
target_link_libraries(CentralManagerService ${catkin_LIBRARIES})
target_link_libraries(ParameterService ${catkin_LIBRARIES})
......@@ -367,6 +376,8 @@ target_link_libraries(my_GUI ${catkin_LIBRARIES})
target_link_libraries(student_GUI Qt5::Widgets) # GUI -- let my_GUI have acesss to Qt stuff
target_link_libraries(student_GUI ${catkin_LIBRARIES})
# set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libstdc++")
set (CMAKE_SHARED_LINKER_FLAGS "-lgurobi_c++ -lgurobi80, --as-needed")
#############
## Install ##
......
......@@ -8,11 +8,11 @@
#define N_x 6
#define N_u 4
typedef Eigen::Matrix<float, N_x, N_x> MatrixAtype;
typedef Eigen::Matrix<float, N_x, N_u> MatrixBtype;
typedef Eigen::Matrix<double, N_x, N_x> MatrixAtype;
typedef Eigen::Matrix<double, N_x, N_u> MatrixBtype;
typedef Eigen::Matrix<float, N_x, 1> VectorXtype;
typedef Eigen::Matrix<float, N_u, 1> VectorUtype;
typedef Eigen::Matrix<double, N_x, 1> VectorXtype;
typedef Eigen::Matrix<double, N_u, 1> VectorUtype;
typedef struct params_t {
......@@ -31,11 +31,11 @@ void discretization_affine(const MatrixAtype A, const MatrixBtype B, const Vecto
void get_matrices_linearization_affine(std::vector<VectorXtype> X_tray, std::vector<VectorUtype> U_tray, params_t params, std::vector<MatrixAtype> &A_tray, std::vector<MatrixBtype> &B_tray, std::vector<VectorXtype> &g_tray);
void euler_method_forward(F_callback_type pF, float t0, float h, float tfinal, VectorXtype y0, VectorUtype u, params_t params, std::vector<VectorXtype> &yout);
void funSxSuSg_varying_affine(std::vector<MatrixAtype> A_tray, std::vector<MatrixBtype> B_tray, int N, Eigen::MatrixXf &Sx, Eigen::MatrixXf &Su, Eigen::MatrixXf &Sg);
void funSxSuSg_varying_affine(std::vector<MatrixAtype> A_tray, std::vector<MatrixBtype> B_tray, int N, Eigen::MatrixXd &Sx, Eigen::MatrixXd &Su, Eigen::MatrixXd &Sg);
void funQbar(Eigen::MatrixXf Q, Eigen::MatrixXf P, int N, Eigen::MatrixXf &Qbar);
void funQbar(Eigen::MatrixXd Q, Eigen::MatrixXd P, int N, Eigen::MatrixXd &Qbar);
void funRbar(Eigen::MatrixXf R, int N, Eigen::MatrixXf &Rbar);
void funRbar(Eigen::MatrixXd R, int N, Eigen::MatrixXd &Rbar);
VectorUtype mympc_varying_another(std::vector<MatrixAtype> A_tray, std::vector<MatrixBtype> B_tray, std::vector<VectorXtype> g_tray, Eigen::MatrixXf Q, Eigen::MatrixXf R, Eigen::MatrixXf P, int N, VectorXtype x0, Eigen::VectorXf X_ref, Eigen::VectorXf U_ref, float ft_min, float ft_max, float angle_constraint);
VectorUtype mympc_varying_another(std::vector<MatrixAtype> A_tray, std::vector<MatrixBtype> B_tray, std::vector<VectorXtype> g_tray, Eigen::MatrixXd Q, Eigen::MatrixXd R, Eigen::MatrixXd P, int N, VectorXtype x0, Eigen::VectorXd X_ref, Eigen::VectorXd U_ref, float ft_min, float ft_max, float angle_constraint);
This diff is collapsed.
......@@ -715,9 +715,9 @@ void setpointCallback(const Setpoint& newSetpoint)
std::cout << x_out[i] << std::endl;
}
Eigen::MatrixXf Sx_test;
Eigen::MatrixXf Su_test;
Eigen::MatrixXf Sg_test;
Eigen::MatrixXd Sx_test;
Eigen::MatrixXd Su_test;
Eigen::MatrixXd Sg_test;
int N = 5;
funSxSuSg_varying_affine(A_tray, B_tray, N, Sx_test, Su_test, Sg_test);
......@@ -733,8 +733,8 @@ void setpointCallback(const Setpoint& newSetpoint)
// std::cout << Su_test<< std::endl;
std::cout << Sg_test.format(CleanFmt) << std::endl;
Eigen::MatrixXf Qbar;
Eigen::MatrixXf Rbar;
Eigen::MatrixXd Qbar;
Eigen::MatrixXd Rbar;
VectorXtype p_vec;
p_vec << 3, 3, 3, 2, 2, 2;
......@@ -744,9 +744,9 @@ void setpointCallback(const Setpoint& newSetpoint)
VectorUtype r_vec;
r_vec << 1, 1, 1, 4;
Eigen::MatrixXf P = p_vec.asDiagonal();
Eigen::MatrixXf Q = q_vec.asDiagonal();
Eigen::MatrixXf R = r_vec.asDiagonal();
Eigen::MatrixXd P = p_vec.asDiagonal();
Eigen::MatrixXd Q = q_vec.asDiagonal();
Eigen::MatrixXd R = r_vec.asDiagonal();
funQbar(Q, P, N, Qbar);
......@@ -760,8 +760,8 @@ void setpointCallback(const Setpoint& newSetpoint)
// std::cout << Su_test<< std::endl;
std::cout << Rbar.format(CleanFmt) << std::endl;
Eigen::VectorXf X_ref(N_x*(N+1));
Eigen::VectorXf U_ref(N_u*N);
Eigen::VectorXd X_ref(N_x*(N+1));
Eigen::VectorXd U_ref(N_u*N);
VectorXtype x_ref;
VectorUtype u_ref;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment