lookout-config 1.3.5__py3-none-any.whl → 1.4.0__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.
@@ -15,7 +15,9 @@ from lookout_config.types import (
15
15
  Point,
16
16
  Polygon,
17
17
  CameraExtended,
18
+ PositioningSystem,
18
19
  )
20
+ from lookout_config.helpers import YamlDumper
19
21
 
20
22
 
21
23
  LOOKOUT_CONFIG_FILE_NAME = "lookout.yml"
@@ -32,7 +34,7 @@ def get_path():
32
34
 
33
35
 
34
36
  def parse(config: dict[str, Any]) -> LookoutConfig:
35
- return LookoutConfig(**config)
37
+ return LookoutConfig(**config or {})
36
38
 
37
39
 
38
40
  def read() -> LookoutConfig:
@@ -45,10 +47,11 @@ def write(config: LookoutConfig):
45
47
  path = get_path()
46
48
  # Make the parent dir if it doesn't exist
47
49
  os.makedirs(path.parent, exist_ok=True)
50
+ json_string = config.model_dump(mode="json")
48
51
  with open(path, "w") as stream:
49
52
  print(f"Writing: {path}")
50
53
  headers = f"# yaml-language-server: $schema={LOOKOUT_SCHEMA_URL}"
51
- data = "\n".join([headers, yaml.dump(config.model_dump(mode="json"))])
54
+ data = "\n".join([headers, yaml.dump(json_string, Dumper=YamlDumper, sort_keys=True)])
52
55
  stream.write(data)
53
56
 
54
57
 
@@ -67,4 +70,5 @@ __all__ = [
67
70
  "Point",
68
71
  "Polygon",
69
72
  "CameraExtended",
73
+ "PositioningSystem",
70
74
  ]
@@ -0,0 +1,18 @@
1
+ import yaml
2
+
3
+
4
+ class YamlDumper(yaml.Dumper):
5
+ """
6
+ A YAML dumpler that show lists on the same line if they do not contain dicts or list
7
+ """
8
+
9
+ def represent_sequence(self, tag, sequence, flow_style=None):
10
+ if isinstance(sequence, list) and all(
11
+ [not isinstance(item, (dict, list)) for item in sequence]
12
+ ):
13
+ flow_style = True
14
+ return super().represent_sequence(tag, sequence, flow_style)
15
+
16
+ def represent_mapping(self, tag, mapping, flow_style=None):
17
+ flow_style = False
18
+ return super().represent_mapping(tag, mapping, flow_style)
@@ -0,0 +1,9 @@
1
+ # Generated by 'python3 -m parameter_persistence.generate_models'
2
+
3
+ from __future__ import annotations
4
+
5
+ from pydantic import BaseModel
6
+
7
+
8
+ class LaunchParameters(BaseModel):
9
+ pass
@@ -517,6 +517,19 @@
517
517
  ],
518
518
  "title": "Polygon",
519
519
  "type": "object"
520
+ },
521
+ "PositioningSystem": {
522
+ "enum": [
523
+ "none",
524
+ "septentrio_ins",
525
+ "advanced_navigation_ins",
526
+ "nmea_2000_sat_compass",
527
+ "nmea_2000_compass",
528
+ "nmea_0183_sat_compass",
529
+ "nmea_0183_compass"
530
+ ],
531
+ "title": "PositioningSystem",
532
+ "type": "string"
520
533
  }
521
534
  },
522
535
  "properties": {
@@ -533,7 +546,7 @@
533
546
  "type": "array"
534
547
  },
535
548
  "namespace_vessel": {
536
- "default": "vessel",
549
+ "default": "vessel_1",
537
550
  "title": "Namespace Vessel",
538
551
  "type": "string"
539
552
  },
@@ -544,7 +557,7 @@
544
557
  },
545
558
  "mode": {
546
559
  "$ref": "#/$defs/Mode",
547
- "default": "stubs"
560
+ "default": "hardware"
548
561
  },
549
562
  "log_level": {
550
563
  "$ref": "#/$defs/LogLevel",
@@ -562,7 +575,7 @@
562
575
  "default": "host"
563
576
  },
564
577
  "gpu": {
565
- "default": false,
578
+ "default": true,
566
579
  "title": "Gpu",
567
580
  "type": "boolean"
568
581
  },
@@ -570,10 +583,27 @@
570
583
  "$ref": "#/$defs/GeolocationMode",
571
584
  "default": "none"
572
585
  },
586
+ "positioning_system": {
587
+ "$ref": "#/$defs/PositioningSystem",
588
+ "default": "none"
589
+ },
590
+ "components": {
591
+ "title": "Components"
592
+ },
573
593
  "prod": {
574
594
  "default": true,
575
595
  "title": "Prod",
576
596
  "type": "boolean"
597
+ },
598
+ "log_directory": {
599
+ "default": "~/greenroom/lookout/logs",
600
+ "title": "Log Directory",
601
+ "type": "string"
602
+ },
603
+ "recording_directory": {
604
+ "default": "~/greenroom/lookout/recordings",
605
+ "title": "Recording Directory",
606
+ "type": "string"
577
607
  }
578
608
  },
579
609
  "title": "LookoutConfig",
lookout_config/types.py CHANGED
@@ -2,6 +2,7 @@
2
2
  # * lookout_interfaces/msg/Config.msg
3
3
  # * lookout_config_manager/mappers.py
4
4
 
5
+ from typing import List, Any
5
6
  from enum import Enum
6
7
  from pydantic import BaseModel, field_validator, ConfigDict
