Skip to content

Commit

Permalink
Adds the python tutorial for the bindings
Browse files Browse the repository at this point in the history
Signed-off-by: Voldivh <eloyabmfcv@gmail.com>
  • Loading branch information
Voldivh committed Oct 3, 2023
1 parent b012e82 commit da3094b
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 9 deletions.
6 changes: 3 additions & 3 deletions python/examples/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from gz.msgs10.stringmsg_pb2 import StringMsg
from gz.msgs10.vector3d_pb2 import Vector3d
from gz.transport13 import AdvertiseMessageOptions
from gz.transport13 import Node

import time
Expand All @@ -39,10 +38,11 @@ def main():
while True:
count += 1
vector3d_msg.x = count
if not (pub_stringmsg.publish(stringmsg_msg) or pub_vector3d.publish(vector3d_msg)):
if not (pub_stringmsg.publish(stringmsg_msg)):
break

print("Publishing 'Hello' on topic [{}]".format(stringmsg_topic))
if not (pub_vector3d.publish(vector3d_msg)):
break
print("Publishing a Vector3d on topic [{}]".format(vector3d_topic))
time.sleep(0.1)

Expand Down
1 change: 0 additions & 1 deletion python/examples/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from gz.msgs10.stringmsg_pb2 import StringMsg
from gz.msgs10.vector3d_pb2 import Vector3d
from gz.transport13 import SubscribeOptions
from gz.transport13 import Node

import time
Expand Down
2 changes: 1 addition & 1 deletion python/src/transport/_gz_transport_pybind11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {

py::class_<TopicStatistics>(
m, "TopicStatistics",
"This class encapsulates statistics for a single topic..")
"This class encapsulates statistics for a single topic.")
.def(py::init<>());

auto node = py::class_<Node>(m, "Node",
Expand Down
4 changes: 2 additions & 2 deletions tutorials/01_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ combination of custom code and [ZeroMQ] (http://zeromq.org/).

## What programming language can I use with Gazebo Transport?

C++ is the native implementation and so far the only way to use the library.
We hope to offer different wrappers for the most popular languages in the future.
C++ is the native implementation and the only language that have available all library features.
Python implementation is a wrapper around C++ methods using pybind11. It does not support all features like C++, but, contains the main features such as publication, subscription and service request.
2 changes: 1 addition & 1 deletion tutorials/05_services.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\page services Services

Next Tutorial: \ref security
Next Tutorial: \ref python
Previous Tutorial: \ref messages

## Overview
Expand Down
Loading

0 comments on commit da3094b

Please sign in to comment.