Skip to content

Commit

Permalink
rename some obj data keynames for yamls
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Nov 14, 2023
1 parent b1dd665 commit 4de5e4a
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
42 changes: 21 additions & 21 deletions oresat_configs/_yaml_to_od.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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"] = []
Expand Down
4 changes: 2 additions & 2 deletions oresat_configs/base/battery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ objects:
- subindex: 0x16
name: status
data_type: uint8
bitfield:
bit_definitions:
HEATER_ON: 0
DISCHARGE_DISABLE: 1
CHARGE_DISABLE: 2
Expand Down Expand Up @@ -319,7 +319,7 @@ objects:
- subindex: 0x16
name: status
data_type: uint8
bitfield:
bit_definitions:
HEATER_ON: 0
DISCHARGE_DISABLE: 1
CHARGE_DISABLE: 2
Expand Down
6 changes: 3 additions & 3 deletions oresat_configs/base/c3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion oresat_configs/base/cfc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions oresat_configs/base/gps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@ objects:
- subindex: 0x1
name: fix_mode
data_type: uint8
values:
value_descriptions:
0: no fix
1: 2d
2: 3d
Expand All @@ -48,23 +48,23 @@ objects:
data_type: uint32
description: time of the week
access_type: ro
scaling: 0.01
scale_factor: 0.01
unit: s

- subindex: 0x5
name: latitude
data_type: int32
description: latitude
access_type: ro
scaling: 0.0000001 # 1e-7
scale_factor: 0.0000001 # 1e-7
unit: deg

- subindex: 0x6
name: longitude
data_type: int32
description: longitude
access_type: ro
scaling: 0.0000001 # 1e-7
scale_factor: 0.0000001 # 1e-7
unit: deg

- subindex: 0x7
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions oresat_configs/base/imu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ objects:
access_type: ro
low_limit: 0
high_limit: 10000
scaling: 0.01
scale_factor: 0.01
unit: "%"

- subindex: 0x8
Expand All @@ -282,7 +282,7 @@ objects:
access_type: ro
low_limit: 0
high_limit: 10000
scaling: 0.01
scale_factor: 0.01
unit: "%"

- subindex: 0x9
Expand All @@ -292,7 +292,7 @@ objects:
access_type: ro
low_limit: 0
high_limit: 10000
scaling: 0.01
scale_factor: 0.01
unit: "%"

tpdos:
Expand Down
2 changes: 1 addition & 1 deletion oresat_configs/base/star_tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ objects:
- index: 0x4000
name: status
data_type: uint8
values:
value_descriptions:
0x00: off
0x01: booting
0x02: standby
Expand Down
8 changes: 4 additions & 4 deletions oresat_configs/base/sw_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4de5e4a

Please sign in to comment.