Merge commit '7b68bb4ebf024ebbce77682360fa921aefc220df'
| | |
| | | # data & image & microwave |
| | | Data |
| | | Images |
| | | Images* |
| | | Microwaves |
| | | Manual_Microwave* |
| | | |
| | |
| | | "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" |
| | |
| | | "console": "integratedTerminal" |
| | | }, |
| | | { |
| | | "name": "Server_local", |
| | | "name": "Server_test", |
| | | "type": "python", |
| | | "python": "${workspaceFolder}/env/aerial_deploy/python.exe", |
| | | "request": "launch", |
| | |
| | | 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/ |
| | | |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | if not exist %aerialpython% ( |
| | | call %envsetting% |
| | | ) |
| | | cd %~dp0 |
| | | echo change to path: %cd% |
| | | |
| | | set MQhost=localhost |
| | | set MQuser=chai |
| | |
| | | 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/ |
| | | |
| | |
| | | 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% |
| | |
| | | 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] |
| | |
| | | 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/ |
| | | |
| | |
| | | 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 |
| | | |
| | |
| | | |
| | | 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): |
| | |
| | | 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( |
| | |
| | | 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 |
| | |
| | | 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( |
| | |
| | | |
| | | # 发数据 |
| | | 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() |
| | | |
| | |
| | | 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__': |
| | |
| | | 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 |
| | | |
| | |
| | | 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) |
| | |
| | | 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)): |
| | |
| | | if not exist %aerialpython% ( |
| | | call %envsetting% |
| | | ) |
| | | cd %~dp0 |
| | | echo change to path: %cd% |
| | | |
| | | set MQhost=172.17.17.206 |
| | | set MQuser=chai |
| | |
| | | if not exist %aerialpython% ( |
| | | call %envsetting% |
| | | ) |
| | | cd %~dp0 |
| | | echo change to path: %cd% |
| | | |
| | | set MQhost=172.17.17.206 |
| | | set MQuser=chai |
| | |
| | | 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/ |
| | | |
| | |
| | | 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/ |
| | | |
| | |
| | | if not exist %aerialpython% ( |
| | | call %envsetting% |
| | | ) |
| | | cd %~dp0 |
| | | echo change to path: %cd% |
| | | |
| | | set MICROWAVEhost=192.168.2.65 |
| | | SET PACKETthreshold=1000 |