关于ROS创建workspace的问题

ubuntu16.04+ROS kinetic

(1)$ mkdir -p ~/catkin_ws/src


(2)$ cd ~/catkin_ws/src


(3)$ catkin_init_workspace


(4)$ cd ~/catkin_ws/


(5)$ catkin_make


然而这一步出现了错误:

ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'

Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.

CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/park/anaconda3/bin/python

  "/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"

  "/opt/ros/kinetic/share/catkin/cmake/../package.xml"

  "/home/park/catkin_ws/build/catkin/catkin_generated/version/package.cmake")

  returned error code 1

Call Stack (most recent call first):

  /opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)

  /opt/ros/kinetic/share/catkin/cmake/all.cmake:163 (_catkin_package_xml)

  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)

  CMakeLists.txt:52 (find_package)

-- Configuring incomplete, errors occurred!

See also "/home/park/catkin_ws/build/CMakeFiles/CMakeOutput.log".

See also "/home/park/catkin_ws/build/CMakeFiles/CMakeError.log".

Invoking "cmake" failed

这是由于python版本与catkin以来版本不一致导致:


python版本


依赖版本

可以看到两者是不一样的,所以我们要安装正确的版本:

$ conda install setuptools


$ pip install -U rosdep rosinstall_generator wstool

然后再执行(5)$ catkin_make 就成功了

(6)此时我们还要将对应的工作空间路径添加到环境变量中去

$ source devel/setup.bash

查看环境变量,$ echo $ROS_PACKAGE_PATH

若出现/home/用户名/工作空间名/src:/opt/ros/kinetic/share 则成功


你可能感兴趣的:(关于ROS创建workspace的问题)