3

如何打印当前使用的lua参数

 2 years ago
source link: https://charon-cheung.github.io/2022/04/15/%E6%BF%80%E5%85%89SLAM/Cartographer/%E5%8E%9F%E7%90%86%E5%92%8C%E9%85%8D%E7%BD%AE/%E5%A6%82%E4%BD%95%E6%89%93%E5%8D%B0%E5%BD%93%E5%89%8D%E4%BD%BF%E7%94%A8%E7%9A%84lua%E5%8F%82%E6%95%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

如何打印当前使用的lua参数 | 沉默杀手

Toggle site
Catalog
You've read100%
如何打印当前使用的lua参数
2022-04-15|激光SLAMCartographer原理和配置|
Word count: 238|Reading time: 1 min

这里就是使用cartographer_print_configuration,它输出了当前cartographer使用的所有lua参数,虽然不如rosparam强大,但也是一种方法,本质就是读取加载的lua文件。

代码比较简单,不用太过研究,直接写launch

<launch>
<node name="print_mit_config" pkg="cartographer_ros"
type="cartographer_print_configuration" args="
-configuration_directories $(find cartographer_ros)/configuration_files
-configuration_basename mit_stata_odom.lua
-subdictionary map_builder"
output="screen">
</node>
</launch>

运行后会报错,找不到cartographer_print_configuration,这是因为可执行文件在bin路径: /home/user/carto_ws/install_isolated/bin/cartographer_print_configuration,roslaunch找的是/home/user/carto_ws/install_isolated/lib/cartographer_ros路径下的文件,复制到这里就好了。

运行launch就会输出所有lua参数,自己设置的参数也会覆盖默认的。 另外还有个subdictionary参数,输出的是子参数,这里用map_builder。但是只能输出第一级的子参数,如果自参数太底层就会报错,比如submaps做子参数就会运行错误。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK