forked from kelo-robotics/kelo_tulip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
192 lines (166 loc) · 4.21 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
cmake_minimum_required(VERSION 3.8)
project(kelo_tulip)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
# find_package(rosidl_default_generators REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(kelo_interfaces REQUIRED)
find_package(GSL REQUIRED)
# find_library(SOEM_LIBRARIES NAMES soem)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS thread)
if(WIN32)
set(INCLUDE_DIRS
include
include/kelo_tulip/soem
include/kelo_tulip/soem/osal
include/kelo_tulip/soem/osal/win32
include/kelo_tulip/soem/oshw/win32
${WINPCAP_INCLUDE_DIRS}
)
else(WIN32)
set(INCLUDE_DIRS
include
include/kelo_tulip/soem
include/kelo_tulip/soem/osal
include/kelo_tulip/soem/osal/linux
include/kelo_tulip/soem/oshw/linux
)
endif(WIN32)
include_directories(include)
include_directories(
${INCLUDE_DIRS}
${rclcpp_INCLUDE_DIRS}
# ${rcl_interfaces_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS}
${kelo_interfaces_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS}
${nav_msgs_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
${tf2_INCLUDE_DIRS}
${tf2_ros_INCLUDE_DIRS}
${tf2_geometry_msgs_INCLUDE_DIRS}
)
# Optionally apply cap_net_raw+ep permissions to binary. Requires root previleges.
# Use sudo as default. Still, allow to be configured as environment veriable.
OPTION(USE_SETCAP "Set permissions to access ethernet interface without sudo" ON)
IF("$ENV{SUDO_COMMAND}" STREQUAL "")
SET(SUDO_COMMAND sudo) # default = sudo
ELSE("$ENV{SUDO_COMMAND}" STREQUAL "")
SET(SUDO_COMMAND $ENV{SUDO_COMMAND})
ENDIF("$ENV{SUDO_COMMAND}" STREQUAL "")
add_subdirectory(src/soem)
add_library(tulip_velocity_controller
src/Utils.cpp
src/VelocityPlatformController.cpp
src/PlatformToWheelInverseKinematicsSolver.c
src/SmartWheelKinematics.c
src/KELORobotKinematics.c
)
add_library(tulip_library
src/EtherCATMaster.cpp
src/EtherCATModule.cpp
src/EtherCATModuleROS.cpp
src/PlatformDriver.cpp
src/PlatformDriverROS.cpp
src/modules/RobileMasterBattery.cpp
src/modules/RobileMasterBatteryROS.cpp
src/modules/PowerManagementUnit.cpp
src/modules/PowerManagementUnitROS.cpp
)
target_link_libraries(tulip_library
tulip_velocity_controller
)
add_executable(platform_driver
src/TulipMain.cpp
src/PlatformToWheelInverseKinematicsSolver.c
src/SmartWheelKinematics.c
src/KELORobotKinematics.c
)
ament_target_dependencies(platform_driver
rclcpp
std_msgs
sensor_msgs
geometry_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
kelo_interfaces
)
ament_target_dependencies(tulip_library
rclcpp
std_msgs
sensor_msgs
geometry_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
kelo_interfaces
)
target_link_libraries(platform_driver
tulip_library
tulip_velocity_controller
${Boost_LIBRARIES}
soem
# ${SOEM_LIBRARIES}
pthread
gsl
gslcblas
m
# kelo_interfaces
${kelo_interfaces_LIBRARIES}
)
add_executable(kelo_platform_controller_gz
src/PlatformControllerGZ.cpp
)
ament_target_dependencies(kelo_platform_controller_gz
rclcpp
sensor_msgs
geometry_msgs
Boost
)
target_link_libraries(kelo_platform_controller_gz
tulip_velocity_controller
gsl
gslcblas
)
IF(USE_SETCAP)
add_custom_command(TARGET platform_driver POST_BUILD
COMMAND ${SUDO_COMMAND} setcap cap_net_raw+ep $<TARGET_FILE:platform_driver>
)
endif(USE_SETCAP)
install(TARGETS tulip_library tulip_velocity_controller
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(TARGETS platform_driver kelo_platform_controller_gz
DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
)
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY config/
DESTINATION share/${PROJECT_NAME}/config
)
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(rosidl_default_runtime)
ament_package()