我正在遵循ROS-tutorial,并且在创建自己的包后面临以下行为:
如果尝试执行任何已安装的软件包(例如any_package
),则会出现以下错误:
[rosrun] Couldn't find executable named <any_package> below /opt/ros/kinetic/share/<any_package>
[rosrun] Found the following, but they're either not files
[rosrun] or not executable:
[rosrun] /opt/ros/kinetic/share/<any_package>
有帮助吗?
编辑:
如果我执行catkin_find --without-underlays --libexec --share <any_package>
,它将得到以下输出:
Multiple packages found with the same name "my_package":
- my_new_package/my_package
- my_new_package/my_package_2
答案 0 :(得分:2)
我假设您的工作区受到污染。
我假设您只是将my_package
复制到my_package_2
,而没有编辑package.xml
中的my_package_2
文件。
tutorial中并没有真正提到它,因为它假定您使用正确的命令来创建带有唯一包名称的清单文件。
只需按如下所示编辑名称标签:
<name>my_package</name>
到
<name>my_package_2</name>
在相应的文件夹中。
答案 1 :(得分:0)
You have to make sure you edit CmakeLists.txt according to your compile version, c++ executable declaration & Specify libraries to link a library
Below are step step modification and then run catkin_make before running your project:
step 1
add_compile_options(-std=c++11)
step 2
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
add_executable(${PROJECT_NAME}_node src/myproject_node.cpp)
step 3
## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}_node
${catkin_LIBRARIES}
)