プロジェクト

全般

プロフィール

機能 #4118

同一ポート間で二重接続をデフォルトで許可しないようにする、オプション指定で接続数等を設定する機能を追加する

n-andoほぼ7年前に追加. 6年以上前に更新.

ステータス:
終了
優先度:
通常
担当者:
対象バージョン:
開始日:
2017/06/14
期日:
進捗率:

100%

予定工数:

説明

同一ポート間で二重接続をデフォルトで許可しないようにする、オプション指定で接続数等を設定する機能を追加する。

オプション

  • port.[port_name].dataport.allow_dup_connection: YES/NO [default: NO]
  • port.[port_name].dataport.fan_out: [number of connection, OutPort only]
  • port.[port_name].dataport.fan_in: [number of connection, InPort only]

関係しているリビジョン

リビジョン 849 (差分)
miyamotoほぼ7年前に追加

[compat,->RELENG_1_2] refs #4118

履歴

#1 n-miyamotoほぼ7年前に更新

  • ステータス新規 から 解決 に変更
  • 担当者n-miyamoto にセット
  • 進捗率0 から 100 に変更

二重接続をしないための処理は以下のようにPortBaseのnotify_connect関数内で実装しました。
rtc.confとコネクタプロファイルでどちらにも設定がある場合はコネクタプロファイルを優先します。

  def notify_connect(self, connector_profile):
    self._rtcout.RTC_TRACE("notify_connect()")

    prop = OpenRTM_aist.Properties()
    OpenRTM_aist.NVUtil.copyToProperties(prop, connector_profile.properties)

    default_value = OpenRTM_aist.toBool(self._properties.getProperty("dataport.allow_dup_connection"), "YES","NO",False)

    if not OpenRTM_aist.toBool(prop.getProperty("dataport.allow_dup_connection"), "YES","NO",default_value):
      for port in connector_profile.ports:
        if not port._is_equivalent(self._objref):
          ret = OpenRTM_aist.CORBA_RTCUtil.already_connected(port, self._objref)
          if ret:
            return (RTC.PRECONDITION_NOT_MET, connector_profile)

OutPortの接続数で接続するか判定する処理については、OutPortBaseのnotify_connect関数内に記述しました。InPortもほぼ同じです。

  def notify_connect(self, connector_profile):
    prop = OpenRTM_aist.Properties()
    OpenRTM_aist.NVUtil.copyToProperties(prop, connector_profile.properties)

    _str = self._properties.getProperty("dataport.fan_out")
    _type = [int(100)]

    OpenRTM_aist.stringTo(_type, _str)

    _str = prop.getProperty("dataport.fan_out")
    OpenRTM_aist.stringTo(_type, _str)

    value =  _type[0]

    if value <= len(self._connectors):
      return (RTC.PRECONDITION_NOT_MET, connector_profile)

    return OpenRTM_aist.PortBase.notify_connect(self, connector_profile)

#2 n-ando6年以上前に更新

  • ステータス解決 から 終了 に変更

他の形式にエクスポート: Atom PDF