In order to successfully build a node that uses a nodelet for transport, we have to fix a lot of things when using catkin_create_pkg : 1. CMakeList.txt 2. package.xml 3. nodelet_plugin.xml 4. main.cpp Explain in order: 1. CMakeList.txt Pay special attention to adding a nodelet ``` code Cmake_minimum_required(VERSION 2.8.3) Project(lidars_grabber_nodelet) Find_package(catkin REQUIRED COMPONENTS Nodelet Roscpp Rospy Std_msgs ) # Because the nodelet is referenced as a lib, so add this paragraph Add_library(${PROJECT_NAME} Src/lidars_grabber_nodelet.cpp ) #把 nodelet as a dependent library If(catkin_EXPORTED_LIBRARIES) Add_dependencies(lidars_grabber_nodelet ${catkin_EXPORTED_LIBRARIES}) Endif() # Remember to attach nodelet_plugins.xml # nodelet_plugins.xml is manually added Install(FILES # myfile1 # myfile2 Nodelet_plugins.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) ``` 2. package.xml In addition to the build_depen
不定時更新學習的新事物與大家分享! (主力在 Python, 遊戲化與教育。)