symetrie-hexapod 0.16.10__tar.gz → 0.16.12__tar.gz

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.
Files changed (34) hide show
  1. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/PKG-INFO +1 -1
  2. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/pyproject.toml +2 -2
  3. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/__init__.py +2 -0
  4. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/pmac.py +18 -6
  5. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/pmac_regex.py +5 -1
  6. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna_ui.py +27 -25
  7. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/symetrie_hexapod/settings.yaml +1 -0
  8. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/.gitignore +0 -0
  9. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/README.md +0 -0
  10. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/__init__.py +0 -0
  11. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/alpha.py +0 -0
  12. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/dynalpha.py +0 -0
  13. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/hexapod.py +0 -0
  14. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/hexapod_ui.py +0 -0
  15. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/joran.py +0 -0
  16. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/joran.yaml +0 -0
  17. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/joran_cs.py +0 -0
  18. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/joran_protocol.py +0 -0
  19. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/joran_ui.py +0 -0
  20. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna.py +0 -0
  21. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna.yaml +0 -0
  22. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna_cs.py +0 -0
  23. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna_protocol.py +0 -0
  24. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/puna_sim.py +0 -0
  25. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/punaplus.py +0 -0
  26. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda.py +0 -0
  27. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda.yaml +0 -0
  28. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda_cs.py +0 -0
  29. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda_devif.py +0 -0
  30. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda_protocol.py +0 -0
  31. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/egse/hexapod/symetrie/zonda_ui.py +0 -0
  32. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/symetrie_hexapod/__init__.py +0 -0
  33. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/symetrie_hexapod/cgse_explore.py +0 -0
  34. {symetrie_hexapod-0.16.10 → symetrie_hexapod-0.16.12}/src/symetrie_hexapod/cgse_services.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: symetrie-hexapod
3
- Version: 0.16.10
3
+ Version: 0.16.12
4
4
  Summary: Symetrie Hexapod implementation for CGSE
5
5
  Author: IvS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "symetrie-hexapod"
3
- version = "0.16.10"
3
+ version = "0.16.12"
4
4
  description = "Symetrie Hexapod implementation for CGSE"
