2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ROS2でmapvizを使用してNavSatFixトピックの場所の航空写真を表示

Posted at

概要

ROS2環境でmapviz を使ってNavSatFizトピックの位置の地図を表示するまでの手順

ドキュメント

Github リポジトリ

環境

ROS2 : Iron
ubuntu : ubunut22.04LTS

mapvizとは

地図データを可視化したり、地図の上にLaserScanやPoseなどを表示できるrviz2っぽい可視化ツール。

mapviz.png

インストール

sudo apt-get install ros-$ROS_DISTRO-mapviz \
                       ros-$ROS_DISTRO-mapviz-plugins \
                       ros-$ROS_DISTRO-tile-map \
                       ros-$ROS_DISTRO-multires-image

Bing Maps APIの取得

この辺の記事を参考にBing Mapsのアカウントを作成し、APIキーを取得しておきます。

実行方法

以下のようなlaunchファイルを作って実行する。

mapviz.launch.py
import launch
import launch.actions
import launch.substitutions
import launch_ros.actions
import os
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    return launch.LaunchDescription([
        launch_ros.actions.Node(
            package="mapviz",
            executable="mapviz",
            name="mapviz",
        ),
        launch_ros.actions.Node(
            package="swri_transform_util",
            executable="initialize_origin.py",
            name="initialize_origin",
            remappings=[
                ("fix", "/fix"),
            ],
        ),
        launch_ros.actions.Node(
            package="tf2_ros",
            executable="static_transform_publisher",
            name="swri_transform",
            arguments=["0", "0", "0", "0", "0", "0", "map", "origin"]
        )
    ])

remappingsの右側に使用するNavSatFixトピック名を書く。
以下はトピック名が/gps/fixの場合の例。

        launch_ros.actions.Node(
            package="swri_transform_util",
            executable="initialize_origin.py",
            name="initialize_origin",
            remappings=[
                ("fix", "/gps/fix"),
            ],
        ),

実行

ros2 launch mapviz.launch.py

最初に起動した画面

image.png

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?