ROS:新手使用VScode过程中用launch文件进行多节点运行时遇到ERROR: cannot launch node of type
刚刚学ROS,遇到这个问题百度看了以下,用他们 办法解决不了,在我探索一会儿解决了,分享给大家。
下面展示一些 内联代码片
。
//
ERROR: cannot launch node of type [hello_vscode/hello _vscode_c]: Cannot locate node of type [hello _vscode_c] in package [hello_vscode]. Make sure file exists in package path and permission is set to executable (chmod +x)
//
ERROR: cannot launch node of type [hello_vscode/hello _vscode_c]: Cannot locate node of type [hello _vscode_c] in package [hello_vscode]. Make sure file exists in package path and permission is set to executable (chmod +x)
在学习时为了自己弄懂并没有完全根据奥特学院做,他说的是type后面写的是rsc下的那个cpp文件名字,我也就是这样做的,但所运行就有错误,说找不到这个包。原因是CMakeLists.txt这个文件中给文件映射的名字不一样。
下面展示一些 内联代码片
。
// add_executable(baba src/hello_vscode_c.cpp)
//
add_executable(baba src/hello_vscode_c.cpp)
我这里写的是baba所以报出上面的错误,我将type=“baba”,再执行就正常了。
{
auto-starting new master
process[master]: started with pid [26279]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to f439e7fc-37d6-11ec-b58c-3cf01147c0f2
process[rosout-1]: started with pid [26290]
started core service [/rosout]
process[t1-2]: started with pid [26293]
process[key1-3]: started with pid [26299]
process[hello-4]: started with pid [26300]
[ INFO] [1635415690.817274596]: hello,哈哈哈哈
[hello-4] process has finished cleanly
log file: /home/sun/.ros/log/f439e7fc-37d6-11ec-b58c-3cf01147c0f2/hello-4*.log
[t1-2] process has finished cleanly
log file: /home/sun/.ros/log/f439e7fc-37d6-11ec-b58c-3cf01147c0f2/t1-2*.log
}
总结,pkg是你工程的名字, type是你在CMakeLists.txt文件中映射的名字。