ros self-built function package operation

Function package renamed

Assume that the original name of the function package is Apkg and needs to be changed to Bpkg.

  • Change the name of the Apkg function package folder to Bpkg

  • Change project(Apkg) in CMakeLists.txt to project(Bpkg)

  • Change <name>Apkg</name> in the Package.xml file to <name>Bpkg</name>. <description>The Apkg package</description> can also be changed

  • Delete the folder named Apkg in the devel/share path of the workspace. The same is true in devel/include and devel/lib. You can also delete the ones in the build. It’s no problem if you don’t delete them.

  • If the function package has compiled both cpp files and custom message files , you must first add the add_executable(node ​​src/node.cpp) and target_link_libraries() corresponding to all cpp files that use custom messages in the CMakeLists.txt file of the function package. node ${catkin_LIBRARIES}) is commented out first. Then catkin_make, uncomment those two sentences, and then move to the next step.

Note: If there are only python files in the function package, you do not need to do this step, but you need to change the path of the code prompt, which is what I mentioned in thisarticle https://blog.csdn.net/qq_35858902/article/details/128998525 settings.json file

Because the cpp file contains the header file for custom messages in the past (#include "Apkg/msgTest.h"), but the previous steps of this header file have been deleted, this header file will not be found when compiling the cpp file and will be compiled. fail. So first comment out those two statements, cancel the compilation of the cpp file, and then compile and generate the custom message header file with catkin_make. Now that you have the header file for the custom message, you can uncomment the commented out ones, include the cpp file, and proceed to the next step.
  • catkin_make can

Remove feature package

Directly delete the entire function package, then delete the folder with the same name as the deleted folder in the devel/share path of the workspace, the same goes for devel/include and devel/lib, and then catkin_make. After deletion, rospack cannot detect it.

Guess you like

Origin blog.csdn.net/qq_35858902/article/details/129030833