红联Linux门户
Linux帮助

rosrun无法执行相应的可执行程序

发布时间:2016-12-04 09:31:58来源:blog.csdn.net/u013832707作者:持久决心
遇到的问题:
在编写ROS程序时,遇到了一个很奇怪的问题:建立好工作区,在工作区的src目录下使用命令catkin_create_pkg创建相应的ROS包并且修改好Cmakelist.txt和package.xml,运行catkin_make没有任何问题。但是source之后,使用rosrun命令时却无法找到相应的可执行程序。
 
解决方法:
是Cmakelist.txt中少了一句话:catkin_package()
本以为这句话并没有任何用处。可是少了这一句话可执行文件将会在build对应的包名下生成,rosrun 找不到该包下的可执行程序;多了这一句话,可执行文件将在devel/lib对应的包名下,可以使用rosrun执行。
搜索了一下基本就是一些入门的教程,解决方法原文如下:
The catkin_package macro is missing in your CMakeLists.txt. Add this after the find_package section:
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for
## your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES compute_cdist
# CATKIN_DEPENDS roscppvisualization_msgs robot_model_helper compute_cdist
# DEPENDS assimp Eigen mlpack
)
(You can remove the comments of course, I just copied the whole block so that the description is contained)
 
本文永久更新地址:http://www.linuxdiyf.com/linux/26549.html