解决问题命令:
sudo rm -rf $HOME/.ros/rosdep
sudo rm -rf /etc/ros/rosdep```
然后重新安装rosdep
sudo apt-get install python-rosdep
sudo rosdep init
rosdep update```
问题猜测:在出现最开始错误之前,执行了** sudo rosdep update **命令。所以我猜测是因为权限混乱造成的问题。
详细内容
早先执行下面launch命令,可运行成功
roslaunch rosbridge_server rosbridge_websocket.launch```
会启动下面两个节点:
![启动节点](https://img.haomeiwen.com/i3869738/2856b086218add25.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
但是只有rosbridge_websocket运行起来了,rosapi节点没有运行,报如下错误:
Traceback (most recent call last):
File "/opt/ros/indigo/lib/rosapi/rosapi_node", line 36, in <module>
from rosapi import proxy, objectutils, params
File "/opt/ros/indigo/lib/python2.7/dist-packages/rosapi/proxy.py", line 41, in <module>
from ros import rosnode, rosgraph
File "/opt/ros/indigo/lib/python2.7/dist-packages/ros/init.py", line 54, in getattr
roslib.load_manifest(name.split('.')[0])
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslib/launcher.py", line 62, in load_manifest
sys.path = _generate_python_path(package_name, _rospack) + sys.path
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslib/launcher.py", line 93, in _generate_python_path
m = rospack.get_manifest(pkg)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 167, in get_manifest
return self._load_manifest(name)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 211, in _load_manifest
retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self)
File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 412, in parse_manifest_file
_static_rosdep_view = init_rospack_interface()
File "/usr/lib/python2.7/dist-packages/rosdep2/rospack.py", line 58, in init_rospack_interface
lookup = _get_default_RosdepLookup(Options())
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 127, in _get_default_RosdepLookup
verbose=options.verbose)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 607, in create_default
sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 504, in load_cached_sources_list
with open(cache_index, 'r') as f:
IOError: [Errno 13] Permission denied: '/home/cherylpan/.ros/rosdep/sources.cache/index' ```
最后一句才是错误的关键。
尝试解决办法:
sudo rm -fr /home/cherylpan/.ros/rosdep/sources.cache
rosdep update```
但是在更新时出现错误:
ERROR: Rosdep experienced an error: [Errno 13] Permission denied: '/home/cherylpan/.ros/rosdep/sources.cache'
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep
rosdep version: 0.11.5
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 136, in rosdep_main
exit_code = _rosdep_main(args)
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 351, in _rosdep_main
return _no_args_handler(command, parser, options, args)
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 359, in _no_args_handler
return command_handlerscommand
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 545, in command_update
error_handler=update_error_handler)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 453, in update_sources_list
retval.append((source, write_cache_file(sources_cache_dir, source.url, rosdep_data)))
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 531, in write_cache_file
os.makedirs(source_cache_d)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/cherylpan/.ros/rosdep/sources.cache' ```
还是没有解决开始问题,出现了rosdep update更新错误。
解决办法:
sudo rm -rf $HOME/.ros/rosdep
sudo rm -rf /etc/ros/rosdep```
然后重新安装rosdep
sudo apt-get install python-rosdep
sudo rosdep init
rosdep update```
注意:第三步,一定不要使用sudo 来执行rosdep update,这是不被允许的,并且会导致权限错误。详细请看官网:点击打开链接
还有网友直接运行下面命令来解决最初的问题,但是我没有尝试,不知道是否可行:
sudo chmod 777 -R ~/.ros/```
网友评论