错误1 -- 在编译工作空间的时候,没有关闭conda环境
https://cloud.tencent.com/developer/ask/sof/128041https://cloud.tencent.com/developer/ask/sof/128041
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/admin1/anaconda3/bin/python3
"/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/noetic/share/catkin/cmake/../package.xml"
"/home/admin1/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
returned error code 1
Call Stack (most recent call first):
/opt/ros/noetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
/opt/ros/noetic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml)
/opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/admin1/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/admin1/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
错误2 -- 使用vscode编写代码时出现无法打开源文件ros/ros.h的错误,是因为没有配置包含路径
#include<sstream>
#include"ros/ros.h"
#include"std_msgs/String.h"
将下面这行include路径添加到包含路径中
/opt/ros/noetic/include/**
然后会生成.vscode里的一个配置文件
错误3 -- 无法用rosrun启动Publisher
admin1@admin1-System-Product-Name:~/catkin_ws$ rosrun learning_communication talker
[rospack] Error: package 'learning_communication' not found
在这之前先在终端中cd到工作空间,再设置环境变量(这种设置是当前终端的)
source ./devel/setup.bash
错误4 -- 添加消息生成依赖的功能包
错误示范:
<run_depend>message_runtime</run_depend>
运行:
rosmsg show Person
结果:
Error(s):
- The manifest of package "learning_communication" (with format version 2) must not contain the following tags: run_depend
- Please replace <run_depend> tags with <exec_depend> tags.
根据提示更改package.xml中相应的消息:
<exec_depend>message_runtime</exec_depend>
错误5 -- 学习到自定义话题时碰到了使用catkin_make命令编译的报错
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:196 (message):
catkin_package() the catkin package 'geometry_msgs' has been
find_package()-ed but is not listed as a build dependency in the
package.xml
CMake Error at /opt/ros/noetic/share/genmsg/cmake/genmsg-extras.cmake:197 (message):
generate_messages() must be called before catkin_package() in project
'learning_communication'
CMake Error at learning_communication/CMakeLists.txt:178 (add_dependencies):
The dependency target "learning_communication_generate_messagess_cpp" of
target "listener" does not exist.
CMake Error at learning_communication/CMakeLists.txt:173 (add_dependencies):
The dependency target "learning_communication_generate_messagess_cpp" of
target "talker" does not exist.
第一个错误参考
按照提示package.xml中没有geometry_msgs,添加上就行了:
<build_depend>geometry_msgs</build_depend>
<exec_depend>geometry_msgs</exec_depend>
第二个错误参考
按照提示将这两个函数的顺序颠倒一下(书上这几个函数的顺序并不对)
后面两个错误参考(这个错误还没有具体搞懂,直接往下搞!)