资源简介
通过此程序自动获取sick lms511数据,并将获得数据由极坐标转直角坐标,同时显示扫描上来的数据曲线
代码片段和文件信息
“““
socket client
“““
from socket import *
from scipy import *
import matplotlib.pyplot as plt
HOST = ‘192.168.0.10‘
PORT = 2111
s = None
def startclient():
“““
:return:
“““
BUFSIZE = 40000
ADDR = (HOST PORT)
while True:
data = input(‘>‘)
#data = ‘02 73 52 4E 20 4C 4D 44 73 63 61 6E 64 61 74 61 03‘
if not data:
break
bites = getcmd(data)
cmdstring = bytearray(bites encoding=‘utf-8‘)
print(cmdstring)
tcpclisocket = socket(AF_INET SOCK_STREAM)
tcpclisocket.connect(ADDR)
tcpclisocket.send(cmdstring)
pcddata = tcpclisocket.recv(BUFSIZE).decode()
print(pcddata)
caldata(pcddata)
tcpclisocket.close()
def getcmd(hexstring):
“““
:param hexstring:
:return:
“““
hexstring = hexstring.replace(“ “ ““)
if (len(hexstring) % 2) != 0:
hexstring += “ “
bits = ““
fo
- 上一篇:Python-opencv-植物叶片识别
- 下一篇:mayavi安装依赖包
评论
共有 条评论