Skip to content

Commit b7ee336

Browse files
committed
Write basic portions of documentation.
* Strip down CONTRIBUTING from the cookiecutter boilerplate. * Write a minimal README. * Write a minimal usage.rst section.
1 parent 3450708 commit b7ee336

File tree

3 files changed

+63
-19
lines changed

3 files changed

+63
-19
lines changed

CONTRIBUTING.rst

+4-14
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
Contributing
33
============
44

5-
Types of Contributions
6-
----------------------
7-
85
Report and Fix Bugs
9-
~~~~~~~~~~~~~~~~~~~
6+
-------------------
107

118
Report or look for bugs to fix at https://github.com/jpieper/pygazebo/issues
129

@@ -55,15 +52,8 @@ Before you submit a pull request, check that it meets these guidelines:
5552

5653
1. The pull request should include tests.
5754
2. If the pull request adds functionality, the docs should be updated. Put
58-
your new functionality into a function with a docstring, and add the
59-
feature to the list in README.rst.
60-
3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check
55+
your new functionality into a function with a docstring, and update
56+
the reference documentation accordingly.
57+
3. The pull request should work for Python 2.7. Check
6158
https://travis-ci.org/jpieper/pygazebo/pull_requests
6259
and make sure that the tests pass for all supported Python versions.
63-
64-
Tips
65-
----
66-
67-
To run a subset of tests::
68-
69-
$ python -m unittest tests.test_pygazebo

README.rst

+30-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,40 @@ pygazebo
1111
.. image:: https://coveralls.io/repos/jpieper/pygazebo/badge.png
1212
:target: https://coveralls.io/r/jpieper/pygazebo
1313

14-
15-
Python bindings for the Gazebo multi-robot simulator.
14+
pygazebo provides python bindings for the Gazebo
15+
(http://gazebosim.org) multi-robot simulator.
1616

1717
* Free software: Apache 2.0 License
1818
* Documentation: http://pygazebo.rtfd.org.
1919

2020
Features
2121
--------
2222

23-
* TODO
23+
* Supports publishing and subscribing to any Gazebo topics using a
24+
straightforward python API.
25+
* Python versions of all defined Gazebo protobuf messages are
26+
included.
27+
* Based on eventlet (http://eventlet.net), for easy concurrency support.
28+
29+
Simple Usage
30+
------------
31+
32+
The following example shows how easy it is to publish a message
33+
repeatedly to control a single joint in a Gazebo model.
34+
35+
.. code-block:: python
36+
37+
import eventlet
38+
from pygazebo import Manager
39+
40+
manager = Manager(('localhost', 11345))
41+
publisher = manager.advertise('/gazebo/default/model/joint_cmd',
42+
'gazebo.msgs.JointCmd')
43+
44+
message = pygazebo.msg.joint_cmd_pb2.JointCmd()
45+
message.axis = 0
46+
message.force = 1.0
47+
48+
while True:
49+
publisher.publish(message)
50+
eventlet.sleep(1.0)

docs/usage.rst

+29-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22
Usage
33
========
44

5-
To use pygazebo in a project::
5+
To use pygazebo in a project, first import, then instantiate a
6+
Manager::
67

7-
import pygazebo
8+
import pygazebo
9+
10+
manager = pygazebo.Manager(('localhost', 11345))
11+
12+
Then, individual topics can be published or subscribed using the
13+
`advertise` or `subscribe` methods.
14+
15+
To publish::
16+
17+
publisher = manager.advertise('/gazebo/default/topic',
18+
'gazebo.msgs.GzString')
19+
publisher.publish(pygazebo.msg.gz_string_pb2.GzString(data='hello'))
20+
21+
And to subscribe::
22+
23+
def callback(data):
24+
message = pygazebo.msg.gz_string_pb2.GzString.FromString(data)
25+
print('Received message:', message.data)
26+
27+
manager.subscribe('/gazebo/default/topic',
28+
'gazebo.msgs.GzString',
29+
callback)
30+
31+
The library is built with eventlet. Using its facilities, all
32+
external APIs are designed to be non-blocking. To integrate pygazebo
33+
into another application, you can either use a standard eventlet hub
34+
integration strategy, or just poll `eventlet.sleep()` occasionally.

0 commit comments

Comments
 (0)