zmp_publisher.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 import zmq
4 import math
5 import json
6 from time import sleep
7 
8 context = zmq.Context()
9 socket = context.socket(zmq.PUB)
10 socket.bind("tcp://*:9872")
11 
12 time = 0.0
13 
14 while True:
15  sleep(0.05)
16  time += 0.05
17 
18  data = {
19  "timestamp": time,
20  "test_data": {
21  "cos": math.cos(time),
22  "sin": math.sin(time)
23  }
24  }
25  socket.send_string( json.dumps(data) )


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:48