ROS报错处理(持续更新)

1、运行节点时报错:

[rospack] Error: package 'test' not found

没有找到ros功能包,原因是没有为功能包配置系统环境,可以利用source运行工作空间中devel目录下的setup.bash配置文件并使配置立即生效。setup.bash脚本的作用是让一些ros* 开头的命令可以使用,同时还能够创建一些ROS开头的环境变量eg:ROS_PACKAGE_PATH。在命令行中可以使用echo在~/.bashrc文件中追加以下内容:echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc

 

2、Could not find a package configuration file provided by "moveit_ros_planning" with any of the following names:
 
        moveit_ros_planningConfig.cmake
        moveit_ros_planning-config.cmake

没有安装moveit,可以使用sudo apt-get install ros-kinetic-moveit-full命令来安装。
 
 

3、运行launch文件时报错:

[robot_spawn.launch] is neither a launch file in package [robot_sim_demo] nor is [robot_sim_demo] a launch file name
The traceback for the exception was written to the log file

不能识别ros功能包中的launch文件,原因是没有修改系统中存放ros功能包路径的环境变量。可以使用如下命令添加路径:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:[path of your ros package]

eg: export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/catkin_ws/src

(export命令修改环境变量的方式也能用来解决source覆盖机制)

还有一种可能,是你修改了ros功能包的名称,但是CMakeLists.txt文件和package.xml文件并不会自动修改。然而两个文件中都有关于功能包名的描述,这种情况下只需要修改两个文件中的功能包名称即可。

 

4、roscore打不开,并报错:

'ascii' codec can't decode byte 0xe6 in position 10: ordinal not in range(128)
The traceback for the exception was written to the log file

注意不要在ubuntu桌面上创建ros包,这是因为ros的包路径不允许出现中文,所有ros包的路径都会被系统自动添加到ROS_PACKAGE_PATH和ROSLISP_PACKAGE_DIRECTORIES环境变量中,导致ros启动时出错。
解决方案是:将桌面上的包移动到其他不包含中文的目录中,或者删除这些包。

 

5、roscore打不开,并报错:

WARNING:ROS_MASTER_URI [http://MSI:11311] host is not set to this machine

原因是在~/.bashrc文件中设置的节点管理器地址不是本机,而是在其他主机上,需要在该主机上打开roscoe或者将节点管理器地址修改为本机(注释掉ROS_MASTER_URI赋值即可,因为默认会将地址设置为本机)。

 

6、使用catkin_make 初始化或编译工作空间时,报错:

CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/home/robot/anaconda3/bin/python
  "/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/kinetic/share/catkin/cmake/../package.xml"
  "/home/robot/ros_practice/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/robot/ros_practice/build/CMakeFiles/CMakeOutput.log".
See also "/home/robot/ros_practice/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

 

这是因为安装了ros之后又安装了anaconda,导致系统将默认python更新为anaconda中安装的版本。然而新安装的anaconda中缺少支持ros的相关依赖包,因此需要使用以下命令安装相关的依赖包:

 conda install setuptools
 pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools

 

7、刚解决完上一个anaconda和ros共存的问题,又发现ros和python3.*不兼容,很多功能包中的python节点只能运行在python2.*中。否则各种报错。

 

8、进行分布式多机通信时,电脑之间互相可以ping通,但是节点之间却不能通信。报错:

[ERROR] [1552348968.995103251]: [registerPublisher] Failed to contact master at [MSI:11311], Retrying...

这是因为防火墙没有关闭,注意参与通信的电脑都需要关闭防火墙。

 

9、roscore启动报错:

WARNING: unable to configure logging. No log files will be generated
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/usr/bin/rosversion", line 11, in
    load_entry_point('rospkg==1.1.9', 'console_scripts', 'rosversion')()
  File "/usr/lib/python2.7/dist-packages/rospkg/rosversion.py", line 109, in main
    path = mm.get_path(args.package)
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 201, in get_path
    self._update_location_cache()
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 184, in _update_location_cache
    list_by_path(self._manifest_name, path, cache)
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 74, in list_by_path
    resource_name = root.findtext('name').strip(' \n\r\t')
AttributeError: 'NoneType' object has no attribute 'strip'
Invalid tag: Cannot load command parameter [rosversion]: command [rosversion roslaunch] returned with code [1].

Param xml is
The traceback for the exception was written to the log file

No handlers could be found for logger "roslaunch"

 

这是因为/usr/lib/python2.7/dist-packages/rospkg路径下的python文件没有可执行权限。进入该路径运行sudo chmod a+x rospack.py和sudo chmod a+x rosversion.py两句命令即可。

 

 

 

 

你可能感兴趣的:(ROS)