代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.8)
project(imu_ros2)
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(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_library(LIBIIO_LIBRARIES iio)
find_path(LIBIIO_INCLUDE_DIRS iio.h)
file(GLOB FILES_H ${CMAKE_SOURCE_DIR}/include/*.h
${CMAKE_SOURCE_DIR}/include/imu_ros2/*.h)
file(GLOB FILES_CPP ${CMAKE_SOURCE_DIR}/src/*.cpp)
add_executable(imu_ros2_node ${FILES_H} ${FILES_CPP})
target_include_directories(imu_ros2_node PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(imu_ros2_node PUBLIC cxx_std_17) # Require C++17
ament_target_dependencies(imu_ros2_node rclcpp geometry_msgs std_msgs sensor_msgs ament_cmake )
target_link_libraries(imu_ros2_node iio)
install(TARGETS imu_ros2_node
DESTINATION lib/${PROJECT_NAME})
rosidl_generate_interfaces(imu_ros2
"msg/ImuIdentificationData.msg"
"msg/VelAngTempData.msg"
"msg/Imu1650xDiagData.msg"
"msg/ImuFullMeasuredData.msg"
"msg/AccelGyroTempData.msg"
"msg/Imu1657xDiagData.msg"
DEPENDENCIES builtin_interfaces geometry_msgs
)
rosidl_target_interfaces(imu_ros2_node
${PROJECT_NAME} "rosidl_typesupport_cpp")
ament_export_dependencies(rosidl_default_runtime)
target_link_libraries(imu_ros2_node "${imu_ros2_node}")
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_gtest REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
#ament_add_gtest(iio_ros2_test_node test/utest_launch.test test/src/utest.cpp)
add_subdirectory(test)
endif()
install(FILES config/imu16505_config.yaml DESTINATION config)
install(FILES config/imu1657x_config.yaml DESTINATION config)
ament_package()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。