Skip to content
Snippets Groups Projects
Commit 83e6fc5e authored by Sebastian Gomez-Gonzalez's avatar Sebastian Gomez-Gonzalez
Browse files

Improving the documentation

parent 467c3f27
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,50 @@ in world coordinates of the ball to all its subscribers
Both services use configuration files (JSON). You can see examples in the example folder.
### Client (Subscriber) Example
* The client can be written in any programming language
* Can also be executed in a separate machine as the vision system
* Assuming the server runs in a machine called "Rodau" in the TCP port 7660, see
the following example written in Python:
```
import sys
import zmq
import json
url = "tcp://rodau:7660"
context = zmq.Context()
socket = context.socket(zmq.SUB)
print "Connecting to {0}".format(url)
socket.connect(url)
topicfilter = ""
socket.setsockopt(zmq.SUBSCRIBE, topicfilter)
num_obs = 1000
obs = []
ball_in_scene = False
null_warn = 10
while (len(obs) < num_obs):
#topic = socket.recv()
body = socket.recv()
msg = json.loads(body)
if msg['obs'] is None and null_warn>0:
print "Observing null"
null_warn-=1
if msg['obs'] is not None and not ball_in_scene:
ball_in_scene = True
print "First ball observed"
if ball_in_scene:
obs.append(msg)
print msg
```
* The example fills the list **obs** with all the 3D observations returned by the vision system until
1000 are read
* If there is no ball in the scene, the server returns **null**.
## Installation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment