File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1+ #include < zmq.hpp>
2+ #include < zmq_addon.hpp>
13#include " candlewick/multibody/Multibody.h"
24
3- int main () { return 0 ; }
5+ #include < pinocchio/serialization/model.hpp>
6+ #include < pinocchio/serialization/geometry.hpp>
7+
8+ namespace pin = pinocchio;
9+
10+ int main () {
11+ zmq::context_t ctx;
12+ zmq::socket_t sock{ctx, zmq::socket_type::pull};
13+ sock.bind (" tcp://127.0.0.1:12000" );
14+ const std::string endpoint = sock.get (zmq::sockopt::last_endpoint);
15+ printf (" ZMQ endpoint: %s\n " , endpoint.c_str ());
16+
17+ pin::Model model;
18+ pin::GeometryModel geom_model;
19+
20+ std::vector<zmq::message_t > recv_models;
21+
22+ printf (" Receiving Model and GeometryModel..." );
23+
24+ const auto ret = zmq::recv_multipart (sock, std::back_inserter (recv_models));
25+ assert (*ret == 2 );
26+
27+ model.loadFromString (recv_models[0 ].to_string ());
28+ std::cout << model << std::endl;
29+ geom_model.loadFromString (recv_models[1 ].to_string ());
30+
31+ return 0 ;
32+ }
Original file line number Diff line number Diff line change 1+ import pinocchio as pin
2+ import zmq
3+
4+
5+ PORT = 12000
6+
7+ ctx = zmq .Context .instance ()
8+ sock : zmq .Socket = ctx .socket (zmq .SocketType .PUSH )
9+ sock .connect (f"tcp://127.0.0.1:{ PORT } " )
10+
11+ model = pin .buildSampleModelHumanoidRandom ()
12+ geom_model = pin .buildSampleGeometryModelHumanoid (model )
13+
14+ sock .send_multipart ([model .saveToString ().encode (), geom_model .saveToString ().encode ()])
You can’t perform that action at this time.
0 commit comments