如果要在ROS中订阅imu topic,编写一下CMakeLists.txt文件
时间: 2023-03-07 18:15:11 浏览: 113
CMakeLists.txt编写示例
要在ROS中订阅imu topic,你需要在CMakeLists.txt文件中添加以下内容:# 添加ROS依赖
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs geometry_msgs)# 程序添加
add_executable(imu_subscriber src/imu_subscriber.cpp)# 依赖链接
target_link_libraries(imu_subscriber ${catkin_LIBRARIES})# 声明
catkin_package(
INCLUDE_DIRS include
LIBRARIES imu_subscriber
CATKIN_DEPENDS roscpp rospy std_msgs geometry_msgs
DEPENDS system_lib
)# 安装
install(TARGETS imu_subscriber
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
阅读全文