7
8
  from pydantic.fields import Field
@@ -19,6 +20,19 @@ class Mode(str, Enum):
19
20
  return self.value
20
21
 
21
22
 
23
+ class PositioningSystem(str, Enum):
24
+ NONE = "none"
25
+ SEPTENTRIO_INS = "septentrio_ins"
26
+ ADNAV_INS = "advanced_navigation_ins"
27
+ NMEA_2000_SAT_COMPASS = "nmea_2000_sat_compass"
28
+ NMEA_2000_COMPASS = "nmea_2000_compass"
29
+ NMEA_0183_SAT_COMPASS = "nmea_0183_sat_compass"
30
+ NMEA_0183_COMPASS = "nmea_0183_compass"
31
+
32
+ def __str__(self):
33
+ return self.value
34
+
35
+
22
36
  class LogLevel(str, Enum):
23
37
  INFO = "info"
24
38
  DEBUG = "debug"
@@ -82,6 +96,7 @@ class LookoutConfig(BaseModel):
82
96
  LogLevel: lambda v: v.value,
83
97
  Network: lambda v: v.value,
84
98
  GeolocationMode: lambda v: v.value,
99
+ PositioningSystem: lambda v: v.value,
85
100
  },
86
101
  )
87
102
  ros_domain_id: int = 0
@@ -94,6 +109,8 @@ class LookoutConfig(BaseModel):
94
109
  network: Network = Network.HOST
95
110
  gpu: bool = True
96
111
  geolocation_mode: GeolocationMode = GeolocationMode.NONE
112
+ positioning_system: PositioningSystem = PositioningSystem.NONE
113
+ components: Any = Field(default_factory=dict)
97
114
  prod: bool = True
98
115
  log_directory: str = "~/greenroom/lookout/logs"
99
116
  recording_directory: str = "~/greenroom/lookout/recordings"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lookout_config
3
- Version: 1.3.5
3
+ Version: 1.4.0
4
4
  Summary: A library for reading / writing Lookout config files
5
5
  Home-page: https://github.com/Greenroom-Robotics/lookout
6
6
  Author: Greenroom Robotics
@@ -0,0 +1,13 @@
1
+ lookout_config/__init__.py,sha256=3D-vqwfTPSuvLVBo4wiYQglpPUm4Fj6Y5MYGIS-e0fI,1738
2
+ lookout_config/generate_schemas.py,sha256=yFNvrZ6gie1tnTM_1TO8_wBa0lFHJAABSI3ZAZqw_Wg,457
3
+ lookout_config/generate_urdf.py,sha256=_LaBPlp6BDFP68DMxF-VQS1SDt4iX1pmb0kITQM-I9E,3103
4
+ lookout_config/helpers.py,sha256=3GkGRPDzQ67I5srwcWoI8PI1dgrWvTsUwA8-yRUttLM,603
5
+ lookout_config/launch_parameters.py,sha256=1q49Abigr6WQ3MCJtRcS-h5wQLFNW0yx-zHXOkjn3QM,180
6
+ lookout_config/types.py,sha256=2Vb4D-3gOSnurLjbSRdJjfinrSWTGCFW2szgGZRbrME,3255
7
+ lookout_config/schemas/lookout.schema.json,sha256=WK4HvtAYYUwLTV0lybj6-9FxXvQUx1ZKTgOoamSpJPA,13002
8
+ lookout_config/test/lookout_config_test.py,sha256=TdOzIEWnyrckhmK7OtShtoWwSAP8QDCiKalNhvScd2U,73
9
+ lookout_config-1.4.0.dist-info/METADATA,sha256=H4-cc7FvJIQ_bJeqRSSxlLeRsvhCrk-yR6Cu4rsi1fw,1436
10
+ lookout_config-1.4.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
11
+ lookout_config-1.4.0.dist-info/top_level.txt,sha256=IiZRgJhNrNL87uLMQm9lQRrMCqJnTOl7aYlA7zRSYyg,15
12
+ lookout_config-1.4.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
+ lookout_config-1.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- lookout_config/__init__.py,sha256=uI1hfXYaCT5lddPGVoIhcKAB523XQodgk-Y2_nVCLcc,1573
2
- lookout_config/generate_schemas.py,sha256=yFNvrZ6gie1tnTM_1TO8_wBa0lFHJAABSI3ZAZqw_Wg,457
3
- lookout_config/generate_urdf.py,sha256=_LaBPlp6BDFP68DMxF-VQS1SDt4iX1pmb0kITQM-I9E,3103
4
- lookout_config/types.py,sha256=FfRVOsXpgX0yufAAS9VQtPdC4fVQ6sRXAUFYUp_Kbhc,2681
5
- lookout_config/schemas/lookout.schema.json,sha256=GSQSlV5TlCznq3uANgdd4a7ogG5cOjOMY0YmuwKuuOI,12245
6
- lookout_config/test/lookout_config_test.py,sha256=TdOzIEWnyrckhmK7OtShtoWwSAP8QDCiKalNhvScd2U,73
7
- lookout_config-1.3.5.dist-info/METADATA,sha256=WKTKT32t6NIHVTRHUi2_zgq-j0kNnlzYBFS5yjwnXbI,1436
8
- lookout_config-1.3.5.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
9
- lookout_config-1.3.5.dist-info/top_level.txt,sha256=IiZRgJhNrNL87uLMQm9lQRrMCqJnTOl7aYlA7zRSYyg,15
10
- lookout_config-1.3.5.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
11
- lookout_config-1.3.5.dist-info/RECORD,,