From 7b68bb4ebf024ebbce77682360fa921aefc220df Mon Sep 17 00:00:00 2001
From: LTY252628 <1213456414@qq.com>
Date: 星期二, 22 二月 2022 18:22:23 +0800
Subject: [PATCH] debug for dustcleaner
---
src/engine/DustCleaner.py | 4 +-
.gitignore | 1
src/engine/MessageQueueThread.py | 8 ++-
udp2bin.bat | 3 +
TEST_ply_show .bat | 5 ++
TEST_bin2ply.bat | 2 +
bin2ply.BAT | 2 +
src/engine/AcquisitionMain.py | 2
ply_show.bat | 2 +
src/engine/DeviceManager.py | 2
TEST_udp_get.bat | 6 ++-
TEST_startServer.bat | 2 +
startServer.bat | 2 +
udp2ply.bat | 3 +
udp_get.bat | 2 +
.vscode/launch.json | 8 ++--
TEST_udp2bin.bat | 2 +
src/Server.py | 4 +-
startClient.bat | 2 +
TEST_startClient.bat | 9 +++-
TEST_udp2ply.bat | 4 +
21 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/.gitignore b/.gitignore
index 7f4d4c8..ee27965 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
# data & image & microwave
Data
Images
+Images*
Microwaves
Manual_Microwave*
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 1d269bc..c0e1721 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -5,18 +5,18 @@
"version": "0.2.0",
"configurations": [
{
- "name": "Client_local",
+ "name": "Client_test",
"type": "python",
"request": "launch",
"python": "${workspaceFolder}/env/aerial_deploy/python.exe",
"program": "${workspaceFolder}/src/Client.py",
"args": [
- "localhost",
+ "192.168.1.224",
"chai",
"password123",
"aerial_rpc",
"pod1",
- "http://localhost/api",
+ "http://192.168.1.224/api",
"localhost"
],
"console": "integratedTerminal"
@@ -39,7 +39,7 @@
"console": "integratedTerminal"
},
{
- "name": "Server_local",
+ "name": "Server_test",
"type": "python",
"python": "${workspaceFolder}/env/aerial_deploy/python.exe",
"request": "launch",
diff --git a/TEST_bin2ply.bat b/TEST_bin2ply.bat
index d7ec3bc..c5e9f1b 100644
--- a/TEST_bin2ply.bat
+++ b/TEST_bin2ply.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set BINfolder=./Manual_Microwave_test/pod1-2022-02-21-15-34-45/
diff --git a/TEST_ply_show .bat b/TEST_ply_show .bat
index fe15b2f..aefd521 100644
--- a/TEST_ply_show .bat
+++ b/TEST_ply_show .bat
@@ -12,7 +12,10 @@
call %envsetting%
)
-set PLYfile=./Manual_Microwave_test/pod1-2022-02-21-15-34-45/2522.ply
+cd %~dp0
+echo change to path: %cd%
+
+set PLYfile=./Manual_Microwave_test/pod1-2022-02-22-15-44-51/28344.ply
@REM -------------- Usage: plot_ply.py [PLYfile]"
%aerialpython% ./src/utils/plot_ply.py %PLYfile%
pause
\ No newline at end of file
diff --git a/TEST_startClient.bat b/TEST_startClient.bat
index a736226..69df83a 100644
--- a/TEST_startClient.bat
+++ b/TEST_startClient.bat
@@ -12,19 +12,22 @@
call %envsetting%
)
-set MQhost=localhost
+set MQhost=192.168.1.224
set MQuser=chai
set MQpassword=password123
set QUEUEname=aerial_rpc
set DEVICEname=pod1
-set SERVERhost=http://localhost/api
+set SERVERhost=http://192.168.1.224/api
set MICROWAVEhost=localhost
set LOGfile=ClientTEST.log
+cd %~dp0
+echo change to path: %cd%
@REM Launch the Client
echo the log file will be saved in the [%LOGfile%] file
echo Client.py is running ...
@REM -------- Usage: Client.py [MQhost] [MQuser] [MQpassword] [QUEUEname] [DEVICEname] [SERVERhost] [MICROWAVEhost]
-%aerialpython% ./src/Client.py %MQhost% %MQuser% %MQpassword% %QUEUEname% %DEVICEname% %SERVERhost% %MICROWAVEhost% >> %LOGfile%
+@REM %aerialpython% ./src/Client.py %MQhost% %MQuser% %MQpassword% %QUEUEname% %DEVICEname% %SERVERhost% %MICROWAVEhost% >> %LOGfile%
+%aerialpython% ./src/Client.py %MQhost% %MQuser% %MQpassword% %QUEUEname% %DEVICEname% %SERVERhost% %MICROWAVEhost%
echo Client.py has been terminited.
pause
diff --git a/TEST_startServer.bat b/TEST_startServer.bat
index e0f64a3..30abc3a 100644
--- a/TEST_startServer.bat
+++ b/TEST_startServer.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set MQhost=localhost
set MQuser=chai
diff --git a/TEST_udp2bin.bat b/TEST_udp2bin.bat
index f13891b..695816f 100644
--- a/TEST_udp2bin.bat
+++ b/TEST_udp2bin.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set UDPfolder=./Manual_Microwave_test/pod1-2022-02-21-15-34-45/
diff --git a/TEST_udp2ply.bat b/TEST_udp2ply.bat
index c25a644..8b6fec7 100644
--- a/TEST_udp2ply.bat
+++ b/TEST_udp2ply.bat
@@ -11,8 +11,10 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
-set UDPfolder=./Manual_Microwave_test/pod1-2022-02-21-15-34-45/
+set UDPfolder=./Manual_Microwave_test/pod1-2022-02-22-15-44-51/
@REM ---------------Usage: udp2bin.py [UDPfolder]
%aerialpython% ./src/utils/udp2bin.py %UDPfolder%
diff --git a/TEST_udp_get.bat b/TEST_udp_get.bat
index 6892db0..183989d 100644
--- a/TEST_udp_get.bat
+++ b/TEST_udp_get.bat
@@ -11,9 +11,11 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
-set MICROWAVEhost=172.17.17.206
-SET PACKETthreshold=100
+set MICROWAVEhost=192.168.2.65
+SET PACKETthreshold=1000
SET DEVICEname=pod1
SET SAVEfolder=./Manual_Microwave_test
@REM ---------------Usage: udp_get.py [MICROWAVEhost] [PACKETthreshold] [DEVICEname] [SAVEfolder]
diff --git a/bin2ply.BAT b/bin2ply.BAT
index 55edffe..a36a6f1 100644
--- a/bin2ply.BAT
+++ b/bin2ply.BAT
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
@REM please the folder path of the bin files.
@REM set BINfolder=./Manual_Microwave/pod1-2012-12-12-12-12-12/
diff --git a/ply_show.bat b/ply_show.bat
index 3237955..672b8c6 100644
--- a/ply_show.bat
+++ b/ply_show.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
@REM please the folder path of the bin files.
@REM set PLYfile=./Manual_Microwave/pod1-2022-02-21-15-34-45/2522.ply
diff --git a/src/Server.py b/src/Server.py
index 511d04c..b2e41a4 100644
--- a/src/Server.py
+++ b/src/Server.py
@@ -63,7 +63,7 @@
def run_rabbitmq(self, host: str, user: str, password: str, queue: str) -> None:
self._message_queue_thread = MessageQueueThread(
- host, user, password, queue, self._device_manager)
+ host, user, password, queue, self._device_manager, save_folder)
self._message_queue_thread.start()
def run_all(self):
@@ -71,7 +71,7 @@
self.run(debug=False, host="0.0.0.0", port=self.port)
def send_controll_message(self, device_id, msg):
- device = self._device_manager.get_device(device_id)
+ device = self._device_manager.get_device(device_id,save_folder)
if device is None:
channel = device.controll_channel
channel.basic_publish(
diff --git a/src/engine/AcquisitionMain.py b/src/engine/AcquisitionMain.py
index 24f9c01..4373fa6 100644
--- a/src/engine/AcquisitionMain.py
+++ b/src/engine/AcquisitionMain.py
@@ -239,7 +239,7 @@
if not self.msg_queue.empty():
msg = self.msg_queue.get()
self._send_data(msg)
- print("send message")
+ print(time.asctime(), "send message")
time.sleep(0.1)
except Exception as e:
break
diff --git a/src/engine/DeviceManager.py b/src/engine/DeviceManager.py
index 715cc21..e0ccb19 100644
--- a/src/engine/DeviceManager.py
+++ b/src/engine/DeviceManager.py
@@ -25,7 +25,7 @@
start = datetime.datetime.now()
if not os.path.exists(save_folder):
os.mkdir(save_folder)
- path = os,path.join(save_folder,f"{device_id}-{start.strftime('%Y-%m-%d-%H-%M-%S')}")
+ path = os.path.join(save_folder,f"{device_id}-{start.strftime('%Y-%m-%d-%H-%M-%S')}")
if not os.path.exists(path):
os.mkdir(path)
device = dict(
diff --git a/src/engine/DustCleaner.py b/src/engine/DustCleaner.py
index 620a086..27533c8 100644
--- a/src/engine/DustCleaner.py
+++ b/src/engine/DustCleaner.py
@@ -55,7 +55,7 @@
# 鍙戞暟鎹�
def Send(self, data):
- if (not self.com_port is None) and self.com_port.is_open():
+ if (not self.com_port is None) and self.com_port.is_open:
self.com_port.write(data)
self.Recive()
@@ -97,7 +97,7 @@
self.SendNoChecksum(bytes([0x5A, 0x07, 0x73, start_angle, end_angle, num, 0x00]))
def Recive(self):
- return self.main_engine.read_all()
+ return self.com_port.read_all()
if __name__ == '__main__':
diff --git a/src/engine/MessageQueueThread.py b/src/engine/MessageQueueThread.py
index d72f7df..16396af 100644
--- a/src/engine/MessageQueueThread.py
+++ b/src/engine/MessageQueueThread.py
@@ -19,9 +19,11 @@
user: str,
password: str,
queue: str,
- device_manager: DeviceManager):
+ device_manager: DeviceManager,
+ save_folder: str):
threading.Thread.__init__(self)
self._device_manager = device_manager
+ self.save_folder = save_folder
self._def_routes()
self.message_received: int = 0
@@ -58,7 +60,7 @@
print(
f'send image sub command received, length={req.data1.length}')
if req.data1.length > 0:
- device = self._device_manager.get_device(req.device_id)
+ device = self._device_manager.get_device(req.device_id, self.save_folder)
img_msg = pb.ImagesMessage()
img_msg.ParseFromString(req.data1.data)
# print(img_msg.image1)
@@ -74,7 +76,7 @@
print('micro wave command')
if pb.SubCommand.MICRO_WAVE_SUB_COMMAND == req.sub_command:
print('micro wave sub command received')
- device = self._device_manager.get_device(req.device_id)
+ device = self._device_manager.get_device(req.device_id,self.save_folder)
micro_wave_msg = pb.MicroWaveMessage()
micro_wave_msg.ParseFromString(req.data1.data)
if (micro_wave_msg.length == len(micro_wave_msg.data)):
diff --git a/startClient.bat b/startClient.bat
index 3201c92..e4b047a 100644
--- a/startClient.bat
+++ b/startClient.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set MQhost=172.17.17.206
set MQuser=chai
diff --git a/startServer.bat b/startServer.bat
index 060ec13..95d0c07 100644
--- a/startServer.bat
+++ b/startServer.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set MQhost=172.17.17.206
set MQuser=chai
diff --git a/udp2bin.bat b/udp2bin.bat
index f4b8353..f7efa92 100644
--- a/udp2bin.bat
+++ b/udp2bin.bat
@@ -12,6 +12,9 @@
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
+
@REM please the folder path of the udp files.
@REM set UDPfolder=./Manual_Microwave/pod1-2012-12-12-12-12-12/
diff --git a/udp2ply.bat b/udp2ply.bat
index 5354a5d..50f393e 100644
--- a/udp2ply.bat
+++ b/udp2ply.bat
@@ -12,6 +12,9 @@
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
+
@REM please the folder path of the udp files.
@REM set UDPfolder=./Manual_Microwave/pod1-2012-12-12-12-12-12/
diff --git a/udp_get.bat b/udp_get.bat
index 987fdce..363fa14 100644
--- a/udp_get.bat
+++ b/udp_get.bat
@@ -11,6 +11,8 @@
if not exist %aerialpython% (
call %envsetting%
)
+cd %~dp0
+echo change to path: %cd%
set MICROWAVEhost=192.168.2.65
SET PACKETthreshold=1000
--
Gitblit v1.9.1