(报错)ROS2:WARNING:colcon.colcon_core.package_selection:ignoring unknown package
在使用colcon编译时,如果直接对所有包编译
colcon build
则不会有问题,但是针对单独某个包编译
colcon build --packages-select <pkg>
则报错
WARNING:colcon.colcon_core.package_selection:ignoring unknown package
gg了一下找到了问题
参考:https://unix.stackexchange.com/questions/616752/colcon-can-not-find-my-package
就是package.xml里面的包名错了(<name>那一行)
修改之后重新编译,又报错
CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:53 (message): ament_package_xml() package name 'pkg_tf_listener' in '/package.xml' does not match current PROJECT_NAME 'tf_listener'. You must call project() with the same package name before. Call Stack (most recent call first): /opt/ros/foxy/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml) CMakeLists.txt:50 (ament_lint_auto_find_test_dependencies)
package.xml已经修改好,剩下就只能是cmakelists.txt的问题了,打开发现果然项目名还没同步改好
修改好成功编译!