pymammotion 0.0.40__py3-none-any.whl → 0.0.41__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymammotion might be problematic. Click here for more details.
- pymammotion/__init__.py +4 -2
- pymammotion/aliyun/__init__.py +1 -0
- pymammotion/aliyun/cloud_gateway.py +74 -95
- pymammotion/aliyun/tmp_constant.py +2 -6
- pymammotion/bluetooth/ble.py +4 -12
- pymammotion/bluetooth/ble_message.py +12 -36
- pymammotion/bluetooth/data/convert.py +1 -3
- pymammotion/bluetooth/data/notifydata.py +0 -1
- pymammotion/data/model/device.py +62 -3
- pymammotion/data/model/hash_list.py +34 -14
- pymammotion/data/model/location.py +40 -0
- pymammotion/data/model/rapid_state.py +1 -5
- pymammotion/data/state_manager.py +84 -0
- pymammotion/event/event.py +18 -3
- pymammotion/http/http.py +2 -6
- pymammotion/mammotion/commands/mammotion_command.py +1 -3
- pymammotion/mammotion/commands/messages/driver.py +7 -21
- pymammotion/mammotion/commands/messages/media.py +4 -9
- pymammotion/mammotion/commands/messages/navigation.py +42 -107
- pymammotion/mammotion/commands/messages/network.py +10 -30
- pymammotion/mammotion/commands/messages/system.py +11 -26
- pymammotion/mammotion/commands/messages/video.py +1 -3
- pymammotion/mammotion/control/joystick.py +9 -33
- pymammotion/mammotion/devices/__init__.py +5 -1
- pymammotion/mammotion/devices/{luba.py → mammotion.py} +299 -110
- pymammotion/mqtt/__init__.py +5 -0
- pymammotion/mqtt/{mqtt.py → mammotion_mqtt.py} +46 -50
- pymammotion/utility/constant/device_constant.py +14 -0
- pymammotion/utility/datatype_converter.py +52 -9
- pymammotion/utility/device_type.py +129 -20
- pymammotion/utility/periodic.py +65 -0
- pymammotion/utility/rocker_util.py +63 -4
- {pymammotion-0.0.40.dist-info → pymammotion-0.0.41.dist-info}/METADATA +10 -4
- {pymammotion-0.0.40.dist-info → pymammotion-0.0.41.dist-info}/RECORD +36 -34
- {pymammotion-0.0.40.dist-info → pymammotion-0.0.41.dist-info}/WHEEL +1 -1
- pymammotion/luba/_init_.py +0 -0
- pymammotion/luba/base.py +0 -52
- {pymammotion-0.0.40.dist-info → pymammotion-0.0.41.dist-info}/LICENSE +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# === sendOrderMsg_Nav ===
|
|
2
2
|
import logging
|
|
3
|
+
import time
|
|
3
4
|
from abc import ABC
|
|
4
5
|
from typing import List
|
|
5
6
|
|
|
@@ -40,15 +41,14 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
40
41
|
version=1,
|
|
41
42
|
subtype=1,
|
|
42
43
|
nav=build,
|
|
44
|
+
timestamp=round(time.time() * 1000),
|
|
43
45
|
)
|
|
44
46
|
|
|
45
47
|
return luba_msg.SerializeToString()
|
|
46
48
|
|
|
47
49
|
def allpowerfull_rw_adapter_x3(self, id: int, context: int, rw: int) -> bytes:
|
|
48
50
|
build = MctlNav(nav_sys_param_cmd=NavSysParamMsg(id=id, context=context, rw=rw))
|
|
49
|
-
logger.debug(
|
|
50
|
-
f"Send command--9 general read and write command id={id}, context={context}, rw={rw}"
|
|
51
|
-
)
|
|
51
|
+
logger.debug(f"Send command--9 general read and write command id={id}, context={context}, rw={rw}")
|
|
52
52
|
return self.send_order_msg_nav(build)
|
|
53
53
|
|
|
54
54
|
def along_border(self):
|
|
@@ -83,9 +83,7 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
83
83
|
|
|
84
84
|
def out_drop_dumping_add(self):
|
|
85
85
|
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=15, type=12))
|
|
86
|
-
logger.debug(
|
|
87
|
-
"Send command--Complete external grass collection point marking operation"
|
|
88
|
-
)
|
|
86
|
+
logger.debug("Send command--Complete external grass collection point marking operation")
|
|
89
87
|
return self.send_order_msg_nav(build)
|
|
90
88
|
|
|
91
89
|
def recover_dumping(self):
|
|
@@ -124,22 +122,14 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
124
122
|
return self.send_order_msg_nav(build)
|
|
125
123
|
|
|
126
124
|
def set_edit_boundary(self, action: int):
|
|
127
|
-
build = MctlNav(
|
|
128
|
-
todev_get_commondata=NavGetCommData(pver=1, action=action, type=0)
|
|
129
|
-
)
|
|
125
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=action, type=0))
|
|
130
126
|
logger.debug(f"Sending secondary editing command action={action}")
|
|
131
127
|
return self.send_order_msg_nav(build)
|
|
132
128
|
|
|
133
129
|
def set_data_synchronization(self, type: int):
|
|
134
|
-
logger.debug(
|
|
135
|
-
|
|
136
|
-
)
|
|
137
|
-
build = MctlNav(
|
|
138
|
-
todev_get_commondata=NavGetCommData(pver=1, action=12, type=type)
|
|
139
|
-
)
|
|
140
|
-
logger.debug(
|
|
141
|
-
"Sync data ==================== Sending ============ Restore command"
|
|
142
|
-
)
|
|
130
|
+
logger.debug(f"Sync data ==================== Sending ============ Restore command: {type}")
|
|
131
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=12, type=type))
|
|
132
|
+
logger.debug("Sync data ==================== Sending ============ Restore command")
|
|
143
133
|
return self.send_order_msg_nav(build)
|
|
144
134
|
|
|
145
135
|
def send_plan(self, plan_bean: Plan) -> bytes:
|
|
@@ -223,30 +213,19 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
223
213
|
return self.send_order_msg_nav(MctlNav(todev_planjob_set=build))
|
|
224
214
|
|
|
225
215
|
def single_schedule(self, plan_id: str) -> bytes:
|
|
226
|
-
return self.send_order_msg_nav(
|
|
227
|
-
MctlNav(plan_task_execute=NavPlanTaskExecute(sub_cmd=1, id=plan_id))
|
|
228
|
-
)
|
|
216
|
+
return self.send_order_msg_nav(MctlNav(plan_task_execute=NavPlanTaskExecute(sub_cmd=1, id=plan_id)))
|
|
229
217
|
|
|
230
|
-
def read_plan(self, sub_cmd: int, plan_index: int) -> bytes:
|
|
231
|
-
build = MctlNav(
|
|
232
|
-
|
|
233
|
-
)
|
|
234
|
-
logger.debug(f"Send read job plan command cmd={
|
|
235
|
-
sub_cmd} PlanIndex = {plan_index}")
|
|
218
|
+
def read_plan(self, sub_cmd: int, plan_index: int = 0) -> bytes:
|
|
219
|
+
build = MctlNav(todev_planjob_set=NavPlanJobSet(sub_cmd=sub_cmd, plan_index=plan_index))
|
|
220
|
+
logger.debug(f"Send read job plan command cmd={sub_cmd} PlanIndex = {plan_index}")
|
|
236
221
|
return self.send_order_msg_nav(build)
|
|
237
222
|
|
|
238
223
|
def delete_plan(self, sub_cmd: int, plan_id: str) -> bytes:
|
|
239
|
-
build = MctlNav(
|
|
240
|
-
|
|
241
|
-
)
|
|
242
|
-
logger.debug(
|
|
243
|
-
f"Send command--Send delete job plan command cmd={sub_cmd} planId = {plan_id}"
|
|
244
|
-
)
|
|
224
|
+
build = MctlNav(todev_planjob_set=NavPlanJobSet(sub_cmd=sub_cmd, plan_id=plan_id))
|
|
225
|
+
logger.debug(f"Send command--Send delete job plan command cmd={sub_cmd} planId = {plan_id}")
|
|
245
226
|
return self.send_order_msg_nav(build)
|
|
246
227
|
|
|
247
|
-
def set_plan_unable_time(
|
|
248
|
-
self, sub_cmd: int, device_id: str, unable_end_time: str, unable_start_time: str
|
|
249
|
-
) -> bytes:
|
|
228
|
+
def set_plan_unable_time(self, sub_cmd: int, device_id: str, unable_end_time: str, unable_start_time: str) -> bytes:
|
|
250
229
|
build = NavUnableTimeSet(
|
|
251
230
|
sub_cmd=sub_cmd,
|
|
252
231
|
device_id=device_id,
|
|
@@ -265,16 +244,10 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
265
244
|
return self.send_order_msg_nav(build2)
|
|
266
245
|
|
|
267
246
|
def query_job_history(self) -> bytes:
|
|
268
|
-
return self.send_order_msg_nav(
|
|
269
|
-
MctlNav(todev_work_report_update_cmd=WorkReportUpdateCmd(sub_cmd=1))
|
|
270
|
-
)
|
|
247
|
+
return self.send_order_msg_nav(MctlNav(todev_work_report_update_cmd=WorkReportUpdateCmd(sub_cmd=1)))
|
|
271
248
|
|
|
272
249
|
def request_job_history(self, num: int) -> bytes:
|
|
273
|
-
return self.send_order_msg_nav(
|
|
274
|
-
MctlNav(
|
|
275
|
-
todev_work_report_cmd=WorkReportCmdData(sub_cmd=1, get_info_num=num)
|
|
276
|
-
)
|
|
277
|
-
)
|
|
250
|
+
return self.send_order_msg_nav(MctlNav(todev_work_report_cmd=WorkReportCmdData(sub_cmd=1, get_info_num=num)))
|
|
278
251
|
|
|
279
252
|
def leave_dock(self):
|
|
280
253
|
build = MctlNav(todev_one_touch_leave_pile=1)
|
|
@@ -283,45 +256,37 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
283
256
|
|
|
284
257
|
def get_all_boundary_hash_list(self, sub_cmd: int):
|
|
285
258
|
build = MctlNav(todev_gethash=NavGetHashList(pver=1, sub_cmd=sub_cmd))
|
|
286
|
-
logger.debug(f"Area loading=====================:Get area hash list++Bluetooth:{
|
|
287
|
-
sub_cmd}")
|
|
259
|
+
logger.debug(f"Area loading=====================:Get area hash list++Bluetooth:{sub_cmd}")
|
|
288
260
|
return self.send_order_msg_nav(build)
|
|
289
261
|
|
|
290
262
|
def get_hash_response(self, total_frame: int, current_frame: int):
|
|
291
263
|
build = MctlNav(
|
|
292
|
-
todev_gethash=NavGetHashList(
|
|
293
|
-
|
|
294
|
-
|
|
264
|
+
todev_gethash=NavGetHashList(pver=1, sub_cmd=2, current_frame=current_frame, total_frame=total_frame)
|
|
265
|
+
)
|
|
266
|
+
logger.debug(
|
|
267
|
+
f"Send command--208 Response hash list command totalFrame={total_frame},currentFrame={current_frame}"
|
|
295
268
|
)
|
|
296
|
-
logger.debug(f"Send command--208 Response hash list command totalFrame={
|
|
297
|
-
total_frame},currentFrame={current_frame}")
|
|
298
269
|
return self.send_order_msg_nav(build)
|
|
299
270
|
|
|
300
271
|
def synchronize_hash_data(self, hash_num: int):
|
|
301
|
-
build = MctlNav(
|
|
302
|
-
todev_get_commondata=NavGetCommData(
|
|
303
|
-
pver=1, action=8, data_hash=hash_num, sub_cmd=1
|
|
304
|
-
)
|
|
305
|
-
)
|
|
272
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=8, hash=hash_num, sub_cmd=1))
|
|
306
273
|
logger.debug(f"Send command--209,hash synchronize area data hash:{hash}")
|
|
307
274
|
return self.send_order_msg_nav(build)
|
|
308
275
|
|
|
309
276
|
def get_area_to_be_transferred(self):
|
|
310
|
-
build = MctlNav(
|
|
311
|
-
todev_get_commondata=NavGetCommData(pver=1, action=8, sub_cmd=1, type=3)
|
|
312
|
-
)
|
|
277
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=8, sub_cmd=1, type=3))
|
|
313
278
|
logger.debug("Send command--Get transfer area before charging pile")
|
|
314
279
|
return self.send_order_msg_nav(build)
|
|
315
280
|
|
|
316
|
-
def get_regional_data(self,
|
|
281
|
+
def get_regional_data(self, regional_data: RegionData):
|
|
317
282
|
build = MctlNav(
|
|
318
283
|
todev_get_commondata=NavGetCommData(
|
|
319
284
|
pver=1,
|
|
320
|
-
action=
|
|
321
|
-
type=
|
|
322
|
-
|
|
323
|
-
total_frame=
|
|
324
|
-
current_frame=
|
|
285
|
+
action=regional_data.action,
|
|
286
|
+
type=regional_data.type,
|
|
287
|
+
hash=regional_data.hash,
|
|
288
|
+
total_frame=regional_data.total_frame,
|
|
289
|
+
current_frame=regional_data.current_frame,
|
|
325
290
|
sub_cmd=2,
|
|
326
291
|
)
|
|
327
292
|
)
|
|
@@ -334,43 +299,27 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
334
299
|
return self.send_order_msg_nav(build)
|
|
335
300
|
|
|
336
301
|
def send_tools_order(self, param_id: int, values: List[int]):
|
|
337
|
-
build = MctlNav(
|
|
338
|
-
simulation_cmd=SimulationCmdData(
|
|
339
|
-
sub_cmd=2, param_id=param_id, param_value=values
|
|
340
|
-
)
|
|
341
|
-
)
|
|
302
|
+
build = MctlNav(simulation_cmd=SimulationCmdData(sub_cmd=2, param_id=param_id, param_value=values))
|
|
342
303
|
logger.debug(f"Send command--Send tool command id={param_id},values={values}")
|
|
343
304
|
return self.send_order_msg_nav(build)
|
|
344
305
|
|
|
345
306
|
def end_draw_border(self, type: int):
|
|
346
307
|
if type == -1:
|
|
347
308
|
return
|
|
348
|
-
build = MctlNav(
|
|
349
|
-
|
|
350
|
-
)
|
|
351
|
-
logger.debug(
|
|
352
|
-
f"Send command--End drawing boundary, obstacle, channel command type={type}"
|
|
353
|
-
)
|
|
309
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=1, type=type))
|
|
310
|
+
logger.debug(f"Send command--End drawing boundary, obstacle, channel command type={type}")
|
|
354
311
|
return self.send_order_msg_nav(build)
|
|
355
312
|
|
|
356
313
|
def cancel_current_record(self):
|
|
357
|
-
build = MctlNav(
|
|
358
|
-
todev_get_commondata=NavGetCommData(pver=1, action=7, sub_cmd=0)
|
|
359
|
-
)
|
|
314
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=7, sub_cmd=0))
|
|
360
315
|
logger.debug("Send command--Cancel current recording (boundary, obstacle)")
|
|
361
316
|
return self.send_order_msg_nav(build)
|
|
362
317
|
|
|
363
318
|
def delete_map_elements(self, type: int, hash_num: int):
|
|
364
319
|
if type == -1:
|
|
365
320
|
return
|
|
366
|
-
build = MctlNav(
|
|
367
|
-
|
|
368
|
-
pver=1, action=6, type=type, hash=hash_num
|
|
369
|
-
)
|
|
370
|
-
)
|
|
371
|
-
logger.debug(
|
|
372
|
-
f"Send command--Delete boundary or obstacle or channel command type={type},hash={hash}"
|
|
373
|
-
)
|
|
321
|
+
build = MctlNav(todev_get_commondata=NavGetCommData(pver=1, action=6, type=type, hash=hash_num))
|
|
322
|
+
logger.debug(f"Send command--Delete boundary or obstacle or channel command type={type},hash={hash}")
|
|
374
323
|
return self.send_order_msg_nav(build)
|
|
375
324
|
|
|
376
325
|
def delete_charge_point(self):
|
|
@@ -390,9 +339,7 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
390
339
|
logger.debug("Send command--Clear job data")
|
|
391
340
|
return self.send_order_msg_nav(build)
|
|
392
341
|
|
|
393
|
-
def generate_route_information(
|
|
394
|
-
self, generate_route_information: GenerateRouteInformation
|
|
395
|
-
):
|
|
342
|
+
def generate_route_information(self, generate_route_information: GenerateRouteInformation):
|
|
396
343
|
logger.debug(f"Generate route data source:{generate_route_information}")
|
|
397
344
|
build = NavReqCoverPath(
|
|
398
345
|
pver=1,
|
|
@@ -415,9 +362,7 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
415
362
|
generate_route_information}")
|
|
416
363
|
return self.send_order_msg_nav(MctlNav(bidire_reqconver_path=build))
|
|
417
364
|
|
|
418
|
-
def modify_generate_route_information(
|
|
419
|
-
self, generate_route_information: GenerateRouteInformation
|
|
420
|
-
):
|
|
365
|
+
def modify_generate_route_information(self, generate_route_information: GenerateRouteInformation):
|
|
421
366
|
logger.debug(f"Generate route data source: {generate_route_information}")
|
|
422
367
|
build = NavReqCoverPath(
|
|
423
368
|
pver=1,
|
|
@@ -442,9 +387,7 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
442
387
|
build = NavReqCoverPath(pver=1, sub_cmd=9)
|
|
443
388
|
logger.debug(f"{self.get_device_name()} Generate route ===== {build}")
|
|
444
389
|
build2 = MctlNav(bidire_reqconver_path=build)
|
|
445
|
-
logger.debug(
|
|
446
|
-
"Send command -- End generating route information generate_route_information="
|
|
447
|
-
)
|
|
390
|
+
logger.debug("Send command -- End generating route information generate_route_information=")
|
|
448
391
|
return self.send_order_msg_nav(build2)
|
|
449
392
|
|
|
450
393
|
def query_generate_route_information(self):
|
|
@@ -456,14 +399,8 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
456
399
|
|
|
457
400
|
def get_line_info(self, current_hash: int) -> bytes:
|
|
458
401
|
logger.debug(f"Sending==========Get route command: {current_hash}")
|
|
459
|
-
build = MctlNav(
|
|
460
|
-
|
|
461
|
-
pver=1, current_hash=current_hash, sub_cmd=0
|
|
462
|
-
)
|
|
463
|
-
)
|
|
464
|
-
logger.debug(
|
|
465
|
-
f"Sending command--Get route data corresponding to hash={current_hash}"
|
|
466
|
-
)
|
|
402
|
+
build = MctlNav(todev_zigzag_ack=NavUploadZigZagResultAck(pver=1, current_hash=current_hash, sub_cmd=0))
|
|
403
|
+
logger.debug(f"Sending command--Get route data corresponding to hash={current_hash}")
|
|
467
404
|
return self.send_order_msg_nav(build)
|
|
468
405
|
|
|
469
406
|
def get_line_info_list(self, hash_list: List[int], transaction_id: int) -> bytes:
|
|
@@ -473,9 +410,7 @@ class MessageNavigation(AbstractMessage, ABC):
|
|
|
473
410
|
pver=1, hash_list=hash_list, transaction_id=transaction_id, sub_cmd=0
|
|
474
411
|
)
|
|
475
412
|
)
|
|
476
|
-
logger.debug(
|
|
477
|
-
f"Sending command--Get route data corresponding to hash={hash_list}"
|
|
478
|
-
)
|
|
413
|
+
logger.debug(f"Sending command--Get route data corresponding to hash={hash_list}")
|
|
479
414
|
return self.send_order_msg_nav(build)
|
|
480
415
|
|
|
481
416
|
def start_job(self) -> bytes:
|
|
@@ -33,16 +33,12 @@ class MessageNetwork:
|
|
|
33
33
|
return self.send_order_msg_net(net)
|
|
34
34
|
|
|
35
35
|
def get_4g_module_info(self):
|
|
36
|
-
build = dev_net_pb2.DevNet(
|
|
37
|
-
todev_get_mnet_cfg_req=dev_net_pb2.DevNet().todev_get_mnet_cfg_req
|
|
38
|
-
)
|
|
36
|
+
build = dev_net_pb2.DevNet(todev_get_mnet_cfg_req=dev_net_pb2.DevNet().todev_get_mnet_cfg_req)
|
|
39
37
|
print("Send command -- Get device 4G network module information")
|
|
40
38
|
return self.send_order_msg_net(build)
|
|
41
39
|
|
|
42
40
|
def get_4g_info(self):
|
|
43
|
-
build = dev_net_pb2.DevNet(
|
|
44
|
-
todev_mnet_info_req=dev_net_pb2.DevNet().todev_mnet_info_req
|
|
45
|
-
)
|
|
41
|
+
build = dev_net_pb2.DevNet(todev_mnet_info_req=dev_net_pb2.DevNet().todev_mnet_info_req)
|
|
46
42
|
print("Send command -- Get device 4G network information")
|
|
47
43
|
return self.send_order_msg_net(build)
|
|
48
44
|
|
|
@@ -82,9 +78,7 @@ class MessageNetwork:
|
|
|
82
78
|
print(
|
|
83
79
|
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
84
80
|
)
|
|
85
|
-
return self.send_order_msg_net(
|
|
86
|
-
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
87
|
-
)
|
|
81
|
+
return self.send_order_msg_net(dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build))
|
|
88
82
|
|
|
89
83
|
def set_device_socket_request(
|
|
90
84
|
self,
|
|
@@ -107,9 +101,7 @@ class MessageNetwork:
|
|
|
107
101
|
print(
|
|
108
102
|
f"Send log====Feedback====Command======requestID:{request_id} operation:{operation} serverIp:{server_ip} type:{type}"
|
|
109
103
|
)
|
|
110
|
-
return self.send_order_msg_net(
|
|
111
|
-
dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build)
|
|
112
|
-
)
|
|
104
|
+
return self.send_order_msg_net(dev_net_pb2.DevNet(todev_ble_sync=1, todev_uploadfile_req=build))
|
|
113
105
|
|
|
114
106
|
def get_device_log_info(self, biz_id: str, type: int, log_url: str) -> bytes:
|
|
115
107
|
"""Get device log info (bluetooth only)."""
|
|
@@ -129,15 +121,11 @@ class MessageNetwork:
|
|
|
129
121
|
def cancel_log_update(self, biz_id: str):
|
|
130
122
|
"""Cancel log update (bluetooth only)."""
|
|
131
123
|
return self.send_order_msg_net(
|
|
132
|
-
dev_net_pb2.DevNet(
|
|
133
|
-
todev_log_data_cancel=dev_net_pb2.DrvUploadFileCancel(bizId=biz_id)
|
|
134
|
-
)
|
|
124
|
+
dev_net_pb2.DevNet(todev_log_data_cancel=dev_net_pb2.DrvUploadFileCancel(bizId=biz_id))
|
|
135
125
|
)
|
|
136
126
|
|
|
137
127
|
def get_device_network_info(self):
|
|
138
|
-
build = dev_net_pb2.DevNet(
|
|
139
|
-
todev_networkinfo_req=dev_net_pb2.GetNetworkInfoReq(req_ids=1)
|
|
140
|
-
)
|
|
128
|
+
build = dev_net_pb2.DevNet(todev_networkinfo_req=dev_net_pb2.GetNetworkInfoReq(req_ids=1))
|
|
141
129
|
print("Send command - get device network information")
|
|
142
130
|
return self.send_order_msg_net(build)
|
|
143
131
|
|
|
@@ -159,13 +147,9 @@ class MessageNetwork:
|
|
|
159
147
|
def set_device_wifi_enable_status(self, new_wifi_status: bool):
|
|
160
148
|
build = dev_net_pb2.DevNet(
|
|
161
149
|
todev_ble_sync=1,
|
|
162
|
-
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
163
|
-
configParam=4, wifi_enable=new_wifi_status
|
|
164
|
-
),
|
|
165
|
-
)
|
|
166
|
-
print(
|
|
167
|
-
f"szNetwork: Send command - set network (on/off status). newWifiStatus={new_wifi_status}"
|
|
150
|
+
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(configParam=4, wifi_enable=new_wifi_status),
|
|
168
151
|
)
|
|
152
|
+
print(f"szNetwork: Send command - set network (on/off status). newWifiStatus={new_wifi_status}")
|
|
169
153
|
return self.send_order_msg_net(build)
|
|
170
154
|
|
|
171
155
|
def wifi_connectinfo_update(self, device_name: str, is_binary: bool):
|
|
@@ -189,9 +173,7 @@ class MessageNetwork:
|
|
|
189
173
|
def get_record_wifi_list(self, is_binary: bool):
|
|
190
174
|
print(f"getRecordWifiList().isBinary={is_binary}")
|
|
191
175
|
if is_binary:
|
|
192
|
-
build = dev_net_pb2.DevNet(
|
|
193
|
-
todev_ble_sync=1, todev_WifiListUpload=dev_net_pb2.DrvWifiList()
|
|
194
|
-
)
|
|
176
|
+
build = dev_net_pb2.DevNet(todev_ble_sync=1, todev_WifiListUpload=dev_net_pb2.DrvWifiList())
|
|
195
177
|
print("Send command - get memorized WiFi list upload command")
|
|
196
178
|
return self.send_order_msg_net(build)
|
|
197
179
|
self.get_record_wifi_list2()
|
|
@@ -205,9 +187,7 @@ class MessageNetwork:
|
|
|
205
187
|
if is_binary:
|
|
206
188
|
build = dev_net_pb2.DevNet(
|
|
207
189
|
todev_ble_sync=1,
|
|
208
|
-
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(
|
|
209
|
-
configParam=status, Confssid=ssid
|
|
210
|
-
),
|
|
190
|
+
todev_Wifi_Configuration=dev_net_pb2.DrvWifiSet(configParam=status, Confssid=ssid),
|
|
211
191
|
)
|
|
212
192
|
print(
|
|
213
193
|
f"Send command - set network (disconnect, direct connect, forget, no operation reconnect) operation command (downlink ssid={ssid}, status={status})"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# === sendOrderMsg_Sys ===
|
|
2
2
|
import datetime
|
|
3
|
+
from abc import ABC
|
|
3
4
|
from typing import List
|
|
4
5
|
|
|
5
6
|
from pymammotion.mammotion.commands.abstract_message import AbstractMessage
|
|
@@ -9,7 +10,7 @@ from pymammotion.proto.mctrl_sys import RptInfoType
|
|
|
9
10
|
from pymammotion.utility.device_type import DeviceType
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class MessageSystem(AbstractMessage):
|
|
13
|
+
class MessageSystem(AbstractMessage, ABC):
|
|
13
14
|
messageNavigation: MessageNavigation = MessageNavigation()
|
|
14
15
|
|
|
15
16
|
def send_order_msg_sys(self, sys):
|
|
@@ -37,9 +38,7 @@ class MessageSystem(AbstractMessage):
|
|
|
37
38
|
|
|
38
39
|
def get_device_product_model(self):
|
|
39
40
|
return self.send_order_msg_sys(
|
|
40
|
-
mctrl_sys_pb2.MctlSys(
|
|
41
|
-
device_product_type_info=mctrl_sys_pb2.device_product_type_info_t()
|
|
42
|
-
),
|
|
41
|
+
mctrl_sys_pb2.MctlSys(device_product_type_info=mctrl_sys_pb2.device_product_type_info_t()),
|
|
43
42
|
12,
|
|
44
43
|
True,
|
|
45
44
|
)
|
|
@@ -72,12 +71,8 @@ class MessageSystem(AbstractMessage):
|
|
|
72
71
|
is_sidelight}, operate:{operate}, timeCtrlLight:{build}")
|
|
73
72
|
return self.send_order_msg_sys(build2)
|
|
74
73
|
|
|
75
|
-
def test_tool_order_to_sys(
|
|
76
|
-
|
|
77
|
-
):
|
|
78
|
-
build = mctrl_sys_pb2.mCtrlSimulationCmdData(
|
|
79
|
-
sub_cmd=sub_cmd, param_id=param_id, param_value=param_value
|
|
80
|
-
)
|
|
74
|
+
def test_tool_order_to_sys(self, sub_cmd: int, param_id: int, param_value: List[int]):
|
|
75
|
+
build = mctrl_sys_pb2.mCtrlSimulationCmdData(sub_cmd=sub_cmd, param_id=param_id, param_value=param_value)
|
|
81
76
|
print(f"Send tool test command: subCmd={sub_cmd}, param_id:{
|
|
82
77
|
param_id}, param_value={param_value}")
|
|
83
78
|
build2 = mctrl_sys_pb2.MctlSys(simulation_cmd=build)
|
|
@@ -89,23 +84,15 @@ class MessageSystem(AbstractMessage):
|
|
|
89
84
|
print(f"Send read and write base station configuration quality op:{
|
|
90
85
|
op}, cgf:{cgf}")
|
|
91
86
|
return self.send_order_msg_sys(
|
|
92
|
-
mctrl_sys_pb2.MctlSys(
|
|
93
|
-
todev_lora_cfg_req=mctrl_sys_pb2.LoraCfgReq(op=op, cfg=cgf)
|
|
94
|
-
)
|
|
87
|
+
mctrl_sys_pb2.MctlSys(todev_lora_cfg_req=mctrl_sys_pb2.LoraCfgReq(op=op, cfg=cgf))
|
|
95
88
|
)
|
|
96
89
|
|
|
97
90
|
def allpowerfull_rw(self, id: int, context: int, rw: int):
|
|
98
|
-
if (id == 6 or id == 3 or id == 7) and DeviceType.is_luba_2(
|
|
99
|
-
self.get_device_name()
|
|
100
|
-
):
|
|
91
|
+
if (id == 6 or id == 3 or id == 7) and DeviceType.is_luba_2(self.get_device_name()):
|
|
101
92
|
self.messageNavigation.allpowerfull_rw_adapter_x3(id, context, rw)
|
|
102
93
|
return
|
|
103
|
-
build = mctrl_sys_pb2.MctlSys(
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
print(
|
|
107
|
-
f"Send command - 9 general read and write command id={id}, context={context}, rw={rw}"
|
|
108
|
-
)
|
|
94
|
+
build = mctrl_sys_pb2.MctlSys(bidire_comm_cmd=mctrl_sys_pb2.SysCommCmd(id=id, context=context, rw=rw))
|
|
95
|
+
print(f"Send command - 9 general read and write command id={id}, context={context}, rw={rw}")
|
|
109
96
|
if id == 5:
|
|
110
97
|
# This logic doesnt make snese, but its what they had so..
|
|
111
98
|
return self.send_order_msg_sys(build)
|
|
@@ -218,7 +205,7 @@ class MessageSystem(AbstractMessage):
|
|
|
218
205
|
period: int,
|
|
219
206
|
no_change_period: int,
|
|
220
207
|
count: int,
|
|
221
|
-
) ->
|
|
208
|
+
) -> bytes:
|
|
222
209
|
build = mctrl_sys_pb2.MctlSys(
|
|
223
210
|
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
224
211
|
act=rpt_act,
|
|
@@ -233,9 +220,7 @@ class MessageSystem(AbstractMessage):
|
|
|
233
220
|
build.todev_report_cfg.act} {build}")
|
|
234
221
|
return self.send_order_msg_sys(build)
|
|
235
222
|
|
|
236
|
-
def get_report_cfg(
|
|
237
|
-
self, timeout: int = 10000, period: int = 1000, no_change_period: int = 2000
|
|
238
|
-
):
|
|
223
|
+
def get_report_cfg(self, timeout: int = 10000, period: int = 1000, no_change_period: int = 2000):
|
|
239
224
|
mctlsys = mctrl_sys_pb2.MctlSys(
|
|
240
225
|
todev_report_cfg=mctrl_sys_pb2.report_info_cfg(
|
|
241
226
|
timeout=timeout,
|
|
@@ -21,7 +21,5 @@ class MessageVideo(AbstractMessage):
|
|
|
21
21
|
if DeviceType.is_yuka(self.get_device_name())
|
|
22
22
|
else luba_mul_pb2.MUL_CAMERA_POSITION.LEFT
|
|
23
23
|
)
|
|
24
|
-
mctl_sys = luba_mul_pb2.SocMul(
|
|
25
|
-
set_video=luba_mul_pb2.MulSetVideo(position=position, vi_switch=enter_state)
|
|
26
|
-
)
|
|
24
|
+
mctl_sys = luba_mul_pb2.SocMul(set_video=luba_mul_pb2.MulSetVideo(position=position, vi_switch=enter_state))
|
|
27
25
|
return self.send_order_msg_video(mctl_sys)
|
|
@@ -31,9 +31,7 @@ class JoystickControl:
|
|
|
31
31
|
self._curr_time = timer()
|
|
32
32
|
self.stopped = False
|
|
33
33
|
|
|
34
|
-
repeater = pyjoystick.HatRepeater(
|
|
35
|
-
first_repeat_timeout=0.2, repeat_timeout=0.03, check_timeout=0.01
|
|
36
|
-
)
|
|
34
|
+
repeater = pyjoystick.HatRepeater(first_repeat_timeout=0.2, repeat_timeout=0.03, check_timeout=0.01)
|
|
37
35
|
|
|
38
36
|
self.mngr = pyjoystick.ThreadEventManager(
|
|
39
37
|
event_loop=run_event_loop,
|
|
@@ -43,9 +41,7 @@ class JoystickControl:
|
|
|
43
41
|
button_repeater=repeater,
|
|
44
42
|
)
|
|
45
43
|
|
|
46
|
-
self.worker = PeriodicThread(
|
|
47
|
-
0.2, self.run_movement, name="luba-process_movements"
|
|
48
|
-
)
|
|
44
|
+
self.worker = PeriodicThread(0.2, self.run_movement, name="luba-process_movements")
|
|
49
45
|
self.worker.alive = self.mngr.alive # stop when this event stops
|
|
50
46
|
self.worker.daemon = True
|
|
51
47
|
|
|
@@ -64,11 +60,7 @@ class JoystickControl:
|
|
|
64
60
|
self.linear_percent,
|
|
65
61
|
self.angular_percent,
|
|
66
62
|
)
|
|
67
|
-
asyncio.run(
|
|
68
|
-
self._client.command(
|
|
69
|
-
"send_movement", linear_speed=linear_speed, angular_speed=angular_speed
|
|
70
|
-
)
|
|
71
|
-
)
|
|
63
|
+
asyncio.run(self._client.command("send_movement", linear_speed=linear_speed, angular_speed=angular_speed))
|
|
72
64
|
|
|
73
65
|
def print_add(self, joy):
|
|
74
66
|
print("Added", joy)
|
|
@@ -90,13 +82,9 @@ class JoystickControl:
|
|
|
90
82
|
return percent - 15.0
|
|
91
83
|
|
|
92
84
|
@staticmethod
|
|
93
|
-
def transform_both_speeds(
|
|
94
|
-
linear: float, angular: float, linear_percent: float, angular_percent: float
|
|
95
|
-
):
|
|
85
|
+
def transform_both_speeds(linear: float, angular: float, linear_percent: float, angular_percent: float):
|
|
96
86
|
transfrom3 = RockerControlUtil.getInstance().transfrom3(linear, linear_percent)
|
|
97
|
-
transform4 = RockerControlUtil.getInstance().transfrom3(
|
|
98
|
-
angular, angular_percent
|
|
99
|
-
)
|
|
87
|
+
transform4 = RockerControlUtil.getInstance().transfrom3(angular, angular_percent)
|
|
100
88
|
|
|
101
89
|
if transfrom3 is not None and len(transfrom3) > 0:
|
|
102
90
|
linear_speed = transfrom3[0] * 10
|
|
@@ -121,20 +109,12 @@ class JoystickControl:
|
|
|
121
109
|
# lower knife height
|
|
122
110
|
if self._blade_height > 25:
|
|
123
111
|
self._blade_height -= 5
|
|
124
|
-
asyncio.run(
|
|
125
|
-
self._client.command(
|
|
126
|
-
"set_blade_height", height=self._blade_height
|
|
127
|
-
)
|
|
128
|
-
)
|
|
112
|
+
asyncio.run(self._client.command("set_blade_height", height=self._blade_height))
|
|
129
113
|
if key.number == 10:
|
|
130
114
|
# raise knife height
|
|
131
115
|
if self._blade_height < 60:
|
|
132
116
|
self._blade_height += 5
|
|
133
|
-
asyncio.run(
|
|
134
|
-
self._client.command(
|
|
135
|
-
"set_blade_height", height=self._blade_height
|
|
136
|
-
)
|
|
137
|
-
)
|
|
117
|
+
asyncio.run(self._client.command("set_blade_height", height=self._blade_height))
|
|
138
118
|
|
|
139
119
|
if key.keytype is Key.AXIS:
|
|
140
120
|
# print(key, "-", key.keytype, "-", key.number, "-", key.value)
|
|
@@ -163,16 +143,12 @@ class JoystickControl:
|
|
|
163
143
|
# angular_speed==450
|
|
164
144
|
if key.value > 0:
|
|
165
145
|
self.angular_speed = 0.0
|
|
166
|
-
self.angular_percent = self.get_percent(
|
|
167
|
-
abs(key.value * 100)
|
|
168
|
-
)
|
|
146
|
+
self.angular_percent = self.get_percent(abs(key.value * 100))
|
|
169
147
|
else:
|
|
170
148
|
# angle=180.0
|
|
171
149
|
# linear_speed=0//angular_speed=-450
|
|
172
150
|
self.angular_speed = 180.0
|
|
173
|
-
self.angular_percent = self.get_percent(
|
|
174
|
-
abs(key.value * 100)
|
|
175
|
-
)
|
|
151
|
+
self.angular_percent = self.get_percent(abs(key.value * 100))
|
|
176
152
|
|
|
177
153
|
else:
|
|
178
154
|
match key.number:
|