我最近开始使用 ROS 工作,我目前正在我的 Ubuntu 20.04 上安装 Noetic,一切顺利,直到我编译 Turtlebot

问题描述

我编译并安装了 ros wiki 中的所有内容,noetic 安装正确,我通过运行 roscore 命令进行检查,gazebo 也安装正确。然后为了使用turtlebot,我创建了一个Catkin工作区并按照本教程克隆了git存储库:https://emanual.robotis.com/docs/en/platform/turtlebot3/simulation/

运行 cd ~/catkin_ws && catkin_make 命令后出现以下错误

*Base path: /home/areebpc/catkin_ws
Source space: /home/areebpc/catkin_ws/src
Build space: /home/areebpc/catkin_ws/build
Devel space: /home/areebpc/catkin_ws/devel
Install space: /home/areebpc/catkin_ws/install
####
#### Running command: "cmake /home/areebpc/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/areebpc/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/areebpc/catkin_ws/install -G Unix Makefiles" in "/home/areebpc/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/areebpc/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/areebpc/catkin_ws/devel;/opt/ros/noetic
-- This workspace overlays: /home/areebpc/catkin_ws/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5",minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/areebpc/catkin_ws/build/test_results
-- Forcing gtest/gmock from source,though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.5") 
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.9
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
/opt/ros/noetic/share/catkin/cmake/em/order_packages.cmake.em:23: error: <class 'RuntimeError'>: Multiple packages found with the same name "turtlebot3":
- share/turtlebot3
- turtlebot3/turtlebot3
Multiple packages found with the same name "turtlebot3_bringup":
- share/turtlebot3_bringup
- turtlebot3/turtlebot3_bringup
Multiple packages found with the same name "turtlebot3_description":
- share/turtlebot3_description
- turtlebot3/turtlebot3_description
Multiple packages found with the same name "turtlebot3_example":
- share/turtlebot3_example
- turtlebot3/turtlebot3_example
Multiple packages found with the same name "turtlebot3_msgs":
- share/turtlebot3_msgs
- turtlebot3_msgs
Multiple packages found with the same name "turtlebot3_navigation":
- share/turtlebot3_navigation
- turtlebot3/turtlebot3_navigation
Multiple packages found with the same name "turtlebot3_slam":
- share/turtlebot3_slam
- turtlebot3/turtlebot3_slam
Multiple packages found with the same name "turtlebot3_teleop":
- share/turtlebot3_teleop
- turtlebot3/turtlebot3_teleop
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/em.py",line 3302,in <module>
    if __name__ == '__main__': main()
  File "/usr/lib/python3/dist-packages/em.py",line 3300,in main
    invoke(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/em.py",line 3283,in invoke
    interpreter.wrap(interpreter.file,(file,name))
  File "/usr/lib/python3/dist-packages/em.py",line 2295,in wrap
    self.fail(e)
  File "/usr/lib/python3/dist-packages/em.py",line 2284,in wrap
    callable(*args)
  File "/usr/lib/python3/dist-packages/em.py",line 2359,in file
    self.safe(scanner,done,locals)
  File "/usr/lib/python3/dist-packages/em.py",line 2401,in safe
    self.parse(scanner,line 2421,in parse
    token.run(self,line 1425,in run
    interpreter.execute(self.code,line 2595,in execute
    _exec(statements,self.globals,locals)
  File "<string>",line 17,in <module>
  File "/usr/lib/python3/dist-packages/catkin_pkg/topological_order.py",line 147,in topological_order
    for path,package in find_packages(space).items():
  File "/usr/lib/python3/dist-packages/catkin_pkg/packages.py",line 96,in find_packages
    raise RuntimeError('\n'.join(duplicates))
RuntimeError: Multiple packages found with the same name "turtlebot3":
- share/turtlebot3
- turtlebot3/turtlebot3
Multiple packages found with the same name "turtlebot3_bringup":
- share/turtlebot3_bringup
- turtlebot3/turtlebot3_bringup
Multiple packages found with the same name "turtlebot3_description":
- share/turtlebot3_description
- turtlebot3/turtlebot3_description
Multiple packages found with the same name "turtlebot3_example":
- share/turtlebot3_example
- turtlebot3/turtlebot3_example
Multiple packages found with the same name "turtlebot3_msgs":
- share/turtlebot3_msgs
- turtlebot3_msgs
Multiple packages found with the same name "turtlebot3_navigation":
- share/turtlebot3_navigation
- turtlebot3/turtlebot3_navigation
Multiple packages found with the same name "turtlebot3_slam":
- share/turtlebot3_slam
- turtlebot3/turtlebot3_slam
Multiple packages found with the same name "turtlebot3_teleop":
- share/turtlebot3_teleop
- turtlebot3/turtlebot3_teleop
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  
  execute_process(/home/areebpc/catkin_ws/build/catkin_generated/env_cached.sh
  "/usr/bin/python3" "/usr/lib/python3/dist-packages/em.py" "--raw-errors"
  "-F" "/home/areebpc/catkin_ws/build/catkin_generated/order_packages.py"
  "-o" "/home/areebpc/catkin_ws/build/catkin_generated/order_packages.cmake"
  "/opt/ros/noetic/share/catkin/cmake/em/order_packages.cmake.em") returned
  error code 1
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)
  CMakeLists.txt:69 (catkin_workspace)
-- Configuring incomplete,errors occurred!
See also "/home/areebpc/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/areebpc/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" Failed*

我还检查了 CMakeOutput.log 和 CMakeError.log,但我看不出问题出在哪里。

解决方法

安装时,您确定是通过 noetic 安装吗?

  1. cd ~/catkin_ws/src/
  2. git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
  3. cd ~/catkin_ws && catkin_make

如果您遵循此步骤,它应该可以工作。您可以尝试删除并重新安装turtlebot3 文件。确保设置无误。