shupx / swarm_ros_bridge

A lightweight middle interface that enables specified ROS message transmission among swarm robots through socket communication

Home Page:https://wiki.ros.org/swarm_ros_bridge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use mqtt sub-pub model for message callback

vzhr opened this issue · comments

In this project, we receive messages by loop on a high frequency, so that it maybe a little expensive. I have found that mqtt has sub-pub model, does this will help?
https://zeromq.org/socket-api/?language=cpp&library=zmqpp#Publish-subscribe%20pattern

Thanks for your attention. But in this project, messages are handled once new message coming rather than in a high frequency loop. I did tried to receive messages in a loop but commented these lines out.
btw, this project uses the zeroMQ pub/sub mode as the link you attached.

bool dont_block = false; // 'true' leads to high cpu load

Notixe that 'dont_block' is set false which leads to block in receiving threads until new messages coming

OK, Good job.