たいりょーくんのメモ

Twitterにツイートするノリで気軽にメモしていくためのブログです。詳しくは https://tiryoh.hateblo.jp/about をお読みください。

RViz2でのtf周りのエラーと闘っている話

ROSConJP 2019の1日目のROS2の講習会にて使用されたRaspberry Pi Mouse ROSConJP2019講習会キットを入手したのでROS2でいろいろ試しています。

RViz2でtf(正確にはtf2だけれどもここではtfと表記)ツリーのtransformに失敗して、LaserScanがほとんど表示されない(まれにtransformに成功して表示される)問題に遭遇しています。

以下がそのRViz2のスクリーンレコード(1.0倍速)です。

Image from Gyazo

[rviz2-1] [ERROR] [rviz2]: Lookup would require extrapolation into the future. Requested time 1570305527.54524 but the latest data is at time 1570305527.44573, when looking up transform from frame [laser_frame] to frame [odom]

使用してる各種ソフトウェアのバージョンは以下のとおりです。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

$ uname -a
Linux T480s 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ dpkg -l | grep ros-dashing-tf
ii  ros-dashing-tf2                                    0.11.5-1bionic.20190918.174949                                 amd64        tf2 is the second generation of the transform library, which lets the user keep track of multiple coordinate frames over time.
ii  ros-dashing-tf2-eigen                              0.11.5-1bionic.20190923.212026                                 amd64        tf2_eigen
ii  ros-dashing-tf2-geometry-msgs                      0.11.5-1bionic.20190923.212044                                 amd64        tf2_geometry_msgs
ii  ros-dashing-tf2-kdl                                0.11.5-1bionic.20190923.210640                                 amd64        KDL binding for tf2
ii  ros-dashing-tf2-msgs                               0.11.5-1bionic.20190918.173948                                 amd64        tf2_msgs
ii  ros-dashing-tf2-ros                                0.11.5-1bionic.20190923.210012                                 amd64        This package contains the ROS bindings for the tf2 library, for both Python and C++.
ii  ros-dashing-tf2-sensor-msgs                        0.11.5-1bionic.20190923.212139                                 amd64        Small lib to transform sensor_msgs with tf.

$ dpkg -l | grep ros-dashing-rviz
ii  ros-dashing-rviz-assimp-vendor                     6.1.4-1bionic.20190918.162719                                  amd64        Wrapper around assimp, providing nothing but a dependency on assimp, on some systems.
ii  ros-dashing-rviz-common                            6.1.4-1bionic.20190923.212322                                  amd64        Common rviz API, used by rviz plugins and applications.
ii  ros-dashing-rviz-default-plugins                   6.1.4-1bionic.20190923.213837                                  amd64        Several default plugins for rviz to cover the basic functionality.
ii  ros-dashing-rviz-ogre-vendor                       6.1.4-1bionic.20190918.162726                                  amd64        Wrapper around ogre3d, it provides a fixed CMake module and an ExternalProject build of ogre.
ii  ros-dashing-rviz-rendering                         6.1.4-1bionic.20190918.164248                                  amd64        Library which provides the 3D rendering functionality in rviz.
ii  ros-dashing-rviz2                                  6.1.4-1bionic.20190923.214525                                  amd64        3D visualization tool for ROS.

chronyを使ってPCとロボットの時刻同期をしていたのでtf2_monitorの結果はこんな感じで特に問題はなさそうに見えます。

$ ros2 run tf2_ros tf2_monitor

RESULTS: for all Frames

Frames:
Frame: /base_link, published by <no authority available>, Average Delay: 0.00958436, Max Delay: 0.0214376
Frame: /laser_frame, published by <no authority available>, Average Delay: 0.00956981, Max Delay: 0.0214226
Frame: base_footprint, published by <no authority available>, Average Delay: 0.0214976, Max Delay: 0.213811

All Broadcasters:
Node: <no authority available> 11.3634 Hz, Average Delay: 0.020404 Max Delay: 0.213811

GitHub上でいくつか調べてみると、どうやらRViz2の問題の可能性が高いらしく、以下のissueにて議論が行われているようです。

github.com

関連しそうなissueがいくつかありました。

github.com

github.com

はてなブログ再開の経緯

いままでTwitterにメモを取ってあとからTwilogで検索するようなスタイルでTwitterをメモ代わりに使っていたのですが、 TwitterでURLをツイートできなくなったり*1、 TweetDeckが使えなくなったり*2することがありました。

これをきっかけにせっかく日記をつけようという気になったので、Memotekiの方に書くまでもなさそうなことだけ(試行錯誤して解決してない途中過程とか?)を書いていくことにしました。