From 4de5e4aee8421d5185e6e4d43692a3915a0f5091 Mon Sep 17 00:00:00 2001 From: ryanpdx Date: Mon, 13 Nov 2023 16:51:18 -0800 Subject: [PATCH] rename some obj data keynames for yamls --- oresat_configs/_yaml_to_od.py | 42 +++++++++++++-------------- oresat_configs/base/battery.yaml | 4 +-- oresat_configs/base/c3.yaml | 6 ++-- oresat_configs/base/cfc.yaml | 2 +- oresat_configs/base/gps.yaml | 20 ++++++------- oresat_configs/base/imu.yaml | 6 ++-- oresat_configs/base/star_tracker.yaml | 2 +- oresat_configs/base/sw_common.yaml | 8 ++--- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/oresat_configs/_yaml_to_od.py b/oresat_configs/_yaml_to_od.py index 3aa692a..c0823a0 100644 --- a/oresat_configs/_yaml_to_od.py +++ b/oresat_configs/_yaml_to_od.py @@ -95,12 +95,12 @@ def _add_objects(od: canopen.ObjectDictionary, objects: list): var = canopen.objectdictionary.Variable(obj["name"], index) var.access_type = obj["access_type"] var.description = obj["description"] - for name, bits in obj.get("bitfield", {}).items(): + for name, bits in obj.get("bit_definitions", {}).items(): var.add_bit_definition(name, bits) - for value, descr in obj.get("values", {}).items(): + for value, descr in obj.get("value_descriptions", {}).items(): var.add_value_description(value, descr) var.unit = obj.get("unit", "") - var.factor = obj.get("scaling", 1) + var.factor = obj.get("scale_factor", 1) var.data_type = OD_DATA_TYPES[obj["data_type"]] _set_var_default(obj, var) if var.data_type not in dynamic_len_data_types: @@ -121,12 +121,12 @@ def _add_objects(od: canopen.ObjectDictionary, objects: list): var.access_type = sub_obj["access_type"] var.description = sub_obj["description"] var.data_type = OD_DATA_TYPES[sub_obj["data_type"]] - for name, bits in sub_obj.get("bitfield", {}).items(): + for name, bits in sub_obj.get("bit_definitions", {}).items(): var.add_bit_definition(name, bits) - for value, descr in sub_obj.get("values", {}).items(): + for value, descr in sub_obj.get("value_descriptions", {}).items(): var.add_value_description(value, descr) var.unit = sub_obj.get("unit", "") - var.factor = sub_obj.get("scaling", 1) + var.factor = sub_obj.get("scale_factor", 1) _set_var_default(sub_obj, var) if var.data_type not in dynamic_len_data_types: var.pdo_mappable = True @@ -149,12 +149,12 @@ def _add_objects(od: canopen.ObjectDictionary, objects: list): var = canopen.objectdictionary.Variable(sub_name, index, subindex) var.access_type = obj["access_type"] var.data_type = OD_DATA_TYPES[obj["data_type"]] - for name, bits in sub_obj.get("bitfield", {}).items(): + for name, bits in sub_obj.get("bit_definitions", {}).items(): var.add_bit_definition(name, bits) - for value, descr in sub_obj.get("values", {}).items(): + for value, descr in sub_obj.get("value_descriptions", {}).items(): var.add_value_description(value, descr) var.unit = sub_obj.get("unit", "") - var.factor = sub_obj.get("scaling", 1) + var.factor = sub_obj.get("scale_factor", 1) _set_var_default(sub_obj, var) if var.data_type not in dynamic_len_data_types: var.pdo_mappable = True @@ -430,14 +430,14 @@ def read_yaml_od_config(file_path: str) -> dict: obj["access_type"] = "rw" if "default" not in obj: obj["default"] = None - if "values" not in obj: - obj["values"] = {} - if "bitfield" not in obj: - obj["bitfield"] = {} + if "value_descriptions" not in obj: + obj["value_descriptions"] = {} + if "bit_definitions" not in obj: + obj["bit_definitions"] = {} if "unit" not in obj: obj["unit"] = "" - if "scaling" not in obj: - obj["scaling"] = 1 + if "scale_factor" not in obj: + obj["scale_factor"] = 1 elif "subindexes" not in obj: config["subindexes"] = [] else: @@ -450,14 +450,14 @@ def read_yaml_od_config(file_path: str) -> dict: sub_obj["description"] = "" if "default" not in sub_obj: sub_obj["default"] = None - if "values" not in sub_obj: - sub_obj["values"] = {} - if "bitfield" not in sub_obj: - sub_obj["bitfield"] = {} + if "value_descriptions" not in sub_obj: + sub_obj["value_descriptions"] = {} + if "bit_definitions" not in sub_obj: + sub_obj["bit_definitions"] = {} if "unit" not in sub_obj: sub_obj["unit"] = "" - if "scaling" not in sub_obj: - sub_obj["scaling"] = 1 + if "scale_factor" not in sub_obj: + sub_obj["scale_factor"] = 1 if "tpdos" not in config: config["tpdos"] = [] diff --git a/oresat_configs/base/battery.yaml b/oresat_configs/base/battery.yaml index 0c5838d..8488c62 100644 --- a/oresat_configs/base/battery.yaml +++ b/oresat_configs/base/battery.yaml @@ -155,7 +155,7 @@ objects: - subindex: 0x16 name: status data_type: uint8 - bitfield: + bit_definitions: HEATER_ON: 0 DISCHARGE_DISABLE: 1 CHARGE_DISABLE: 2 @@ -319,7 +319,7 @@ objects: - subindex: 0x16 name: status data_type: uint8 - bitfield: + bit_definitions: HEATER_ON: 0 DISCHARGE_DISABLE: 1 CHARGE_DISABLE: 2 diff --git a/oresat_configs/base/c3.yaml b/oresat_configs/base/c3.yaml index bd34ab5..f110724 100644 --- a/oresat_configs/base/c3.yaml +++ b/oresat_configs/base/c3.yaml @@ -9,7 +9,7 @@ objects: name: status data_type: uint8 description: the c3 state - values: + value_descriptions: 65: OFFLINE - This state is never actually reachable by the device. Reset vector is PRE_DEPLOY 66: PRE_DEPLOY - Holding state after deployment of satellite but before deployment of antennas. Ensures a minimum amount of time passes before attempting to deploy antennas and going active 67: DEPLOY - Antenna deployment state. Attempts to deploy antennas several times before moving to Standby @@ -298,7 +298,7 @@ objects: name: status data_type: uint8 description: opd system enable status - values: + value_descriptions: 1: DISABLED - OPD system is off 2: ENABLED - OPD system is on (no faults) 3: FAULT - OPD system is on and has one or more faults @@ -362,7 +362,7 @@ objects: name: node_status data_type: uint8 description: enable/disable selected node on write or get current state by read - values: + value_descriptions: 0x1: DISABLED - OPD node is off 0x2: ENABLED - OPD node is on (no faults) 0x3: FAULT - Fault input is set for OPD node diff --git a/oresat_configs/base/cfc.yaml b/oresat_configs/base/cfc.yaml index d7bf8ec..70c9639 100644 --- a/oresat_configs/base/cfc.yaml +++ b/oresat_configs/base/cfc.yaml @@ -7,7 +7,7 @@ objects: name: status data_type: uint8 description: the camera status - values: + value_descriptions: 0x1: OFF - Camera is off 0x2: STANDBY - Camera is on not doing anything 0x3: CAPTURE - Camera is capturing an image diff --git a/oresat_configs/base/gps.yaml b/oresat_configs/base/gps.yaml index b7cb8c5..af46e92 100644 --- a/oresat_configs/base/gps.yaml +++ b/oresat_configs/base/gps.yaml @@ -3,7 +3,7 @@ objects: name: status data_type: uint8 description: the gps status - values: + value_descriptions: 0: off 1: searching for gps satellites 2: locked onto >4 gps satellites @@ -23,7 +23,7 @@ objects: - subindex: 0x1 name: fix_mode data_type: uint8 - values: + value_descriptions: 0: no fix 1: 2d 2: 3d @@ -48,7 +48,7 @@ objects: data_type: uint32 description: time of the week access_type: ro - scaling: 0.01 + scale_factor: 0.01 unit: s - subindex: 0x5 @@ -56,7 +56,7 @@ objects: data_type: int32 description: latitude access_type: ro - scaling: 0.0000001 # 1e-7 + scale_factor: 0.0000001 # 1e-7 unit: deg - subindex: 0x6 @@ -64,7 +64,7 @@ objects: data_type: int32 description: longitude access_type: ro - scaling: 0.0000001 # 1e-7 + scale_factor: 0.0000001 # 1e-7 unit: deg - subindex: 0x7 @@ -86,35 +86,35 @@ objects: data_type: uint16 description: geometric diluttion of precision access_type: ro - scaling: 0.01 + scale_factor: 0.01 - subindex: 0xa name: pdop data_type: uint16 description: position diluttion of precision access_type: ro - scaling: 0.01 + scale_factor: 0.01 - subindex: 0xb name: hdop data_type: uint16 description: height diluttion of precision access_type: ro - scaling: 0.01 + scale_factor: 0.01 - subindex: 0xc name: vdop data_type: uint16 description: vertical diluttion of precision access_type: ro - scaling: 0.01 + scale_factor: 0.01 - subindex: 0xd name: tdop data_type: uint16 description: time diluttion of precision access_type: ro - scaling: 0.01 + scale_factor: 0.01 - subindex: 0xe name: ecef_x diff --git a/oresat_configs/base/imu.yaml b/oresat_configs/base/imu.yaml index 6892a1d..7a08373 100644 --- a/oresat_configs/base/imu.yaml +++ b/oresat_configs/base/imu.yaml @@ -272,7 +272,7 @@ objects: access_type: ro low_limit: 0 high_limit: 10000 - scaling: 0.01 + scale_factor: 0.01 unit: "%" - subindex: 0x8 @@ -282,7 +282,7 @@ objects: access_type: ro low_limit: 0 high_limit: 10000 - scaling: 0.01 + scale_factor: 0.01 unit: "%" - subindex: 0x9 @@ -292,7 +292,7 @@ objects: access_type: ro low_limit: 0 high_limit: 10000 - scaling: 0.01 + scale_factor: 0.01 unit: "%" tpdos: diff --git a/oresat_configs/base/star_tracker.yaml b/oresat_configs/base/star_tracker.yaml index e0f6d61..417821d 100644 --- a/oresat_configs/base/star_tracker.yaml +++ b/oresat_configs/base/star_tracker.yaml @@ -2,7 +2,7 @@ objects: - index: 0x4000 name: status data_type: uint8 - values: + value_descriptions: 0x00: off 0x01: booting 0x02: standby diff --git a/oresat_configs/base/sw_common.yaml b/oresat_configs/base/sw_common.yaml index 8460c39..4a71f73 100644 --- a/oresat_configs/base/sw_common.yaml +++ b/oresat_configs/base/sw_common.yaml @@ -66,8 +66,8 @@ objects: - subindex: 0x1 name: reset data_type: uint8 - description: reset the app. See the olaf.NodeStop enum for values - values: + description: reset the app + value_descriptions: 1: soft reset 2: hard reset 3: factory reset @@ -116,7 +116,7 @@ objects: - subindex: 0x9 name: boot_select data_type: uint8 - bitfield: + bit_definitions: CURRENT_BOOT: 0 NEXT_BOOT: 1 access_type: ro @@ -197,7 +197,7 @@ objects: name: status data_type: uint8 description: status of the updater - values: + value_descriptions: 0x0: Last update was successfully installed (default value) 0x1: Last update failed while pre-processing the update 0x2: Last update failed while running the update