資源簡介
通過此程序自動獲取sick lms511數(shù)據(jù),并將獲得數(shù)據(jù)由極坐標轉(zhuǎn)直角坐標,同時顯示掃描上來的數(shù)據(jù)曲線
代碼片段和文件信息
“““
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安裝依賴包
評論
共有 條評論