5
5
  authors = [
6
6
  {name = "IvS KU Leuven"}
@@ -36,7 +36,7 @@ zonda_cs = 'egse.hexapod.symetrie.zonda_cs:app'
36
36
  joran_cs = 'egse.hexapod.symetrie.joran_cs:app'
37
37
 
38
38
  [project.gui-scripts]
39
- puna_ui = "egse.hexapod.symetrie.puna_ui:main"
39
+ puna_ui = "egse.hexapod.symetrie.puna_ui:app"
40
40
  zonda_ui = "egse.hexapod.symetrie.zonda_ui:main"
41
41
  joran_ui = "egse.hexapod.symetrie.joran_ui:main"
42
42
 
@@ -102,6 +102,8 @@ class ProxyFactory(DeviceFactoryInterface):
102
102
  """
103
103
 
104
104
  def create(self, device_type: str, *, device_id: str = None, **_ignored):
105
+ logger.debug(f"{device_type=}, {device_id=}")
106
+
105
107
  with RegistryClient() as reg:
106
108
  service = reg.discover_service(device_id)
107
109
 
@@ -15,11 +15,14 @@ from datetime import datetime
15
15
  from datetime import timedelta
16
16
  from typing import List
17
17
 
18
+ from egse.env import bool_env
18
19
  from egse.hexapod.symetrie import logger
19
20
  from egse.hexapod.symetrie.pmac_regex import match_float_response
20
21
  from egse.hexapod.symetrie.pmac_regex import match_int_response
21
22
  from egse.hexapod.symetrie.pmac_regex import match_string_response
22
23
 
24
+ VERBOSE_DEBUG = bool_env("VERBOSE_DEBUG")
25
+
23
26
  # Command set Request
24
27
 
25
28
  VR_PMAC_SENDLINE = 0xB0
@@ -517,7 +520,8 @@ class EthernetCommand:
517
520
  headerStr = struct.pack(">BBHHH", self.requestType, self.request, self.value, self.index, len(command))
518
521
  wrappedCommand = headerStr + command.encode()
519
522
 
520
- logger.debug(f"Command Packet generated: {wrappedCommand}")
523
+ if VERBOSE_DEBUG:
524
+ logger.debug(f"Command Packet generated: {wrappedCommand}")
521
525
 
522
526
  return wrappedCommand
523
527
 
@@ -729,13 +733,17 @@ class PmacEthernetInterface(object):
729
733
 
730
734
  # Attempt to send the complete command to PMAC
731
735
 
732
- logger.debug(f"Sending out to PMAC: {command}")
736
+ if VERBOSE_DEBUG:
737
+ logger.debug(f"Sending out to PMAC: {command}")
738
+
733
739
  self.sock.sendall(self.getResponseCommand.getCommandPacket(command))
734
740
 
735
741
  # wait for, read and return the response from PMAC (will be at most 1400 chars)
736
742
 
737
743
  returnStr = self.sock.recv(2048)
738
- logger.debug(f"Received from PMAC: {returnStr}")
744
+
745
+ if VERBOSE_DEBUG:
746
+ logger.debug(f"Received from PMAC: {returnStr}")
739
747
 
740
748
  return returnStr
741
749
 
@@ -798,7 +806,9 @@ class PmacEthernetInterface(object):
798
806
  for qVar in qVars:
799
807
  cmd += f"Q{qVar:02} "
800
808
  retStr = self.getResponse(cmd)
801
- logger.debug(f"retStr={retStr} of type {type(retStr)}")
809
+
810
+ if VERBOSE_DEBUG:
811
+ logger.debug(f"retStr={retStr} of type {type(retStr)}")
802
812
 
803
813
  if retStr == b"\x00":
804
814
  raise PMACError(f"No response received for {cmd}, return value is {retStr}")
@@ -949,11 +959,13 @@ class PmacEthernetInterface(object):
949
959
  else:
950
960
  fullCommand = cmd["cmd"]
951
961
 
952
- logger.debug(f"Sending the {cmd['name']} command.")
962
+ if VERBOSE_DEBUG:
963
+ logger.debug(f"Sending the {cmd['name']} command.")
953
964
 
954
965
  retStr = self.getResponse(fullCommand)
955
966
 
956
- logger.debug(f"Command '{cmd['name']}' returned \"{retStr}\"")
967
+ if VERBOSE_DEBUG:
968
+ logger.debug(f"Command '{cmd['name']}' returned \"{retStr}\"")
957
969
 
958
970
  # Check the return code (usually Q20)
959
971
 
@@ -1,7 +1,10 @@
1
1
  import re
2
2
 
3
+ from egse.env import bool_env
3
4
  from egse.hexapod.symetrie import logger
4
5
 
6
+ VERBOSE_DEBUG = bool_env("VERBOSE_DEBUG")
7
+
5
8
  regex_response = {
6
9
  # Error message as ERRXXX
7
10
  "ERROR": re.compile(r"\a(ERR\d{3})\r"),
@@ -24,7 +27,8 @@ def match_regex_response(regex_prog, res):
24
27
 
25
28
  Return None if no match and the match object otherwise.
26
29
  """
27
- logger.debug(f"res = {res} with type {type(res)}")
30
+ if VERBOSE_DEBUG:
31
+ logger.debug(f"res = {res} with type {type(res)}")
28
32
  if isinstance(res, bytes):
29
33
  res = res.decode()
30
34
  match_obj = regex_prog.match(res)
@@ -15,45 +15,45 @@ platform that supports Python and Qt5.
15
15
  """
16
16
 
17
17
  import argparse
18
- import logging
19
18
  import multiprocessing
20
19
  import sys
21
20
  import threading
22
21
  from enum import IntEnum
23
22
  from pathlib import Path
24
23
 
24
+ import typer
25
25
  from PyQt5.QtCore import QLockFile
26
-
27
- from egse.hexapod.symetrie import ControllerFactory
28
- from egse.hexapod.symetrie import ProxyFactory
29
- from egse.hexapod.symetrie import get_hexapod_controller_pars
30
- from egse.hexapod.symetrie.punaplus import PunaPlusController
31
- from egse.hexapod.symetrie.punaplus import PunaPlusProxy
32
-
33
- multiprocessing.current_process().name = "puna_ui"
34
-
35
26
  from PyQt5.QtGui import QIcon
36
- from PyQt5.QtWidgets import QApplication, QMessageBox
27
+ from PyQt5.QtWidgets import QApplication
37
28
  from PyQt5.QtWidgets import QFrame
38
29
  from PyQt5.QtWidgets import QHBoxLayout
30
+ from PyQt5.QtWidgets import QMessageBox
39
31
  from PyQt5.QtWidgets import QVBoxLayout
40
- from prometheus_client import start_http_server
41
32
 
42
33
  from egse.gui import show_warning_message
43
34
  from egse.gui.led import Indic
44
35
  from egse.gui.states import States
36
+ from egse.hexapod.symetrie import ControllerFactory
37
+ from egse.hexapod.symetrie import ProxyFactory
38
+ from egse.hexapod.symetrie import get_hexapod_controller_pars
45
39
  from egse.hexapod.symetrie.hexapod_ui import ActuatorStates
46
40
  from egse.hexapod.symetrie.hexapod_ui import HexapodUIController
47
41
  from egse.hexapod.symetrie.hexapod_ui import HexapodUIModel
48
42
  from egse.hexapod.symetrie.hexapod_ui import HexapodUIView
49
43
  from egse.hexapod.symetrie.puna import PunaSimulator
44
+ from egse.hexapod.symetrie.punaplus import PunaPlusController
45
+ from egse.hexapod.symetrie.punaplus import PunaPlusProxy
46
+ from egse.log import logging
50
47
  from egse.process import ProcessStatus
51
48
  from egse.resource import get_resource
52
49
  from egse.settings import Settings
53
50
  from egse.system import do_every
51
+ from dotenv import load_dotenv
54
52
 
55
53
  MODULE_LOGGER = logging.getLogger(__name__)
56
54
 
55
+ load_dotenv(override=True)
56
+
57
57
 
58
58
  class DeviceControllerType(IntEnum):
59
59
  ALPHA = 0
@@ -283,8 +283,8 @@ class PunaUIView(HexapodUIView):
283
283
 
284
284
 
285
285
  class PunaUIModel(HexapodUIModel):
286
- def __init__(self, connection_type):
287
- hostname, port, dev_id, dev_name, _ = get_hexapod_controller_pars()
286
+ def __init__(self, connection_type, device_id):
287
+ hostname, port, dev_id, dev_name, *_ = get_hexapod_controller_pars(device_id)
288
288
  if connection_type == "proxy":
289
289
  device = ProxyFactory().create(dev_name, device_id=dev_id)
290
290
  elif connection_type == "direct":
@@ -346,15 +346,19 @@ def parse_arguments():
346
346
  return parser.parse_args()
347
347
 
348
348
 
349
- def main():
349
+ app = typer.Typer()
350
+
351
+
352
+ @app.command()
353
+ def main(device_id: str, device_type: str = "proxy", profile: bool = False):
354
+ multiprocessing.current_process().name = "puna_ui"
355
+
350
356
  lock_file = QLockFile(str(Path("~/puna_ui.app.lock").expanduser()))
351
357
 
352
358
  styles_location = get_resource(":/styles/default.qss")
353
359
  app_logo = get_resource(":/icons/logo-puna.svg")
354
360
 
355
- args = list(sys.argv)
356
- args[1:1] = ["-stylesheet", str(styles_location)]
357
- app = QApplication(args)
361
+ app = QApplication(["-stylesheet", str(styles_location)])
358
362
  app.setWindowIcon(QIcon(str(app_logo)))
359
363
 
360
364
  if lock_file.tryLock(100):
@@ -364,13 +368,11 @@ def main():
364
368
  timer_thread.daemon = True
365
369
  timer_thread.start()
366
370
 
367
- args = parse_arguments()
368
-
369
- if args.profile:
371
+ if profile:
370
372
  Settings.set_profiling(True)
371
373
 
372
- if args.type == "proxy":
373
- *_, device_id, device_name, _ = get_hexapod_controller_pars()
374
+ if device_type == "proxy":
375
+ _, _, device_id, device_name, *_ = get_hexapod_controller_pars(device_id)
374
376
  factory = ProxyFactory()
375
377
  proxy = factory.create(device_name, device_id=device_id)
376
378
  if not proxy.ping():
@@ -385,7 +387,7 @@ def main():
385
387
 
386
388
  show_warning_message(description, info_text)
387
389
 
388
- model = PunaUIModel(args.type)
390
+ model = PunaUIModel(device_type, device_id)
389
391
  view = PunaUIView(model.get_device_controller_type(), model.device_id)
390
392
  PunaUIController(model, view)
391
393
 
@@ -405,4 +407,4 @@ def main():
405
407
  if __name__ == "__main__":
406
408
  logging.basicConfig(level=logging.DEBUG, format=Settings.LOG_FORMAT_FULL)
407
409
 
408
- sys.exit(main())
410
+ sys.exit(app())
@@ -6,6 +6,7 @@ PUNA Alpha+ Controller:
6
6
  password: provide password in local settings
7
7
 
8
8
  Hexapod Control Server:
9
+ SERVICE_TYPE: puna
9
10
  PROTOCOL: tcp
10
11
  HOSTNAME: localhost # The hostname that client shall connect to, e.g. on the same machine
11
12
  COMMANDING_PORT: 0 # The port on which the controller listens to commands - REQ-REP