Skip to content
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

Adds the python bindings tutorial #450

Merged
merged 6 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 has all available 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