Advertisement
Guest User

Untitled

a guest
Jun 20th, 2015
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. import socket
  2. import struct
  3. import math
  4. import time
  5. import random
  6.  
  7. UDP_IP = "127.0.0.1"
  8. UDP_PORT = 4123
  9.  
  10. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  11.  
  12. def sd(m):
  13.   sock.sendto(m, (UDP_IP, UDP_PORT))
  14.  
  15. t=0
  16. wx=0
  17. wy=0
  18. wz=0
  19. h=0
  20. p=0
  21. r=0
  22. ax=0
  23. ay=0
  24. az=0
  25. vx=0
  26. vy=0
  27. vz=0
  28. x=0
  29. y=0
  30. z=0
  31. idd=0
  32. random.seed()
  33.  
  34. while True:
  35.   time.sleep(0.2)
  36. #  t=1
  37. #  wx=random.random()
  38. #  wy=random.random()
  39. #  wz=random.random()
  40. #  h=random.random()
  41.   h=4.276208376215706*3.1415926/180
  42. #  h=1
  43. #  p=random.random()
  44. #  r=random.random()
  45. #  ax=random.random()
  46. #  ay=random.random()
  47. #  az=random.random()
  48. #  vx=random.random()
  49. #  vy=random.random()
  50. #  vz=random.random()
  51. #  x=random.randint(100,40000000)
  52. #  y=random.randint(100,40000000)
  53. #  z=random.randint(100,40000000)
  54. #  idd=1
  55.   data=struct.pack('Iffffffffffffiiii', t, wx, wy, wz, h, p, r, ax, ay, az, vx, vy, vz, x, y, z, idd)
  56.   sd(data)
  57.   print(h*180/3.1415926)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement