ROS那些坑

在此开一个专题,用来记录在使用ROS过程中遇到的问题(大坑)以及解决方法。

安装过程中的一些坑

我的是Ubuntu16.04,ROS安装对应版本kinetic。安装直接参考ROS官网:http://wiki.ros.org/kinetic/Installation
安装过程中出现的问题:
在进行sudo rosdep init的时候,出现了DistributionNotFound: The ‘rosdep==0.19.0’ distribution was not found and is required by the application的报错。查资料有人说是因为安装了多个版本的Python,重新安装 Python3.5 版本的 rosdep。但是按这个方法后导致bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录,也就四setup.bash文件没了,无奈只得重新安装ROS。
卸载ROS:

sudo apt-get remove ros-kinetic-*

解决方法:ROS默认支持的Python版本为2.7,在sudo rosdep init之前,要把Python版本切换到2.7的版本,方法参考上面的切换回Python2。

还有个大坑是sudo rosdep init出现报错: ERROR: unable to process source https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/xxxxx
解决方法:

#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133  raw.githubusercontent.com
#保存后退出再尝试

该方法参考了:链接
然后按官网安装教程再来一遍,就OK了

使用工具中的一些坑

rqt_plot

在使用rqt_plot的时候报错:

/usr/lib/python2.7/dist-packages/matplotlib/axis.py:1015: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.
  warnings.warn("Unable to find pixel distance along axis "
/usr/lib/python2.7/dist-packages/matplotlib/axis.py:1025: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.
  warnings.warn("Unable to find pixel distance along axis "

网上有人说是matplotlib的版本太老导致的,但是我升级了Python2对应的最新版的matplotlib这个问题依旧存在。不过还是找到了折中的一种解决方法:
直接在命令行里运行rqt,会弹出rqt的GUI,然后在GUI里面选择plugins->Visualization->Plot。
在这里插入图片描述
注:参考https://answers.ros.org/question/347215/cant-run-graph-with-command-rosrun-rqt_plot-rqt_plot/

猜你喜欢

转载自blog.csdn.net/weixin_44456692/article/details/106185360