0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

grid_mapを使ってみる(2)

Last updated at Posted at 2021-11-20

前回grid_mapのinstall方法やデモの動作をしました。

今回はオリジナルの画像をgrid_mapとして表示したいと思います。

デモ

まず標準で用意されている画像をgrid mapとして表示するデモを実行します。

roslaunch grid_map_demos image_to_gridmap_demo.launch

すると以下のようなgrid mapがrviz上に表示されます。

Screenshot from 2021-11-20 18-15-21.png

launchの中は次のようになっています。

image_to_gridmap.launch
<launch>
  <rosparam command="load" file="$(find grid_map_demos)/config/image_to_gridmap_demo.yaml" />

  <!-- Load the image. -->
  <node pkg="grid_map_demos" type="image_publisher.py" name="image_publisher" output="screen">
    <param name="image_path" value="$(find grid_map_demos)/data/eth_logo.png" />
    <param name="topic" value="~image" />
  </node>

  <!-- Launch the grid map image to grid map demo node. -->
  <node pkg="grid_map_demos" type="image_to_gridmap_demo" name="image_to_gridmap_demo" output="screen" />

  <!-- Launch the grid map visualizer -->
  <node pkg="grid_map_visualization" type="grid_map_visualization" name="grid_map_visualization" output="screen" />

  <!-- Launch RViz with the demo configuration -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find grid_map_demos)/rviz/grid_map_demo.rviz" />
</launch>

オリジナル画像の出力

先程のデモを参考に次はオリジナルの画像を出力してみます。
以下のようにlaunchを作成します。image_pathは自分の使用した画像のパスを入力してください。

image_to_gridmap.launch
<launch>
  <rosparam command="load" file="$(find grid_map_demos)/config/image_to_gridmap_demo.yaml" />

  <!-- Load the image. -->
  <node pkg="grid_map_demos" type="image_publisher.py" name="image_publisher" output="screen">
    <param name="image_path" value="$(find grid_map_samples)/src/template_match.png" />
    <param name="topic" value="~image" />
  </node>

  <!-- Launch the grid map image to grid map demo node. -->
  <node pkg="grid_map_demos" type="image_to_gridmap_demo" name="image_to_gridmap_demo" output="screen">
    <param name="resulution" value="0.01" />
    <param name="max_height" value="1.0" />
  </node>

  <!-- Launch the grid map visualizer -->
  <node pkg="grid_map_visualization" type="grid_map_visualization" name="grid_map_visualization" output="screen" />

  <!-- Launch RViz with the demo configuration -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find grid_map_demos)/rviz/grid_map_demo.rviz" />
</launch>

今回は以下のようなopencvのtemplate matchサンプルの結果の画像を使用しました。(opencv templat matching サンプル)

Screenshot from 2021-11-20 17-02-12.png

実行すると以下のようになり,2次元の結果を立体的に表示できました。

Screenshot from 2021-11-20 18-11-38.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?