【问题标题】:rosrun does not work after sourcing my own catkin workspace采购我自己的 catkin 工作区后,rosrun 不起作用
【发布时间】:2018-10-06 09:59:24
【问题描述】:

我正在关注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 &lt;any_package&gt;,它会给我以下输出:

Multiple packages found with the same name "my_package":
- my_new_package/my_package
- my_new_package/my_package_2

【问题讨论】:

  • 请更具体!你使用什么操作系统?你的工作空间是什么样的?
  • 普通 Ubuntu 16.04。工作区与教程中的完全相同。
  • 您的链接指向一长串教程步骤/任务。您能否提供一个更具体的链接,指向您遇到问题的本教程的确切部分。这应该会让其他人更容易帮助您找出问题。
  • 好的,我已经更新了链接!
  • 当然,它给出了Multiple packages found with the same name "my_package" ...。我将编辑问题。

标签: bash ros catkin


【解决方案1】:

我假设您的工作空间受到污染。 我假设您只是将my_package 复制到my_package_2,而没有编辑my_package_2 中的package.xml 文件。 tutorial 中并没有真正提到它,因为它假定您使用正确的命令来创建具有唯一包名称的清单文件。 只需按如下方式编辑名称标签:

<name>my_package</name>

<name>my_package_2</name>

在相应的文件夹中。

【讨论】:

  • 如果有帮助,别忘了将答案标记为正确!
【解决方案2】:
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}
 )

【讨论】:

    猜你喜欢
    • 2015-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-22
    • 2017-08-17
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多