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

2024-01-08 02:33:01

0.前提

1. (C++)Why did you include the header file of the message file instead of the message file itself?(为包含消息的头文件而不是消息本身?)

回答:msg文件是描述ROS消息字段的文本文件,用于生成不同语言消息的源代码。按官方给的描述,我理解为在编译时要将文本文件转换成源代码,在将他包含进rospy或者roscpp,而直接包含消息本身就无法转换成源代码。

本题答案来源官方文档:ROS/Tutorials/CreatingMsgAndSrv - ROS中文Wiki

2. (Python & C++)In the documentation of the LaserScan message there was also a data type called Header header. What is that? Can you also include it in your message file? What information does it provide? Include Header in your message file too.(在LaserScan消息描述里面有包含叫Header header的消息类型,这是啥?能将他包含进自己的消息文件吗?将他包含进自己的消息文件的话有什么效果?)

1.In the documentation of the LaserScan message there was also a data type called Header header. What is that?(在LaserScan消息描述里面有包含叫Header header的消息类型,这是啥?)

回答:官方文档给出的解释ROS提供了特殊的Header类型,提供了通用机制,在std_msgs/msg/Header.msg(以#include “std_msgs/Header.h”被调用)中被定义。

在这里有别人给出的挺好的定义:ROS中自定义带有header的消息文件_ros header-CSDN博客

2.Can you also include it in your message file?(能将他包含进自己的消息文件吗?)

回答:能,类似于这样:

这里转载自:ros 导入自定义msg文件 配置_怎么把自定义的msg放入rosmsg中-CSDN博客

3.What information does it provide? Include Header in your message file too.(将他包含进自己的消息文件的话有什么效果?)

回答:msg文件包含嘛。

3.答案来源

本题答案来源官方文档:msg - ROS Wiki

文章来源:https://blog.csdn.net/weixin_75067193/article/details/135375341
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。