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),显示以下界面,没有任何报错提示,就是没有编译功能包,心态有点炸啊啊啊:
 1 xy@xy:~/catkin_ws$ catkin_make
 2 Base path: /home/xy/catkin_ws
 3 Source space: /home/xy/catkin_ws/src
 4 Build space: /home/xy/catkin_ws/build
 5 Devel space: /home/xy/catkin_ws/devel
 6 Install space: /home/xy/catkin_ws/install
 7 ####
 8 #### 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"
 9 ####
10 -- The C compiler identification is GNU 5.4.0
11 -- The CXX compiler identification is GNU 5.4.0
12 -- Check for working C compiler: /usr/bin/cc
13 -- Check for working C compiler: /usr/bin/cc -- works
14 -- Detecting C compiler ABI info
15 -- Detecting C compiler ABI info - done
16 -- Detecting C compile features
17 -- Detecting C compile features - done
18 -- Check for working CXX compiler: /usr/bin/c++
19 -- Check for working CXX compiler: /usr/bin/c++ -- works
20 -- Detecting CXX compiler ABI info
21 -- Detecting CXX compiler ABI info - done
22 -- Detecting CXX compile features
23 -- Detecting CXX compile features - done
24 -- Using CATKIN_DEVEL_PREFIX: /home/xy/catkin_ws/devel
25 -- 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
26 -- 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
27 -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2") 
28 -- Using PYTHON_EXECUTABLE: /usr/bin/python2
29 -- Using Debian Python package layout
30 -- Using empy: /usr/bin/empy
31 -- Using CATKIN_ENABLE_TESTING: ON
32 -- Call enable_testing()
33 -- Using CATKIN_TEST_RESULTS_DIR: /home/xy/catkin_ws/build/test_results
34 -- Found gtest sources under '/usr/src/gmock': gtests will be built
35 -- Found gmock sources under '/usr/src/gmock': gmock will be built
36 -- Found PythonInterp: /usr/bin/python2 (found version "2.7.12") 
37 -- Looking for pthread.h
38 -- Looking for pthread.h - found
39 -- Looking for pthread_create
40 -- Looking for pthread_create - not found
41 -- Looking for pthread_create in pthreads
42 -- Looking for pthread_create in pthreads - not found
43 -- Looking for pthread_create in pthread
44 -- Looking for pthread_create in pthread - found
45 -- Found Threads: TRUE  
46 -- Using Python nosetests: /usr/bin/nosetests-2.7
47 -- catkin 0.7.20
48 -- BUILD_SHARED_LIBS is on
49 -- Configuring done
50 -- Generating done
51 -- Build files have been written to: /home/xy/catkin_ws/build
52 ####
53 #### Running command: "make -j12 -l12" in "/home/xuyang/catkin_ws/build"
54 ####
  1. 使用catkin build替代catkin_make进行编译可以暂时避免它,如果又遇到catkin:command not found的情况,可以通过以下命令解决:
1 sudo apt-get update
2 sudo apt-get install python-catkin-tools
  1. 编译完成后,在使用roslaunch命令时遇到以下问题:
 1 xy@xy:~/new_ws$ roslaunch maze_solver main.launch 
 2 ... logging to /home/xy/.ros/log/16438e56-a869-11ea-8090-e86a642b9771/roslaunch-xy-13728.log
 3 Checking log directory for disk usage. This may take awhile.
 4 Press Ctrl-C to interrupt
 5 Done checking log file disk usage. Usage is <1GB.
 6 
 7 started roslaunch server http://xy:41011/
 8 
 9 SUMMARY
10 ========
11 
12 PARAMETERS
13  * /rosdistro: kinetic
14  * /rosversion: 1.12.14
15 
16 NODES
17   /
18     lidar_process (maze_solver/LidarProcess.py)
19     main_node (maze_solver/MainNode.py)
20     state_controller (maze_solver/StateController.py)
21 
22 auto-starting new master
23 process[master]: started with pid [13738]
24 ROS_MASTER_URI=http://localhost:11311
25 
26 setting /run_id to 16438e56-a869-11ea-8090-e86a642b9771
27 process[rosout-1]: started with pid [13767]
28 started core service [/rosout]
29 ERROR: cannot launch node of type [maze_solver/StateController.py]: can't locate node [StateController.py] in package [maze_solver]
30 ERROR: cannot launch node of type [maze_solver/LidarProcess.py]: can't locate node [LidarProcess.py] in package [maze_solver]
31 ERROR: cannot launch node of type [maze_solver/MainNode.py]: can't locate node [MainNode.py] in package [maze_solver]

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

1 sudo chmod -R 777 *

原文链接: https://www.cnblogs.com/mickeyyang/p/13262478.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;

也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬

    ubuntu16.04下ros中catkin_make命令失效

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/353609

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年3月2日 上午8:10
下一篇 2023年3月2日 上午8:11

相关推荐