This commit is contained in:
Lukas Droste
2021-09-05 16:45:49 +02:00
parent 5c98948af5
commit 23fc1e8abd
5 changed files with 18 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,7 +12,7 @@ import uuid
f = open("PointCloudWeb.Scanner\datafile.txt","wt") f = open("PointCloudWeb.Scanner\datafile.txt","wt")
arduino_status = False arduino_status = False
arduino_port = "COM10" arduino_port = "COM9"
arduino_baud = 9600 arduino_baud = 9600
arduino = None arduino = None
lidar_status = False lidar_status = False
@@ -66,10 +66,10 @@ def sendData(data,posy):
for x,y in data.items(): for x,y in data.items():
if y != 0: if y != 0:
temp += ("{\"RAY\":" + str(posy) + ",\"RAX\":" + str(x) + ",\"DistanceMM\":" + str(y) + "},") temp += ("{\"RAY\":" + str(posy) + ",\"RAX\":" + str(x) + ",\"DistanceMM\":" + str(y) + "},")
# f.write("{\"RAY\":" + str(posy) + ",\"RAX\":" + str(x) + ",\"DistanceMM\":" + str(y) + "},") #f.write("{\"RAY\":" + str(posy) + ",\"RAX\":" + str(x) + ",\"DistanceMM\":" + str(y) + "},")
l = len(temp) l = len(temp)
temp = temp[:l-1] + "]}" temp = temp[:l-1] + "]}"
#f.write(temp) f.write(temp)
r = requests.put(url='http://localhost:35588/scandata', data=temp, headers={'content-type': 'application/json'}) r = requests.put(url='http://localhost:35588/scandata', data=temp, headers={'content-type': 'application/json'})
#print(r.status_code) #print(r.status_code)
@@ -80,14 +80,16 @@ def startScanner(mode):
ws_message_queue.appendleft(str(lidar.GetDeviceInfo())) ws_message_queue.appendleft(str(lidar.GetDeviceInfo()))
scan_id = str(uuid.uuid4()) scan_id = str(uuid.uuid4())
ws_message_queue.appendleft("Scan ID: " + scan_id) ws_message_queue.appendleft("Scan ID: " + scan_id)
gen = lidar.StartScanning() #gen = lidar.StartScanning()
if mode == "0": if mode == "0":
print("Mode 0") print("Mode 0")
ws_message_queue.appendleft("<scan>running") ws_message_queue.appendleft("<scan>running")
for y in range(19): for y in range(19):
if(stop_scan == True): if(stop_scan == True):
break break
gen = lidar.StartScanning()
sendData(next(gen),y*10) sendData(next(gen),y*10)
lidar.StopScanning()
time.sleep(2) time.sleep(2)
setY(y*10) setY(y*10)
time.sleep(2) time.sleep(2)
@@ -95,13 +97,15 @@ def startScanner(mode):
ws_message_queue.appendleft("<progress>" + str(scan_progress)) ws_message_queue.appendleft("<progress>" + str(scan_progress))
r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id) r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id)
setY(0) setY(0)
lidar.StopScanning() #lidar.StopScanning()
elif mode == "1": elif mode == "1":
ws_message_queue.appendleft("<scan>running") ws_message_queue.appendleft("<scan>running")
for y in range(91): for y in range(91):
if(stop_scan == True): if(stop_scan == True):
break break
gen = lidar.StartScanning()
sendData(next(gen),y*2) sendData(next(gen),y*2)
lidar.StopScanning()
time.sleep(1) time.sleep(1)
setY(y*2) setY(y*2)
time.sleep(1) time.sleep(1)
@@ -109,13 +113,15 @@ def startScanner(mode):
ws_message_queue.appendleft("<progress>" + str(scan_progress)) ws_message_queue.appendleft("<progress>" + str(scan_progress))
r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id) r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id)
setY(0) setY(0)
lidar.StopScanning() #lidar.StopScanning()
elif mode == "2": elif mode == "2":
ws_message_queue.appendleft("<scan>running") ws_message_queue.appendleft("<scan>running")
for y in range(361): for y in range(361):
if(stop_scan == True): if(stop_scan == True):
break break
gen = lidar.StartScanning()
sendData(next(gen),y*0.5) sendData(next(gen),y*0.5)
lidar.StopScanning()
time.sleep(1) time.sleep(1)
setY(y*0.5) setY(y*0.5)
time.sleep(1) time.sleep(1)
@@ -123,7 +129,7 @@ def startScanner(mode):
ws_message_queue.appendleft("<progress>" + str(scan_progress)) ws_message_queue.appendleft("<progress>" + str(scan_progress))
r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id) r = requests.put(url='http://localhost:35588/scandata/finished/'+scan_id)
setY(0) setY(0)
lidar.StopScanning() #lidar.StopScanning()
else: else:
ws_message_queue.appendleft("mode error") ws_message_queue.appendleft("mode error")
f.close() f.close()

View File

@@ -100,6 +100,8 @@ namespace PointCloudWeb.Server.Models
maxPoints = Points.Count; maxPoints = Points.Count;
var takeEvery = Points.Count / maxPoints; var takeEvery = Points.Count / maxPoints;
if (takeEvery < 1)
takeEvery = 1;
var count = 0; var count = 0;
for (var i = 0; i < Points.Count; i++) for (var i = 0; i < Points.Count; i++)

View File

@@ -104,8 +104,8 @@ namespace PointCloudWeb.Server.Services
public void PointCloudCompleted(Guid id) public void PointCloudCompleted(Guid id)
{ {
RegisterPointCloud(id);
GeneratePotreeData(id); GeneratePotreeData(id);
RegisterPointCloud(id);
} }
} }
} }