ROS学习笔记(7)进一步深入了解ROS第一步

0.前提

        最近在学习宾夕法尼亚大学工程学院的ROS公开课,在尽力的去融入全英语的环境(哪怕我的英语水准并不是很高)。既然是在学习,笔记也就是必须的了,当然这些笔记都是课程当中提出的问题,我去寻找后得出的答案,可能并不是最准确的,请一定要认真辨别。

1. (Python & C++) What is a CMakeList? Is it related to a make file used for compiling C++ objects? If yes then what is the difference between the two?(什么是CMakeList?是否作用于c++文件的编译?python和c++文件的编译有何区别?)

1.What is a CMakeList?(什么是CMakeList?)

1.CMakeLists.txt 

        CMakeLists.txt用于构建软件包的 CMake 构建系统的输入。任何符合CMake 的包都包含一个或多个 CMakeLists.txt 文件,用于描述如何生成代码以及将其安装到的位置。用于 catkin 项目的 CMakeLists.txt 文件是一个标准的 CMakeLists.txt 文件,具有一些附加约束。(通俗了讲就是记录了功能包的编译规则。)

2.CMakeLists.txt 文件格式

1.CMake版本:cmake_minimum_required()

2.包名:project()

3.构建所需的其他CMake/Catkin软件包:find_package()

4.开启Python模块支持:catkin_python_setup()

5.消息/服务/操作生成器:add_message_files()、add_service_files()、add_action_files()

6.调用消息/服务/操作生成:generate_messages()

7.指定包构建信息导出 catkin_package()

8.构建的库/可执行文件 add_library()/add_executable()/target_link_libraries()

9.构建测试:catkin_add_gtest()

10.安装规则:install()

详情请查阅ROS官方文档(查看官方资料比网络流传更重要)catkin/CMakeLists.txt - ROS Wiki

2.Is it related to a make file used for compiling C++ objects?(是否作用于c++文件的编译?)

是的,作用于C++文件的编译。

3.If yes then what is the difference between the two?(python和c++文件的编译有何区别?)

Python代码没有使用add_library()和 add_executable()函数

2. (Python & C++) Are you using CMakeList.txt for Python in ROS? Is there a executable object being created for Python?(在ROS中对python文件会使用CMakeList.txt吗?是否为Python创建了可执行对象?)

1.Are you using CMakeList.txt for Python in ROS?(在ROS中对python文件会使用CMakeList.txt吗?)

会的,但我目前还未经历过要使用的情况(我资历太浅)。

2.Is there a executable object being created for Python?(是否为Python创建了可执行对象?)

创建了。

3. (Python & C++) In which directory would you run catkin make?(catkin_make在哪使用?)

在工作空间路径(也就是ws的位置)

4. (Python & C++) The following commands were used in the tutorial:

       $ source / opt / ros / kinetic ( melodic )/ setup . bash

       $ source devel / setup . bash

Why do we need to source setup.bash? What does it do? Why do we have to different setup.bash files here and what is there difference?(为什么我们要source setup.bash?如何做?为什么两者不同?不同在哪?)

设置环境变量 (source devel/setup.bash)是为了系统能够找到这个工作空间,Ubuntu默认使用的终端是bash,需要在bash中设置ros环境变量,最好把它放在家目录的.bashrc目录下,以便系统启动时能够执行其中的source /opt/ros/kinetic/setup.bash指令,使得工作空间中的环境变量可以生效,这样系统终端能够读懂ros命令,执行相应的操作。

  • 20
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值