ROS 学习遇到的问题记录(持续更新)

1:使用rqt_plot指令的时候,想要拉动放大界面,发现命令行报错。

​ 解决办法:升级matplot模块

2:使用pip安装matplotlib时候网络超时

​ 解决办法:更换pip镜像源到清华大学

3: 为何有点包在ROS里面没有src下面的源码?

​ 解答:安装包有源码形式与二进制形式的,对于自带的turtlesim的是已经编译好的,所以不能找到源码文件。二进制包里面包括了已经编译完成,可以直接运行的程序。你通过sudo apt-get install来进行下载和解包(安装),执行完该指令后就可以马上使用了。因此这种方式简单快捷,适合比较固定、无需改动的程序。而源代码包里是程序的原始代码,在你的计算机上必须经过编译,生成了可执行的二进制文件,方可运行。一些个人开发的程序、第三方修改或者你希望修改的程序都应当通过源代码包的来编译安装。

4:无法找到ros/ros.h

在CMakeLists.txt里面增加一句


来自于[ros](https://answers.ros.org/question/237494/fatal-error-rosrosh-no-such-file-or-directory/):
```c
From your `CMakeLists.txt` this appears to be more of a CMake problem than really ROS related, but:
>
> > ```
> > cmake_minimum_required(VERSION 2.8.3)
> > project(sphero_move)
> > 
> > ...
> > 
> > find_package(catkin REQUIRED)
> > 
> > include_directories(${catkin_INCLUDE_DIRS})
> > 
> > find_package(catkin REQUIRED COMPONENTS 
> >   ...
> > )
> > ```
>
> This is your problem: you `find_package(..)` the `catkin` package twice. As with other CMake libraries, the second will not necessarily overwrite the first, so it never really does what you want.
>
> Apart from that, you invoke `include_directories(..)` *before* your call to `find_package(catkin ..)` which actually finds the ROS packages you are interested in, and are using. At that point, `catkin_INCLUDE_DIRS` is empty, leading to no changes to the header search path and ultimately the errors you see.
>
> I'd suggest to merge the two `find_package(catkin ..)` calls, keep the `COMPONENTS` and its arguments, and place the `include_directories(..)` line *after* `find_package(catkin ..)` has had a chance to find your dependencies and populate the variable.
>
> Some references: [catkin/CMakeLists.txt](http://wiki.ros.org/catkin/CMakeLists.txt) on the ROS wiki, and [catkin 0.6.18 documentation » How to do common tasks » Package format 2 (recommended)](http://docs.ros.org/indigo/api/catkin/html/howto/format2/index.html) in the Catkin docs (Indigo version). For the second link, see the *C++ catkin library dependencies* and *C++ system library dependencies* sections.
>
> [link](https://answers.ros.org/question/237494/fatal-error-rosrosh-no-such-file-or-directory/?answer=237653#post-id-237653)
>
> ## Comments
>
> That worked. Thanks
>
> [![aldolereste gravatar image](https://www.gravatar.com/avatar/4a32634b282e7a085ee2223479594bab?s=16&d=identicon&r=PG)](https://answers.ros.org/users/27116/aldolereste/)[ aldolereste ](https://answers.ros.org/users/27116/aldolereste/) ( Jun 23 '16 )
>
> add a comment



5:自己新建的mrobot.h头文件没有发现(在vscode里面报错)

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/home/hou/catkin_ws/src/mrobot_bringup/src/mrobot.cpp) will be provided by the Tag Parser.C/C++(1696)
cannot open source file "mrobot_bringup/mrobot.h"C/C++(1696)

解决方法:ctrl+shift+p 调出configuration 文件,在里面添加include 路径: "/home/hou/catkin_ws/src/mrobot_bringup/include/**",

{
    "configurations": [
        {
            "browse": {
                "databaseFilename": "",
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "/home/hou/catkin_ws/devel/include/**",
                "/home/hou/catkin_ws/devel/include/beginner_tutorials/**",
                "/opt/ros/melodic/include/**",
                "/home/hou/catkin_ws/src/beginner_tutorials/include/**",
                "/home/hou/catkin_ws/src/mrobot_bringup/include/**",
                "/usr/include/**"
            ],
            "name": "ROS",
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14"
        }
    ],
    "version": 4
}

20200611

原文地址:https://www.cnblogs.com/robohou/p/13096241.html