Skip to content

Commit 3a378cc

Browse files
committed
add a ZMQ test
1 parent 5c1ec86 commit 3a378cc

4 files changed

Lines changed: 37 additions & 28 deletions

File tree

src/python/tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ set(python_tests_standalone
6363
# todo
6464
# need this special case until robotlocomotion/lcmtypes are added to openhumanoids
6565
if(NOT USE_DRC)
66-
list(APPEND python_tests_lcm testTreeViewerInterface.py)
66+
list(APPEND python_tests_lcm testTreeViewerLCMInterface.py)
67+
list(APPEND python_tests_lcm testTreeViewerZMQInterface.py)
6768
list(APPEND python_tests_lcm testTreeViewerClient.py)
6869
list(APPEND python_tests_lcm testTreeViewerPolyLine.py)
6970
endif()
File renamed without changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
import subprocess
3+
import zmq
4+
import msgpack
5+
6+
if __name__ == '__main__':
7+
vis_binary = os.path.join(os.path.dirname(sys.executable),
8+
"drake-visualizer")
9+
vis_process = subprocess.Popen([vis_binary, '--testing', '--interactive', '--treeviewer-zmq-url=tcp://127.0.0.1:56300'])
10+
context = zmq.Context()
11+
socket = context.socket(zmq.REQ)
12+
socket.connect("tcp://127.0.0.1:56300")
13+
print("connected")
14+
15+
data = {
16+
"timestamp": 1486691399249288,
17+
"setgeometry": [
18+
{
19+
"path": ["robot1", "link1"],
20+
"geometry": {
21+
"type": "box",
22+
"color": [1, 0, 0, 0.5],
23+
"lengths": [1, 0.5, 2]
24+
}
25+
}
26+
],
27+
"settransform": [],
28+
"delete": []
29+
}
30+
print("sending")
31+
socket.send(msgpack.packb(data))
32+
print("waiting for reply")
33+
print(socket.recv())
34+
35+
vis_process.terminate()

zmq_test.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)