環境
- ROS2 Humble
- 以下のパッケージをインストール済み
- ros-humble-camera-info-manager
- ros-humble-image-transport
- ros-humble-image-transport-plugins
- source /opt/ros/humble/setup.bash実施済み
現象
以下のトピックをpublishしている状況
内容 | メッセージ型 |
---|---|
カメラ画像 | CompressedImage |
深度画像 | CompressedImage |
カメラ情報 | CameraInfo |
ros2 run rqt_image_view rqt_image_view
でrqt_image_viewのウィンドウを出してカメラ画像のトピックや深度画像のトピックを選択するとエラーのダイアログボックスが表示されて画像が表示されない。
エラーの内容は以下の通り。
カメラ画像
Unable to load plugin for transport 'image_transport/image_sub', error string: According to the loaded plugin descriptions the class image_transport/image_sub with base class type image_transport::SubscriberPlugin does not exist. Declared types are image_transport/compressedDepth_sub image_transport/compressed_sub image_transport/raw_sub image_transport/theora_sub
深度画像
Unable to load plugin for transport 'image_transport/depth_sub', error string: According to the loaded plugin descriptions the class image_transport/depth_sub with base class type image_transport::SubscriberPlugin does not exist. Declared types are image_transport/compressedDepth_sub image_transport/compressed_sub image_transport/raw_sub image_transport/theora_sub
解決方法
こちらのフォーラムに書かれている通り、トピック名の最後(階層の最後のエントリ)が固定名じゃないと表示されない。
項目 | トピック名 |
---|---|
カメラ画像 | /xxx/yyy/compressed |
深度画像 | /xxx/yyy/compressedDepth |
カメラ情報 | /xxx/yyy/camera_info |
なお、ソースコードを見たらCameraInfoのトピックは他のトピックと同じ階層であることを前提としているようなコードになっていたので階層(上の表の/xxx/yyy
部分)をそろえておいた方がよさそう。
余談
CompressedImageの深度画像を表示するときに以下のエラーが表示される。
SubscriberPlugin::subscribeImpl with five arguments has not been overridden
これはHumbleのSubscriberPlugin::subscribeImpl()メソッドで用意されている実装コードでロガーに出しているエラーが表示されている。処理自体は4引数版のsubscribeImpl()を呼んでいてそれらしく動いているので問題はなさそう。
※デフォルトブランチ(記事執筆時rolling)のソースコードでは該当箇所のコードが変化して4引数版メソッドがなくなっているので恐らく当該エラーは出なくなっているのでは(実際の動作は確認していないけど)