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?

ROS2でLOCALHOST_ONLYが動かないときの備忘録

Posted at

前提

少し大きめのプロジェクトを作成していたらネットワークの汚染がひどくなってきたのでROS_LOCALHOST_ONLY=1にしたら謎のエラーが出てノードが起動しなくなった。にゃんこ

エラー内容(一部抜粋)

selected interface "lo" is not multicast-capable: disabling multicast
Failed to find a free participant index for domain 0multicast-capable: disabling multicast

[rmw_cyclonedds_cpp]: rmw_create_node: failed to create domain, error Error

[rcl]: Failed to fini publisher for node: 1

環境

OS: Ubuntu22.04
ROSバージョン:ROS2 Humble

解決策

どうやらcycloneddsの設定をいじると解決するらしい。自分自身も理解できていないので設定は自己責任で。
ネットの情報をもとに以下のファイルを作成した

~/CycloneDDS/config.xml
<CycloneDDS>
  <Domain>
    <General>
      <AllowMulticast>false</AllowMulticast>
    </General>
    <Discovery>
      <ParticipantIndex>auto</ParticipantIndex>
      <MaxAutoParticipantIndex>1000</MaxAutoParticipantIndex>
    </Discovery>
 </Domain>
</CycloneDDS>

これで先ほどのエラーは解消できたが面倒なのでaliasをbashrcに追記した。

alias localonly='export ROS_LOCALHOST_ONLY=1 && export CYCLONEDDS_URI="file://$HOME/CycloneDDS/config.xml"'

おわり

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?