forked from freefloating-gazebo/freefloating_gazebo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·156 lines (128 loc) · 4.59 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
cmake_minimum_required(VERSION 2.8.3)
project(freefloating_gazebo)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
find_package(gazebo)
if(gazebo_FOUND)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
std_srvs
gazebo_msgs
geometry_msgs
sensor_msgs
urdf
control_toolbox
rostime
nav_msgs
message_generation
)
else()
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
std_srvs
geometry_msgs
sensor_msgs
urdf
control_toolbox
rostime
nav_msgs
message_generation
)
endif()
find_package(Eigen3)
if(NOT EIGEN3_FOUND)
# Fallback to cmake_modules
find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
else()
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
add_service_files(
FILES
ControlType.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
INCLUDE_DIRS include ${EIGEN3_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME} ffg_pid
CATKIN_DEPENDS
roscpp
std_msgs
std_srvs
gazebo_msgs
geometry_msgs
sensor_msgs
control_toolbox
rostime
nav_msgs
message_runtime
)
include_directories(include ${Boost_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS})
add_library(freefloating_gazebo
include/freefloating_gazebo/butterworth.h
include/freefloating_gazebo/hydro_link.h src/hydro_link.cpp
include/freefloating_gazebo/hydro_model_parser.h src/hydro_model_parser.cpp
include/freefloating_gazebo/thruster_allocator.h src/thruster_allocator.cpp)
target_link_libraries(freefloating_gazebo ${catkin_LIBRARIES})
add_library(ffg_pid
include/freefloating_gazebo/butterworth.h
src/freefloating_pids.cpp include/freefloating_gazebo/freefloating_pids.h
src/freefloating_pids_body.cpp include/freefloating_gazebo/freefloating_pids_body.h
src/freefloating_pids_joint.cpp include/freefloating_gazebo/freefloating_pids_joint.h)
target_link_libraries(ffg_pid ${catkin_LIBRARIES} ${PROJECT_NAME})
add_dependencies(ffg_pid ${${PROJECT_NAME}_EXPORTED_TARGETS})
add_dependencies(ffg_pid freefloating_gazebo_gencpp)
# node to perform PID control for body (thrusters) and joints
add_executable(pid_control src/pids/pid_body_joints.cpp)
target_link_libraries(pid_control ffg_pid)
# node to perform PID control for body only (no joints)
add_executable(pid_body src/pids/pid_body.cpp)
target_link_libraries(pid_body ffg_pid)
# node to perform PID control for joints only (no body)
add_executable(pid_joints src/pids/pid_joints.cpp)
target_link_libraries(pid_joints ffg_pid)
if(gazebo_FOUND)
link_directories(${GAZEBO_LIBRARY_DIRS})
include_directories(${GAZEBO_INCLUDE_DIRS})
# world plugin to simulate buoyancy and viscous force
add_library(freefloating_gazebo_fluid src/freefloating_gazebo_fluid.cpp include/freefloating_gazebo/freefloating_gazebo_fluid.h)
target_link_libraries(freefloating_gazebo_fluid ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
# model plugin subscribes to body and joint efforts and applies them in Gazebo
add_library(freefloating_gazebo_control src/freefloating_gazebo_control.cpp
include/freefloating_gazebo/freefloating_gazebo_control.h)
target_link_libraries(freefloating_gazebo_control ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES} ${PROJECT_NAME})
install(TARGETS freefloating_gazebo_fluid
freefloating_gazebo_control
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY world
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
# test Butterworth filter
add_executable(butter test/testButter.cpp)
target_link_libraries(butter ${catkin_LIBRARIES})
# test thruster mapper
add_executable(sdf_parse test/sdf_parse.cpp)
target_link_libraries(sdf_parse ${catkin_LIBRARIES} ${catkin_LIBRARIES} ${PROJECT_NAME})
endif()
install(TARGETS pid_control pid_joints pid_body ffg_pid ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(DIRECTORY scripts
srv
gui
launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
catkin_install_python(PROGRAMS scripts/surface.py scripts/rviz_bridge.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )