How can I communicate to Gazebo Sim topics via a standalone application (no ROS)?

Is it possible to build a standalone application that pub/sub to gazebo topics?
How? Regular zmq? or anything custom?
If i need to RTFM, can you please point to M?

Thanks

Gazebo doesn’t use ROS (unless you explicitly add the support). It uses Gazebo Transport, which is a mixture of Protobuf and ZeroMQ.

1 Like

There is also support for WebSocket comms (recently discussed here: How can I run an ign gazebo server/client pair with websocket? ).

Gazebo transport examples are a good starting point.

1 Like

Thanks for sharing. Those are C++ examples that use the libs exposed from Gazebo.
What if I need to interoperate with another language? What communication channel would i use? zmq + proto? or websocket?
is there any documentation regarding both?

I use zmq through ros2 + Gazebo(Garden, Citadel, and Fortress).

Actually, the entire project I use is zmq.

I know this doesn’t answer your question, but I wanted to share the idea and see if it helps you in someway.

As for websocket, I saw this conversation recently. I haven’t tried it but very soon I will. Hopefully this conversation helps you!

1 Like

Thanks for your answer. As i said, I cannot use ROS.

I also know about gz-launch and the websocket service. But where is the documentation about the application protocol. For instance, I connect to the websocket. Then what? Do I send a request via a message? What’s the format of such message. I subscribe somewhere… how?

It is so awkward not to find any documentation about this.

As i said, I cannot use ROS.

My apologies, I must have missed that part. That’s only thing I used with the regular zmq.

I can’t help much with websocket on Gazebo as it is my next thing to explore this weekend.

It is so awkward not to find any documentation about this

Keep this in mind, it’s open source. This means everyone who is putting their free time on Gazebo. They welcome to anyone to make a new documentations in general though. Maybe one day, I can make a youtube channel to help people out.

OT: Open-source doesn’t mean developed without any payment from anyone. Open Robotics gets various funding to extend or develop Gazebo. But the details of this funding are not accessible. I assume the funding might prefer functionality over documentation. But of course everyone can help making the docs better :slight_smile:

1 Like

yeah, sometimes great documentation makes authors less “useful” in the future :wink:

As other people mentioned, Gazebo Transport uses a combination of ZMQ+Protobub+custom code. There are three main use cases that trigger communications in the library:

  • Discovery: This is solved with a very simple custom protocol over UDP multicast.
  • Pub/Sub: Using ZMQ over TCP with a custom protocol.
  • Req/Res: Using ZMQ over TCP with a custom protocol.

Some time ago, I started documenting the implementation details here. In that tutorial I started documenting the discovery protocol but it’s probably still incomplete and potentially not up to date. You shouldn’t use it as it is, just as a starting point. I haven’t documented the protocol for pub/sub and req/res .

It should be possible to continue documenting (and updating) the protocol by reading the code. I volunteer to help pointing at the right places and clarifying questions but I probably won’t have the time to do the whole process directly. The protocol isn’t very complicated but documenting it properly requires some time.

1 Like

The websocket is implemented here gz-launch/plugins/websocket_server at gz-launch6 · gazebosim/gz-launch · GitHub
There is a README. For pub/sub, the best documentation is in the header comment to the websocket server here gz-launch/WebsocketServer.hh at c09ee8c2ca041f1f777e985e007761e3b2a7bf4f · gazebosim/gz-launch · GitHub

I would say that, the other thing about open source is that the code is freely online. So even though documentation doesn’t exist for everything, and sometimes it gets outdated, the source code is there, and anyone who has time can contribute documentation. In the specific case of the websocket server, the code is actually just 2 files, and it’s pretty straight-forward.

1 Like

Thanks!! I look forward to try this again soon!

@fgadaleta - offering another option: I wrote a set of Python bindings for the gz-transport layer which lets you pub/sub to gz topics accessing all the machinery provided by the Gazebo C++ libs. It uses pybind11 to define bindings and a related package pybind11_protobuf to manage the conversion to the types available in gz-msgs.

The project needs some work to make it friendlier to build (pybind11_protobuf is a google project and they use Bazel so there are some hoops to jump through to use cmake). If there is an interest it could be upstreamed to sit alongside the other Python bindings for Gazebo?

1 Like