File tree 3 files changed +63
-19
lines changed
3 files changed +63
-19
lines changed Original file line number Diff line number Diff line change 2
2
Contributing
3
3
============
4
4
5
- Types of Contributions
6
- ----------------------
7
-
8
5
Report and Fix Bugs
9
- ~~~~~~~~~~~~~~~~~~~
6
+ -------------------
10
7
11
8
Report or look for bugs to fix at https://github.com/jpieper/pygazebo/issues
12
9
@@ -55,15 +52,8 @@ Before you submit a pull request, check that it meets these guidelines:
55
52
56
53
1. The pull request should include tests.
57
54
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
61
58
https://travis-ci.org/jpieper/pygazebo/pull_requests
62
59
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
Original file line number Diff line number Diff line change @@ -11,13 +11,40 @@ pygazebo
11
11
.. image :: https://coveralls.io/repos/jpieper/pygazebo/badge.png
12
12
:target: https://coveralls.io/r/jpieper/pygazebo
13
13
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.
16
16
17
17
* Free software: Apache 2.0 License
18
18
* Documentation: http://pygazebo.rtfd.org.
19
19
20
20
Features
21
21
--------
22
22
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 )
Original file line number Diff line number Diff line change 2
2
Usage
3
3
========
4
4
5
- To use pygazebo in a project::
5
+ To use pygazebo in a project, first import, then instantiate a
6
+ Manager::
6
7
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.
You can’t perform that action at this time.
0 commit comments