[rosrun] Couldn't find executable named example1_a below /home/zwd/Project/ros/catkin_ws/src/chapter

按照《ROS机器人程序设计》这本书2.4.9-2.4.10节创建节点时,遇见上述问题

    [rosrun] Couldn't find executable named example1_a below /home/zwd/Project/ros/catkin_ws/src/chapter2_tutorials 

在网上有相关内容,但没有解决办法,于是自己尝试解决问题。

首先打开该目录的CMakeLists.txt文件,即

    zwd@zwd-virtual-machine:~$ roscd chapter2_tutorials                                                                                           
   
zwd@zwd-virtual-machine:~/Project/ros/catkin_ws/src/chapter2_tutorials$ vim CMakeLists.txt                                   

其中按照书中方法加入的内容为:

    add_executable(chap2_example1_a src/example1_a.cpp)                                                                                        
    add_executable(chap2_example1_b src/example1_b.cpp)                                                                                       

因此猜测这里应该将example1_a改为chap2_example1_a,但是改掉之后问题依然没有解决,故尝试在运行之前都在终端加入文件,即

    zwd@zwd-virtual-machine:~/Project/ros/catkin_ws$ source devel/setup.bash                                                         
    zwd@zwd-virtual-machine:~/Project/ros/catkin_ws$ rosrun chapter2_tutorials chap2_example1_a                            

问题解决





扫描二维码关注公众号,回复: 1668634 查看本文章

猜你喜欢

转载自blog.csdn.net/zwd574011074/article/details/80728843