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

Support TimeSynchronizer for CamClient #13

Open
gezp opened this issue Mar 5, 2022 · 1 comment
Open

Support TimeSynchronizer for CamClient #13

gezp opened this issue Mar 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@gezp
Copy link
Member

gezp commented Mar 5, 2022

Feature request

Feature description

rmoss_camCamClient 对ROS消息进行了进行了封装,只暴露如下接口:

  typedef std::function<void (const cv::Mat &, const rclcpp::Time &)> Callback;
  virtual bool connect(const std::string & camera_name, Callback cb);

这种隐藏ROS层细节能够使开发者专心于图像开发,而不用关心ROS消息处理过程,但是这样导致无法使用Message Filter中消息同步等工具,而消息同步在某些RM场景中可能十分有用,比如RM中的相机和IMU的同步。

Implementation considerations

方案一:扩展CamClient 类,适配message_filters接口,只需要继承message_filters::SimpleFilter即可 (可实现类似message_filters::Subscriber的效果),然后使用message_filters::TimeSynchronizer 即可。

  • 该方法的优点是扩展了CamClient 功能,缺点是相比于直接使用message_filters::Subscriber订阅ROS消息方法,显得多余,容易使开发者产生困惑。

方案二:针对特定场景封装特定消息同步类,无需扩展CamClient ,而是另起炉灶,如创建CamImuSyncClient,内部集成message_filters::TimeSynchronizer 等方法实现特定消息同步.

  • 该方法优点是易实现,且意图明确,缺点是可能会引入CamClient 中重复代码。
@gezp gezp added the enhancement New feature or request label Mar 5, 2022
@gezp
Copy link
Member Author

gezp commented Jan 31, 2024

消息同步不建议直接使用ros的message_filters,使用buffer自行处理会更加灵活。在rmoss设计模式中,ROS2主要作为消息通讯的中间件,topic数据的读取尽可能保持原生形式,并采用自己的算法进行同步等处理,不依赖于ROS。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant