ubuntu16.04下ros中catkin_make命令失效

在一次ros工程功能包的编译过程中,像往常一样,在catkin_ws目录下使用了catkin_make命令,却突然遇到了自己新添加的功能包无法正常编译的bug。
初步怀疑可能是因为在系统里装了anaconda,gym-gazebo,opencv以及一些深度学习环境,导致某些包之间发生了冲突???但是排查了好久,检查了好多遍环境变量的设置,依旧未果(希望有懂的大佬不吝赐教呀)。
现在暂时找到了可以避免这个问题的方法,记录之:

  1. 在此之前,使用catkin_make编译ros工程一切正常。当在工程中加入新的功能包后,再次使用catkin_make命令(先删除根目录下的/devel,/build文件夹,再使用catkin_make),显示以下界面,没有任何报错提示,就是没有编译功能包,心态有点炸啊啊啊:
xy@xy:~/catkin_ws$ catkin_make
Base path: /home/xy/catkin_ws
Source space: /home/xy/catkin_ws/src
Build space: /home/xy/catkin_ws/build
Devel space: /home/xy/catkin_ws/devel
Install space: /home/xy/catkin_ws/install
####
#### Running command: "cmake /home/xy/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/xy/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/xy/catkin_ws/install -G Unix Makefiles" in "/home/xy/catkin_ws/build"
####
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/xy/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/xy/catkin_ws/devel;/home/xy/gazebo_ws/devel;/home/xy/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/xy/catkin_ws/devel;/home/xy/gazebo_ws/devel;/home/xy/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/devel;/opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/xy/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.12") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.20
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xy/catkin_ws/build
####
#### Running command: "make -j12 -l12" in "/home/xuyang/catkin_ws/build"
####
  1. 使用catkin build替代catkin_make进行编译可以暂时避免它,如果又遇到catkin:command not found的情况,可以通过以下命令解决:
sudo apt-get update
sudo apt-get install python-catkin-tools
  1. 编译完成后,在使用roslaunch命令时遇到以下问题:
xy@xy:~/new_ws$ roslaunch maze_solver main.launch 
... logging to /home/xy/.ros/log/16438e56-a869-11ea-8090-e86a642b9771/roslaunch-xy-13728.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://xy:41011/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /
    lidar_process (maze_solver/LidarProcess.py)
    main_node (maze_solver/MainNode.py)
    state_controller (maze_solver/StateController.py)

auto-starting new master
process[master]: started with pid [13738]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 16438e56-a869-11ea-8090-e86a642b9771
process[rosout-1]: started with pid [13767]
started core service [/rosout]
ERROR: cannot launch node of type [maze_solver/StateController.py]: can't locate node [StateController.py] in package [maze_solver]
ERROR: cannot launch node of type [maze_solver/LidarProcess.py]: can't locate node [LidarProcess.py] in package [maze_solver]
ERROR: cannot launch node of type [maze_solver/MainNode.py]: can't locate node [MainNode.py] in package [maze_solver]

只要对功能包下的源码或者脚本文件给予777权限即可解决:

sudo chmod -R 777 *

你可能感兴趣的:(ROS,linux)