forked from uzh-rpg/rpg_mpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (85 loc) · 3.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# rpg_quadrotor_mpc
# A model predictive control implementation for quadrotors.
# Copyright (C) 2017-2018 Philipp Foehn,
# Robotics and Perception Group, University of Zurich
#
# Intended to be used with rpg_quadrotor_control and rpg_quadrotor_common.
# https://github.com/uzh-rpg/rpg_quadrotor_control
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 2.8.3)
project(rpg_mpc)
find_package(catkin_simple REQUIRED)
catkin_simple()
# activate c++ 11
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()
# ARM NEON flags
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfpu=neon -mfloat-abi=hard -funsafe-math-optimizations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon -mfloat-abi=hard -funsafe-math-optimizations")
message("enabling ARM neon optimizations")
endif()
# flags for speed (should already be enabled by default)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fopenmp -O3")
cs_add_library(mpc_solver
externals/qpoases/SRC/Bounds.cpp
externals/qpoases/SRC/Constraints.cpp
externals/qpoases/SRC/CyclingManager.cpp
externals/qpoases/SRC/Indexlist.cpp
externals/qpoases/SRC/MessageHandling.cpp
externals/qpoases/SRC/QProblem.cpp
externals/qpoases/SRC/QProblemB.cpp
externals/qpoases/SRC/SubjectTo.cpp
externals/qpoases/SRC/Utils.cpp
externals/qpoases/SRC/EXTRAS/SolutionAnalysis.cpp
model/quadrotor_mpc_codegen/acado_qpoases_interface.cpp
model/quadrotor_mpc_codegen/acado_integrator.c
model/quadrotor_mpc_codegen/acado_solver.c
model/quadrotor_mpc_codegen/acado_auxiliary_functions.c)
target_include_directories(mpc_solver PUBLIC
model/quadrotor_mpc_codegen/
externals/qpoases
externals/qpoases/INCLUDE
externals/qpoases/SRC)
cs_add_library(mpc_wrapper
src/mpc_wrapper.cpp)
target_link_libraries(mpc_wrapper
mpc_solver)
cs_add_library(mpc_controller
src/mpc_controller.cpp)
target_link_libraries(mpc_controller
mpc_wrapper)
# make an executable
cs_install()
cs_export()
cs_add_executable(mpc_controller_node
test/mpc_node.cpp)
target_link_libraries(mpc_controller_node
mpc_controller
mpc_wrapper
mpc_solver)
cs_add_executable(autopilot_mpc_instance
src/autopilot_mpc_instance.cpp)
target_link_libraries(autopilot_mpc_instance
mpc_controller
mpc_wrapper
mpc_solver)
cs_install()
cs_export()