forked from matthias-mayr/Cartesian-Impedance-Controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (99 loc) · 3.81 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
cmake_minimum_required(VERSION 2.8.3)
cmake_policy(SET CMP0048 NEW) # Version not in project() command
project(cartesian_impedance_controller)
find_package(Boost 1.49 REQUIRED)
find_package(PkgConfig)
# Find RBDyn library and dependencies
pkg_search_module(Eigen3 REQUIRED eigen3)
pkg_check_modules(mc_rbdyn_urdf REQUIRED mc_rbdyn_urdf)
pkg_check_modules(RBDyn REQUIRED RBDyn)
pkg_check_modules(SpaceVecAlg REQUIRED SpaceVecAlg)
pkg_check_modules(tinyxml2 REQUIRED tinyxml2)
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
control_msgs
controller_interface
controller_manager
dynamic_reconfigure
eigen_conversions
geometry_msgs
hardware_interface
message_generation
pluginlib
realtime_tools
roscpp
sensor_msgs
std_msgs
tf
tf_conversions
trajectory_msgs
)
add_message_files(FILES
ControllerConfig.msg
ControllerState.msg
)
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
sensor_msgs
)
generate_dynamic_reconfigure_options(
cfg/damping.cfg
cfg/stiffness.cfg
cfg/wrench.cfg
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS actionlib actionlib_msgs control_msgs controller_interface controller_manager dynamic_reconfigure eigen_conversions geometry_msgs hardware_interface message_runtime pluginlib realtime_tools roscpp sensor_msgs std_msgs tf tf_conversions trajectory_msgs
DEPENDS Boost Eigen3 mc_rbdyn_urdf RBDyn SpaceVecAlg tinyxml2
LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_ros
)
###########
## Build ##
###########
# Sets build type to "Release" in case no build type has not been set before. This is necessary to run this controller at 1 kHz.
# On our RT system with an i5 11th Gen processor this reduces update evaluations from about 800 to 300 microseconds
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
# Core library
add_library(${PROJECT_NAME} src/cartesian_impedance_controller.cpp)
add_dependencies(
${PROJECT_NAME}
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
target_compile_options(${PROJECT_NAME} PUBLIC -std=c++14)
target_include_directories(${PROJECT_NAME} PUBLIC include ${catkin_INCLUDE_DIRS} ${Eigen3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${SpaceVecAlg_INCLUDE_DIRS} ${RBDyn_INCLUDE_DIRS} ${mc_rbdyn_urdf_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Eigen3_LIBRARIES})
# ROS Integration
add_library(${PROJECT_NAME}_ros src/cartesian_impedance_controller_ros.cpp)
add_dependencies(
${PROJECT_NAME}_ros
${${PROJECT_NAME}_ros_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
${PROJECT_NAME}_gencfg
)
target_compile_options(${PROJECT_NAME}_ros PUBLIC -std=c++14)
target_include_directories(${PROJECT_NAME}_ros PUBLIC include ${catkin_INCLUDE_DIRS} ${Eigen3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${tinyxml2_INCLUDE_DIRS} ${SpaceVecAlg_INCLUDE_DIRS} ${RBDyn_INCLUDE_DIRS} ${mc_rbdyn_urdf_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME}_ros PUBLIC ${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${tinyxml2_LIBRARIES} RBDyn mc_rbdyn_urdf ${Eigen3_LIBRARIES})
## Install project namespaced headers
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)
## Testing
if (CATKIN_ENABLE_TESTING)
# Base library tests
find_package(rostest REQUIRED)
add_rostest_gtest(base_tests test/base.test test/base_tests.cpp)
target_link_libraries(base_tests ${PROJECT_NAME} ${Eigen3_LIBRARIES} ${catkin_LIBRARIES})
# ROS basic tests
add_rostest_gtest(ros_tests test/ros.test test/ros_tests.cpp)
target_link_libraries(ros_tests ${PROJECT_NAME} ${Eigen3_LIBRARIES} ${catkin_LIBRARIES})
# ROS functionality tests
add_rostest_gtest(ros_func_tests test/ros_func.test test/ros_func_tests.cpp)
target_link_libraries(ros_func_tests ${PROJECT_NAME} ${Eigen3_LIBRARIES} ${catkin_LIBRARIES})
endif()