-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·221 lines (169 loc) · 5.41 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
cmake_minimum_required(VERSION 3.2.2)
project(sjtu_drone)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
sensor_msgs
image_transport
message_generation)
find_package(gazebo REQUIRED)
## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)
find_package(Protobuf REQUIRED)
##find_package(PCL REQUIRED)
include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(OGRE OGRE)
pkg_check_modules(OGRE-Terrain OGRE-Terrain)
endif()
link_directories(${GAZEBO_LIBRARY_DIRS} ${Boost_LIBRARIES} ${PROTOBUF_LIBRARIES} ${OGRE_LIBRARY_DIRS})
include_directories(${OpenCV_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
${GAZEBO_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${OGRE-Terrain_INCLUDE_DIRS}
include)
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
###################################
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp rospy image_transport std_msgs sensor_msgs geometry_msgs message_runtime gazebo_ros
)
################# 1. A system plugin for gazebo to initialize ROS #############
add_library( plugin_ros_init SHARED
src/plugin_ros_init.cpp
)
target_link_libraries( plugin_ros_init
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
${OGRE_LIBRARY_DIRS}
)
set_target_properties( plugin_ros_init
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_SOURCE_DIR}/plugins
)
################## 2. A simple model controller for the quadrotor #############
add_library( plugin_drone SHARED
src/plugin_drone.cpp
src/pid_controller.cpp
include/plugin_drone.h
include/pid_controller.h
)
target_link_libraries( plugin_drone
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
)
set_target_properties( plugin_drone
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_SOURCE_DIR}/plugins
)
################## 3. A IMU sensor plugin for the quadrotor ####################
add_library( plugin_ros_imu SHARED
src/plugin_ros_imu_native.cpp
include/plugin_ros_imu_native.h
)
target_link_libraries( plugin_ros_imu
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
)
set_target_properties( plugin_ros_imu
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_SOURCE_DIR}/plugins
)
################# 4. A sensor plugin for the camera #########################
add_library( plugin_ros_cam SHARED
src/plugin_ros_cam.cpp
src/util_ros_cam.cpp
include/plugin_ros_cam.h
include/util_ros_cam.h
)
target_link_libraries( plugin_ros_cam
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
${OGRE_LIBRARY_DIRS}
CameraPlugin
)
set_target_properties( plugin_ros_cam
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_SOURCE_DIR}/plugins
)
################# 5. A program using the keyboard to control the quadrotor #####
set(CMAKE_AUTOUIC ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
set(QT_LIBRARIES Qt5::Widgets)
qt5_wrap_cpp(QT_MOC include/DialogKeyboard.h)
qt5_add_resources(RESOURCES include/drone_keyboard.qrc)
add_executable( drone_keyboard
src/DialogKeyboard.cpp
src/drone_object_ros.cpp
src/drone_keyboard.cpp
${RESOURCES}
${QT_MOC}
)
target_link_libraries( drone_keyboard
${QT_LIBRARIES}
${catkin_LIBRARIES}
)
################## 7. A sonar sensor plugin for the quadrotor ####################
add_library( plugin_ros_sonar SHARED
src/plugin_ros_sonar.cpp
include/plugin_ros_sonar.h
)
target_link_libraries( plugin_ros_sonar
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
)
set_target_properties( plugin_ros_sonar
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_SOURCE_DIR}/plugins
)
################## 8. A laser sensor plugin for the quadrotor ####################
#add_library( plugin_ros_laser SHARED
# src/plugin_ros_laser.cpp
# include/plugin_ros_laser.h
#)
#target_link_libraries( plugin_ros_laser
# ${catkin_LIBRARIES}
# ${GAZEBO_LIBRARIES}
#)
#set_target_properties( plugin_ros_laser
# PROPERTIES
# LIBRARY_OUTPUT_DIRECTORY
# ${PROJECT_SOURCE_DIR}/plugins
#)
install(DIRECTORY bin
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY include
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY meshes
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY models
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY plugins
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY scripts
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY src
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY worlds
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
find_package(PCL 1.2 REQUIRED)
include_directories(${catkin_LIBRARIES} ${PCL_INCLUDE_DIRS} /usr/include/pcl-1.10/ /usr/include/eigen3/)
# include_directories(/usr/include/pcl-1.10 /usr/include/eigen3 ${PCL_INCLUDE_DIRS})
link_directories( ${PCL_LIBRARY_DIRS})
# link_directories(/usr/lib/x86_64-linux-gnu ${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(listener scripts/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES} ${PCL_LIBRARIES} /usr/include/pcl-1.10/ /usr/include/eigen3/)