Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
ball_tracking
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Gomez-Gonzalez
ball_tracking
Commits
a7931626
Commit
a7931626
authored
4 years ago
by
Sebastian Gomez-Gonzalez
Browse files
Options
Downloads
Patches
Plain Diff
Improving the documentation
parent
467c3f27
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+44
-0
44 additions, 0 deletions
README.md
with
44 additions
and
0 deletions
README.md
+
44
−
0
View file @
a7931626
...
...
@@ -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:
```
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment