diff --git a/Obstacle.vspec b/Obstacle.vspec new file mode 100644 index 00000000..7f7692c0 --- /dev/null +++ b/Obstacle.vspec @@ -0,0 +1,11 @@ +Id: + type: attribute + datatype: int64 + +Probability: + type: attribute + datatype: float + +ObstacleClass: + type: branch +#include ObstacleClass.vspec ObstacleClass diff --git a/ObstacleArray.vspec b/ObstacleArray.vspec new file mode 100644 index 00000000..15996fea --- /dev/null +++ b/ObstacleArray.vspec @@ -0,0 +1,17 @@ +Vehicle: + type: branch + +Vehicle.ADAS: + type: branch + +Vehicle.ADAS.Lidar: + type: branch + +Vehicle.ADAS.Lidar.Front: + type: branch + +Vehicle.ADAS.Lidar.Front.Obstacles: + type: branch + arraysize: 10 + +#include ObstacleData.vspec Vehicle.ADAS.Lidar.Front.Obstacles diff --git a/ObstacleClass.vspec b/ObstacleClass.vspec new file mode 100644 index 00000000..50e424c7 --- /dev/null +++ b/ObstacleClass.vspec @@ -0,0 +1,3 @@ +Class: + type: attribute + datatype: uint64 \ No newline at end of file diff --git a/ObstacleData.vspec b/ObstacleData.vspec new file mode 100644 index 00000000..0c1252ad --- /dev/null +++ b/ObstacleData.vspec @@ -0,0 +1,4 @@ +Data: + type: branch + +#include Obstacle.vspec Data diff --git a/out.json b/out.json new file mode 100644 index 00000000..55f240c8 --- /dev/null +++ b/out.json @@ -0,0 +1,70 @@ +{ + "Vehicle": { + "children": { + "ADAS": { + "children": { + "Lidar": { + "children": { + "Front": { + "children": { + "Obstacles": { + "arraysize": 10, + "children": { + "Data": { + "children": { + "Id": { + "datatype": "int64", + "description": null, + "type": "attribute", + "uuid": "31f7ac1946da58a194c1c6a8dad9cf1d" + }, + "ObstacleClass": { + "children": { + "Class": { + "datatype": "uint64", + "description": null, + "type": "attribute", + "uuid": "c30ce72db64057fd99ac502190bf5fcb" + } + }, + "description": null, + "type": "branch", + "uuid": "9ea15f3abd1656e096bcdc5ee6dcbba3" + }, + "Probability": { + "datatype": "float", + "description": null, + "type": "attribute", + "uuid": "32e416f193d250d3a5f96f0f4789bee3" + } + }, + "description": null, + "type": "branch", + "uuid": "9646d03cc6845c42834aa74fc91a1cfa" + } + }, + "description": null, + "type": "branch", + "uuid": "6ae7d48f9cd25ff694dc5ebd02f90522" + } + }, + "description": null, + "type": "branch", + "uuid": "f96d319c62615760861d8abe645081af" + } + }, + "description": null, + "type": "branch", + "uuid": "aac706a4d4ca599c824ebc479c47540c" + } + }, + "description": null, + "type": "branch", + "uuid": "14c2b2e1297b513197d320a5ce58f42e" + } + }, + "description": null, + "type": "branch", + "uuid": "ccc825f94139544dbb5f4bfd033bece6" + } +} \ No newline at end of file diff --git a/vspec/model/vsstree.py b/vspec/model/vsstree.py index 06204723..91e50647 100644 --- a/vspec/model/vsstree.py +++ b/vspec/model/vsstree.py @@ -113,6 +113,9 @@ def __init__(self, name, source_dict: dict, parent=None, children=None, break_on if "instances" in source_dict.keys(): self.instances = source_dict["instances"] + if "arraysize" in source_dict.keys(): + self.arraysize = source_dict["arraysize"] + if "deprecation" in source_dict.keys(): self.deprecation = source_dict["deprecation"] diff --git a/vssexporters/vss2json.py b/vssexporters/vss2json.py index 08e761ac..384aca08 100644 --- a/vssexporters/vss2json.py +++ b/vssexporters/vss2json.py @@ -37,6 +37,8 @@ def export_node(json_dict, node, generate_uuid): json_dict[node.name]["default"] = node.default_value if node.deprecation != "": json_dict[node.name]["deprecation"] = node.deprecation + if hasattr(node, 'arraysize'): + json_dict[node.name]["arraysize"] = node.arraysize # in case of unit or aggregate, the attribute will be missing try: