ExecuteProcess是ROS为launch文件提供的一个非常有用的工具,在前面已经说明过launch_ros.action.node.Node是继承自ExecuteProcess,它其实是launch其他工具基础,很多launch工具与Node一样,都是继承自ExecuteProcess,而且ExecuteProcess是更加底层的一个launch工具接口,它可以实现更加灵活的功能,不再简单限定于节点启动,目前的资料较少提及ExecuteProcess,关于它的使用方式就更加少,下面对其进行介绍。
ExecuteProcess的继承关系与物理位置
ExecuteProcess是一个类,位于launch这个package中,具体位置为launch/action/execute_process.py中。在execute_process.py中,ExecuteProcess类的声明如下图所示:

这说明ExecuteProcess类继承自ExecuteLocal类,ExecuteLocal类位于executal_local.py中。所以ExecuteProcess类与execute_process.py和executal_local.py有关。
ExecuteLocal类又继承自Action类

Action类又继承自LaunchDescriptionEntity类

LaunchDescriptionEntity类不再有继承关系,也就是它是最内核的类。

所以ExecuteProcess类在最底层与action.py和launch_description_entity.py文件有关。

在外层与action文件夹中的execute_process.py和executal_local.py有关。

要查看ExecuteProcess类中的主要参数,就要看一下它的定义了,由于ExecuteProcess类继承自ExecuteLocal类,所以这两类的定义都需要看一下。在ExecuteProcess类中最基本的参数是cmd。



使用ExecuteProcess实现节点启动
下面通过一个实例说明使用ExecuteProcess类实现节点启动的过程。

最低0.47元/天 解锁文章
2万+

被折叠的 条评论
为什么被折叠?



