Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2からデータ型にタイムスタンプが必須? #847

Closed
ishiguroJSK opened this issue Apr 14, 2020 · 2 comments
Closed

v1.2からデータ型にタイムスタンプが必須? #847

ishiguroJSK opened this issue Apr 14, 2020 · 2 comments
Labels
question Further information is requested

Comments

@ishiguroJSK
Copy link

お世話になっております,東大稲葉研 石黒と申します

こちらでOpenRTM-aist 1.1.2まで動作していたRTC等があるのですが,
1.2.0への移行に躓いておりまして質問させていただきました

1.2.0から追加されたinclude/openrtm-1.2/rtm/Timestamp.hの

namespace RTC
{
  template <class DataType>
  class Timestamp
    : public ConnectorDataListenerT<DataType>
  {
    USE_CONNLISTENER_STATUS;
  public:
    Timestamp(const char* ts_type) : m_tstype(ts_type) {}
    virtual ~Timestamp() {}
    virtual ReturnCode operator()(ConnectorInfo& info, DataType& data)
    {
      if (info.properties["timestamp_policy"] != m_tstype)
        {
          return NO_CHANGE;
        }
      coil::TimeValue tm(coil::gettimeofday());
      data.tm.sec  = tm.sec();
      data.tm.nsec = tm.usec() * 1000;
      return DATA_CHANGED;
    }
    std::string m_tstype;
  };
}; // End of namesepace RTM                                                                                                                               

の部分がどのデータ型に対してもRTC::Time tmメンバにアクセスしているように見え,
例えば以下のようなコンパイルエラーが出るようになりました.

In file included from /opt/ros/melodic/include/openrtm-1.2/rtm/InPort.h:39:0,
                 from /opt/ros/melodic/include/openrtm-1.2/rtm/DataInPort.h:23,
                 from /home/leus/catkin_ws/master/src/hrpsys/rtc/ImageData2CameraImage/ImageData2CameraImage.h:18,
                 from /home/leus/catkin_ws/master/src/hrpsys/rtc/ImageData2CameraImage/ImageData2CameraImage.cpp:10:
/opt/ros/melodic/include/openrtm-1.2/rtm/Timestamp.h: In instantiation of ‘RTC::Timestamp<DataType>::ReturnCode RTC::Timestamp<DataType>::operator()(RTC::ConnectorInfo&, DataType&) [with DataType = Img::ImageData; RTC::Timestamp<DataType>::ReturnCode = RTC::ConnectorListenerStatus::Enum]’:
/home/leus/catkin_ws/master/src/hrpsys/rtc/ImageData2CameraImage/ImageData2CameraImage.cpp:168:2:   required from here
/opt/ros/melodic/include/openrtm-1.2/rtm/Timestamp.h:40:12: error: ‘struct Img::ImageData’ has no member named ‘tm’
       data.tm.sec  = tm.sec();
       ~~~~~^~
/opt/ros/melodic/include/openrtm-1.2/rtm/Timestamp.h:41:12: error: ‘struct Img::ImageData’ has no member named ‘tm’
       data.tm.nsec = tm.usec() * 1000;

fkanehiro/hrpsys-base#1284

1.2からの仕様だとすると以下のようなtmメンバを持たないデータ型をidlで定義してデータポート通信に使うことはできなくなったのでしょうか?

#include <BasicDataType.idl>

module Img {

/* vector and matrix type */
typedef double Vec3[3];
typedef double Mat44[4][4];

/* image */
enum ColorFormat
{
  CF_UNKNOWN, CF_GRAY, CF_RGB,
  CF_GRAY_JPEG, CF_RGB_JPEG, CF_DEPTH // local extension                                                                                                  
};

struct ImageData
{
  long width;
  long height;

  ColorFormat format;
  sequence<octet> raw_data;
};
(略)

https://github.com/fkanehiro/hrpsys-base/blob/master/idl/Img.idl

おそらく呼び出し場所は以下のようなポートのコンストラクタ等です

ImageData2CameraImage::ImageData2CameraImage(RTC::Manager* manager)
  : RTC::DataFlowComponentBase(manager),
    // <rtc-template block="initializer">
    m_dataIn("imageIn", m_data.data.image),
    m_dataOut("imageOut", m_data),
    // </rtc-template>
    dummy(0)
{
}

https://github.com/fkanehiro/hrpsys-base/blob/5cbb5490f55c7017f7ff789c3d9de531ba92e1b6/rtc/ImageData2CameraImage/ImageData2CameraImage.cpp#L35

@ishiguroJSK ishiguroJSK added the question Further information is requested label Apr 14, 2020
@Nobu19800
Copy link

1.2.0からはデータポートのタイムスタンプ打刻機能(データ送信時、受信時等に自動的にタイムスタンプを設定する機能)の実装の都合上、RTC::Time tmのないデータ型は使用できなくなりました。

@ishiguroJSK
Copy link
Author

ありがとうございます.
1.2からの仕様と確認できましたので,こちらの実装を修正していこうと思います.
お手数おかけしました.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants