ROS plugin原理

在costmap_2d 中,大量使用了plugin技术实现可配置的layer和planner,为程序提供了很好的扩展性,而且这种扩展是不需要重新编译就能够实现。
首先来看costmap_2d中使用到的plugin:
bob@bob-Think:~$ rospack plugins --attrib=plugin costmap_2d
costmap_2d /opt/ros/indigo/share/costmap_2d/costmap_plugins.xml
bob@bob-Think:~$ cat /opt/ros/indigo/share/costmap_2d/costmap_plugins.xml
<class_libraries>
  <library path="liblayers">
    <class type="costmap_2d::InflationLayer"  base_class_type="costmap_2d::Layer">
      <description>Inflates obstacles to speed collision checking and to make robot prefer to stay away from obstacles.</description>
    </class>
    <class type="costmap_2d::ObstacleLayer"   base_class_type="costmap_2d::Layer">
      <description>Listens to laser scan and point cloud messages and marks and clears grid cells.</description>
    </class>
    <class type="costmap_2d::StaticLayer"     base_class_type="costmap_2d::Layer">
      <description>Listens to OccupancyGrid messages and copies them in, like from map_server.</description>
    </class>
    <class type="costmap_2d::VoxelLayer"     base_class_type="costmap_2d::Layer">
      <description>Similar to obstacle costmap, but uses 3D voxel grid to store data.</description>
    </class>
  </library>
</class_libraries>

这里注册了4个plugin,正如之前的关于这些类的分析。

然后再将这个plugin配置文件写入到package.xml:

bob@bob-Think:/opt/ros/indigo/share/costmap_2d$ cat package.xml 
<package>
    <name>costmap_2d</name>
    <version>1.12.5</version>
    <description>
        This package provides an implementation of a 2D costmap that takes in sensor data from the world, builds a 2D or 3D occupancy grid of the data (depending on whether a voxel based implementation is used), and inflates costs in a 2D costmap based on the occupancy grid and a user specified inflation radius. This package also provides support for map_server based initialization of a costmap, rolling window based costmaps, and parameter based subscription to and configuration of sensor topics.
    </description>
    <author>Eitan Marder-Eppstein</author>
    <author>David V. Lu!!</author>
    <author>Dave Hershberger</author>
    <author>[email protected]</author>
    <maintainer email="[email protected]">David V. Lu!!</maintainer>
    <maintainer email="[email protected]">Michael Ferguson</maintainer>
    <license>BSD</license>
    <url>http://wiki.ros.org/costmap_2d</url>

    <buildtool_depend>catkin</buildtool_depend>

    <build_depend>cmake_modules</build_depend>
    <build_depend>dynamic_reconfigure</build_depend>
    <build_depend>geometry_msgs</build_depend>
    <build_depend>laser_geometry</build_depend>
    <build_depend>map_msgs</build_depend>
    <build_depend>message_filters</build_depend>
    <build_depend>message_generation</build_depend>
    <build_depend>nav_msgs</build_depend>
    
  • 3
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值