如何配置和使用Apollo的component里的plugin

关于如何使用Apollo的Component里的plugin,在Apollo的文档里只有如果和开发的说明却没有找到一个清楚完整说明怎么把plugin跑起来的说明,例如我想把lidar_detection_filter按我们的需求对目标过滤算法作修改然后编译完后,执行

cyber_launch start  modules/perception/lidar_detection_filter/launch/lidar_detection_filter.launch

总是报错说找不到libbackground_filter.so和libroi_boundary_filter.so,而这些so文件在编译后是已经在路径bazel-bin/modules/perception/lidar_detection_filter/object_filter_bank下是有了的

只好去看Apollo的原码,发现cyber/mainboard/mainboard.cc和cyber/mainboard/module_controller.cc里加载plugin的代码是这样的:

cyber/plugin_manager/plugin_manager.cc里看LoadPlugin()的参数就是Plugin描述文件的全路径:

而cyber/mainboard/module_argument.h和cyber/mainboard/module_argument.cc里:

再看cyber_launch的代码所在文件cyber/tools/cyber_launch/cyber_launch.py里在调用mainboard前是如何获取plugin_list的:

上面的代码说明需要在launch文件的module里配置plugin元素,有几个plugin配置几个plugin元素,元素的值是plugin的描述文件pluginx.xml的全路径,例如lidar_detection_filter里的两个plugin在modules/perception/lidar_detection_filter/launch/lidar_detection_filter.launch文件里需要配置如下:

然后执行

cyber_launch start modules/perception/lidar_detection_filter/launch/lidar_detection_filter.launch

两个plugin就正常加载了!

附上modules/perception/lidar_detection_filter/launch/lidar_detection_filter.launch源码:

<!--this file list the modules which will be loaded dynamicly and
    their process name to be running in -->
<cyber>
    <desc>cyber modules list config</desc>
    <version>1.0.0</version>
    <!-- sample module config, and the files should have relative path like
         ./bin/cyber_launch
         ./bin/mainboard
         ./conf/dag_streaming_0.conf -->
    <module>
        <name>lidar_detection_filter</name>
        <dag_conf>/apollo/modules/perception/lidar_detection_filter/dag/lidar_detection_filter.dag</dag_conf>
        <plugin>/apollo/modules/perception/lidar_detection_filter/object_filter_bank/background_filter/plugins.xml</plugin>
        <plugin>/apollo/modules/perception/lidar_detection_filter/object_filter_bank/roi_boundary_filter/plugins.xml</plugin>
        <!-- if not set, use default process -->
        <process_name>lidar_detection_filter</process_name>
        <version>1.0.0</version>
    </module>
</cyber>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Arnold-FY-Chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值