udp_client.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 import socket
4 import math
5 import json
6 from time import sleep
7 
8 sock = socket.socket(socket.AF_INET, # Internet
9  socket.SOCK_DGRAM) # UDP
10 time = 0.0
11 
12 while True:
13  sleep(0.05)
14  time += 0.05
15 
16  data = {
17  "timestamp": time,
18  "test_data": {
19  "cos": math.cos(time),
20  "sin": math.sin(time)
21  }
22  }
23  sock.sendto( json.dumps(data), ("127.0.0.1", 9870) )


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