-
Notifications
You must be signed in to change notification settings - Fork 632
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
ZMQ minimal support #231
Comments
It would be nice to be able to extend this later to various types of transport middle-ware(i.e. ROS transport and DDS) as long as it doesn't add an undue amount of complexity. It might make it easier to create ROS nodes. Using zmqpp is easier than using zmq directly. It would make a wrapper significantly lighter. If you're planning on using zmqpp, it's worth noting that the debian maintained version is quite old and doesn't support many of the newer features, some of which are quite useful. |
@jolting It would be great to have your opinion on the new examples & code. The only missing part for now is the automatic splitting of large objects into ZMQ multipart msgs. I'm unsure about the real need for this feature, but it'll not much effort to introduce it now. |
For the records: The new functions are in |
@jlblancoc I like it. One inconsistency is with pointers and references.
And here CSerializable is a reference
I think both should be references. Also since both could potentially return an error shouldn't both return bool? Here is an idea for c++11 PubSub that's fairly general for ZMQ and can be extended for other types of transports. typedef std::function<bool(const mrpt::utils::CSerializable &)> Pub;
typedef std::function<bool(mrpt::utils::CSerializable &)> Sub;
Sub subscriber = std::bind(&mrpt::utils::mrpt_recv_from_zmq_into, recv_zmq_socket, std::placeholder::_1, false, NULL);
Pub publisher = std::bind(&mrpt::utils::mrpt_send_to_zmq, send_zmq_socket, std::placeholder::_1, 0); If you build classes that accept Pub Sub functions as callbacks then it should be fairly easy to create classes that can be used by multiple types of transports. This approach is very loosely coupled and is similar to how PCL uses callbacks. You might have to wait until version 2.0 to do that. |
@jlblancoc https://developers.google.com/protocol-buffers/docs/proto#simple |
Thanks @jolting ! Sure, I'll change the CSerializable * to &, it's clearly unnnecesary to use pointers here... I know protobuf & ROS msgs, and I would love to have some unique and non-redundant serialization mechanism for: binary streams (the current implementation), protobuf, ROS msgs (for now it's only implemented in a custom Perhaps there is no elegant solution, but if you come to some brilliant solution... it'll be more than welcome! ;-) |
@jlblancoc I really don't have a great idea for this. It's one of those neglected topics in c++. There is something available for DDS, but it has a few boost dependencies and looks like it uses macros. I haven't seen an elegant solution for c++11 yet, but I imagine one could use variadic templates.
There isn't a way to get a list of member variables from a class in c++, you'll still have to pass in the members you'll want to serialize. |
Write:
mrpt::utils::
functions to read/write objects to ZMQ sockets / messages.The text was updated successfully, but these errors were encountered: