-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of structs (in arrays) #326
Comments
This interesting issue addresses questions related to the domain definition of the "Vehicle tree", and whether VSS should concern itself with other trees than the Vehicle tree. Are there any "boundaries" to what data that may be added to the Vehicle tree? Currently VSS only concerns itself with the "Vehicle tree", but the "VSS model" has no such limitations, and could very well be used to declare trees for other domains. |
I like this approach very much. This |
in a way, part of it relates to COVESA/vss-tools#89 but in our use case, we also would have use to replace some of |
I feel the original question is probably valid also if we stay within the Vehicle domain, but agree that other domains might add additional pressure to increase the feature set of the model. So this is veering off topic a bit, but I'd like to give my opinion/answers:
Yes. I've brought this up before and we have been discussing around this issue a few times. In my opinion, the (meta)/model used for VSS can be recommended for other domains, in combination with VSSo/ontology approaches where they make sense. But I think the logical thing is to name the underlying model behind that to something else, like Extensible Data Model, or similar, and let the VSS name remain for Vehicle related information (it's in the name...). Other domains might possibly need a little different metadata, and we might then say it is formally a different model (I guess depending on definition of the word and at which abstraction level you are thinking). With input from you and others, this is taking shape and I have something brewing in my head. I feel now is the time to write up a proposal...
All we can, and should do, IMHO is to propose this ability and help to organize the work. Communities get formed around these issues as they are needed, and they may include some overlap of people/companies. It's already happening, for example we already have ongoing cooperation with the insurance domain, which is going in this direction. Final point
In combination with the above, it would then not hurt to discuss and see if we can write down a few guidelines about what belongs in the "standard VSS tree". |
Yes it does, so maybe we should make it a separate issue? |
Discussed again in call. Currently not "elegant" or easy to use/generate it with existing data model. Questions: How could VSS support? Do we want it? Or else: How does VSC fit. |
Structured data modeling is an area for which we are exploring VSS. For example, a hypothetical model of an obstacle list detected by the ADAS system could be,
The requirement of modeling ROS2 messages is mentioned in #414 as well. |
It is obvious to me, that we really do need an answer to the question of more complex data structures, that is better/more specific than just “use VSC someday”. I feel is valuable to keep (large part of) the standard catalogue consisting of mainly simple signals, but I think in usage it will be common to just want a little more. I have the following asusmptions
I see two basic ways forward: 1. Extend /(mis)use the existing specificationWe already have the (not really used) aggregate keyword. That is a start but not enough As a toy example consider the one given by @kkoppolu1 ADAS.Lidar.Front
type: branch
ADAS.Lidar.Front.ObstacleList
type: complexsensor[] #this is like a branch but a sensor
#include ADAS/obstacle.vspec ADAS.Lidar.Front.ObstacleList in ADAS/obstacle.vspec: id:
datatype: uint64
probability:
datatype: float Advantages:
Disadvantages:
2. Option 2: Reference existing IDLs.ADAS.Lidar.Front
type: branch
ADAS.Lidar.Front.ObstacleList
type: sensor
datatype: jsonchema://datatypes/ObstacleList.json
or ADAS.Lidar.Front.ObstacleList
type: sensor
datatype: proto://datatypes/ObstacleList.proto or ADAS.Lidar.Front.ObstacleList
type: sensor
datatype: ros2://datatypes/ObstacleList.msg with e.g.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": [
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"probability": {
"type": "number"
}
},
"required": [
"id",
"probability"
]
},
{
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"probability": {
"type": "number"
}
},
"required": [
"id",
"probability"
]
}
]
} or
and
or Franka, ARXML, etc. Advantages
Disadvantages
Neutral
Any input/opinions?My 2ct: I would prefer solution 2. For 1 or 2 technologies we should spell out how it is expected to work/look like (e.g. ROS2 because everbody uses it, and jsonschema because it fits W3C stacks, but really anything goes). Then you still have a strong standard catalogue (only using primitve datatypes), that you can expect to work with "any stack" anywhere, and you have some "endorsed" IDLs that one or the other implementation might be inclined to support. If you add your own IDL, you are probably on your own tool-wise, but at least you have a sueful "extension point" and did not "break" VSS (just like extending private signals / units)) |
…e VSS spec. The details of the proposal are in COVESA/vehicle_signal_specification#326 The VSS parser and proto/JSON generators are updated to support struct keyword. For example, the following vspec ``` Vehicle: type: branch Vehicle.UserType1: type: struct Vehicle.UserType1.Field1: type: sensor datatype: Vehicle.UserType1 Vehicle.UserType2: type: struct Vehicle.UserType2.Field1: type: sensor datatype: Vehicle.UserType1 Vehicle.UserTypeArrayField: type: sensor datatype: Vehicle.UserType1[] ``` generates the following proto: ``` syntax = "proto3"; package vehicle; message Vehicle { VehicleUserType1 UserType1 = 1; VehicleUserType2 UserType2 = 2; repeated VehicleUserType1 UserTypeArrayField = 3; } message VehicleUserType1 { VehicleUserType1 Field1 = 1; } message VehicleUserType2 { VehicleUserType1 Field1 = 1; } ```
…ords to the VSS spec. The details of the proposal are in COVESA/vehicle_signal_specification#326 The VSS parser and proto/JSON generators are updated to support struct keyword. An example Struct.vspec file is included in the commit. The commit also includes the generated 1. Struct.json 2. Struct.proto
…ords to the VSS spec. The details of the proposal are in COVESA/vehicle_signal_specification#326 The VSS parser and proto/JSON generators are updated to support struct keyword. An example Struct.vspec file is included in the commit. The commit also includes the generated 1. Struct.json 2. Struct.proto
…ords to the VSS spec. The details of the proposal are in COVESA/vehicle_signal_specification#326 The VSS parser and proto/JSON generators are updated to support struct keyword. An example Struct.vspec file is included in the commit. The commit also includes the generated 1. Struct.json 2. Struct.proto
This commit is a proof of concept update of vss-tools to support the following two item keywords: 1. struct 2. item struct - An aggregate/complex data type item - A field within an aggregate/complex data type This approach is outlined by @erikbosch in COVESA/vehicle_signal_specification#326 To demonstrate the type definition within VSS, an example vspec file is included in the commit that defines a hypothetical `ObstacleList` sensor data type provided by a Lidar. The vspec file converted into JSON and protobuf are also included in the commit. vspec -> json: `./vspec2x.py --json-pretty --format json Struct.vspec Struct.json` vspec -> protobuf: `./contrib/vspec2protobuf.py Struct.vspec Struct.proto`
As supporting material to Option 1 (Extend the existing VSS specification), I have a proof-of-concept commit that demonstrates how we can use "struct" and "item" keywords suggested by @erikbosch (first comment on the issue ticket) to model complex types in VSS. The commit includes updates to
Following are my thoughts/inputs on the pros/cons of each approach. Option 1 (Extend VSS)Advantages:
Drawbacks:
Option 2 (Reference existing IDLs)Advantages:
Drawbacks:
|
@kkoppolu1 thanks for making a working example. Have not yet played with code, but in the checked in example .vspec /* [...]*/
Vehicle.ADAS.Lidar.ObstacleList:
type: struct
Vehicle.ADAS.Lidar.ObstacleList.Data:
type: item
datatype: Vehicle.ADAS.Lidar.Obstacle[]
Vehicle.ADAS.Lidar.Front:
type: branch
Vehicle.ADAS.Lidar.Front.Obstacles:
type: sensor
datatype: Vehicle.ADAS.Lidar.ObstacleList Is there a technical reason why it is not just Vehicle.ADAS.Lidar.Front.Obstacles:
type: sensor
datatype: Vehicle.ADAS.Lidar.Obstacle[] the indirection over ObstacleList seems redundant to me in this case? |
It can very well be modeled in the way you described @SebastianSchildt. Both cases are valid:
|
Discussion: Do we really want to inter-mingle datatype definition into the same tree (at least in output) as the VSS data model itself? |
Everybody who has stakes should look into this and comment. Open questions are
Maybe we shall have a seperate meeting? |
I think we need to differentiate the following two
|
In the current model "type" represents what I think can be referred to as "data sources", except for "branch" which is a construct to support tree structures. In the proposal above "type" is extended with "struct" and "item", which I think is rather "datatype" metadata. The leads in my view to loss of clarity of the model. The parsing of the tree becomes more complex as there will be dependencies between nodes, and it is unclear what will be the result of accessing some of the nodes. I would like to propose an alternative design that extends the "datatype" with the values "struct" and "struct[]", which when used MUST then be accompanied in the same node with the "struct" definition. An attempt to apply it to the example from above could look something like below.
The datatype definition of a node is contained within that node. |
I guess we are again in the discussion what goes in the interface and what is the part of the model only. Or what do we have to model from a vehicle system and how at the end interface is realized. If we go this way, next discussion will be how do we combine e.g. speed, position, wheel rotation and ambient temperature into custom message "myMessage" and can we model that in VSS? I guess main motivation of VSS is how to have common setup around vehicle taxonomy/model and not messages or interfaces. Something like this i would suggest myLidar.vspecWill be used later in ADAS Lidar
myMain.vspec
Then you introduce for your deployment setup specific config file or use layers, basically something that can help you with your specific IDL challenge for your deployment and usage of vss. This might help you to generate some additional code automatically. mycustom.depl
or you just generate granulated protobuf messages from VSS and rest of the code you write in your main protofile -> message myCustomMessage( repeated VehicleAdasLidarObstacles myCustomData = 1) |
I took another stab at the "reference IDL" variant, that does not require hacking of tools This takes advantage of the fact, that VSS already supports uint8[] as datatype and all existing tech stacks are expected to work with it. The example would look like this ADAS.Lidar.Front
type: branch
ADAS.Lidar.Front.ObstacleList
type: sensor
datatype: uint8[] Then we may have an overlay ADAS.Lidar.Front
type: branch
ADAS.Lidar.Front.ObstacleList
type: sensor
protomsg: ObstacleListMessage You might generate
which will generate a JSON as before, and if you load it in e.g. a VISS stack such as KUKSA it will just deal with a You also might imagine a .protpo tooling, that is called the same way
That will express the VSS model in terms of protobuf and rolling the messages referenced by You could build similar things for other stacks/IDLs of course Advantages
Disadvantages
Neutral
|
I took the time to summarise/collect all proposals in our wiki Please modify/add if I forgot something or did not get it right (if you have n Wiki access rights, just post here, maybe laso do it if you do change the wiki, so people notice). This is not to say we should choose one of the approaches as is (as also not all are detailed the same way, and there might be corner cases), but I found concrete suggestions most helpful for this discussion, |
I updated the wiki sub page with a note comparing branch-based modeling and IDL based modeling. |
I updated the wiki sub page with disadvantages and neutral stance points - https://github.com/COVESA/vehicle_signal_specification/wiki/Proposal-%22struct%22:-Just-model-as-branches,-the-rest-is-deployment |
With the assumption that most cases of need for complex data types would be covered by support of struct and struct[] data types, where the struct fields are of simple data types, then I think a combination of the solution I proposed above, without support for nested structs, together with Sebastians proposal using uint8[] and overlay for the cases where nested structs are needed, or of abundant definition reuse, would be a balanced solution. |
This commit is a proof of concept update of vss-tools to support higher order/complex types via the approach outlined in https://github.com/COVESA/vehicle_signal_specification/wiki/Proposal-%22struct%22:-%22Weak%22-layer-reference-to-external-IDLs **Description ** The main idea is that we are trying to model a sensor of Complex type - `ObstacleList` as defined in comments of COVESA/vehicle_signal_specification#326 For reference, the type is defined as follows: ``` ObstacleClass { uint64 class } Obstacle { uint64 id ObstacleClass class float64 probability } ObstacleList { Obstacle[] obstacles } ``` In the main vspec file (struct_overlay.json), the sensor's type is erased - we treat the sensor's data type as a byte-array. The exact type information is then provided in an overlay file (obstacles_overlay.vspec) where the required information needed by custom tooling is provided . In this example, it is assumed that custom tooling is available to process the following information: 1. datatypename - The actual data type name of the sensor 2. idl - IDL file defining the data type shape The vss2json tool is updated to include these custom keys in the output. (out.json) All the relevant files are included in the commit. vspec -> json: `python vspec2x.py --format json Struct_overlay.vspec -o obstacles_overlay.vspec --json-pretty out.json`
Created a proof-of-concept commit for the approach outlined in https://github.com/COVESA/vehicle_signal_specification/wiki/Proposal-%22struct%22:-%22Weak%22-layer-reference-to-external-IDLs |
This commit is a proof of concept update of vss-tools to support higher order/complex types via a variation of the approach outlined in https://github.com/COVESA/vehicle_signal_specification/wiki/Proposal-%22struct%22:-Just-model-as-branches,-the-rest-is-deployment Ref: COVESA/vehicle_signal_specification#326 **Description ** The main idea is that we are trying to model a sensor of Complex type - `ObstacleList` as a branch. The current limitation with branches is that you cannot have arrays of branches. With the understanding that branches are to be treated as a data type (like primitive and their array equivalent), what we need is a way to convey the fact that the branch represents a collection/array. In the case of primitives, we use the operator `[]` for this purpose. For example, an array type `uint8` is denoted by adding the suffix `[]`. On a similar path, we can utilize the already available `arraysize` property of a VSS node to specify the array size of a branch typed node. In this commit, the VSS tools are updated to proceess the `arraysize` key for branch typed nodes. For reference, the type is defined as follows: ``` ObstacleClass { uint64 class } Obstacle { uint64 id ObstacleClass class float64 probability } ObstacleList { Obstacle[] data } ``` All the relevant files are included in the commit. vspec -> json: `python vspec2json.py ObstacleArray.vspec --json-pretty out.json` The resulting JSON output contains the attribute "arraysize" for the branch typed nodes if defined.
Created a proof-of-concept commit that utilizes branches to define types. The array support for branches is added via the already available |
Meeting notes:
Discussion to be continued on next meeting. Please check linked commits above. |
Meeting notes:
@kkoppolu1 to come up with examples on how to use it. |
To make sure that I remember the old comments above; was the intention to use the syntax as described below. Example without fixed size, there can be 0..* obstacles.
Example with fixed size, there must be 10 obstacles.
Did we (or do we need to) say how individual instances in the array can be fetched (if supported by the stack/API), E.g. that the first instance shall be considered to have index 1, i.e. if arraysize is 10 indexes 1..10 are used? |
I think we wanted to use Like so - Dynamic:
Fixed:
|
I’m not finding it intuitive to use the branch[] syntax to refer to an array of objects under the node. VSS is essentially a tree data structure, which is a graph. When we specify a node to be a branch, we’re saying this node has multiple edges, with a node at the end of each edge. Then what does branch[] exactly mean ? To me, the earlier suggestion of using the type struct is more intuitive. Adding one constraint that a struct type can not also be a branch. It’s a leaf node, just like sensors and actuators. I understand it turns VSS into an IDL, but I think it already partially is one, because it has datatypes.
|
Meeting notes: Bhushan presented his comment above. Important to get consensus so we can move forward. To be discussed in a meeting, date for meeting to be agreed on Slack |
Same example as on top, but in form of an anonymous struct (I.e. struct content defined inline)
|
Meeting Notes:
For the reasons:
As mentioned before, the PR for introducing the change should include
|
We also need to discuss and document best practices on how to model data as a branch versus a struct, as part of this development effort. |
Note: This PR is not supposed to be merged as is, rather as a discussion platform for COVESA#326
From my perspective, the definition of vehicle-related data points in the specification must be atomic (as it is now). The specification is responsible for the definition and description of what each property means. The proposal of a With that consideration, I think we will soon face the limitation of a
|
A typical example that often comes up is GNSS data - today specified in |
We now have struct support so I think this issue can be closed |
When investigating possible VSS-representation for project-specific use-cases I quite often find use-cases where the "source specification" use arrays of structs. A hypothetical example could be a list/array of deliveries to be done. In VSS as of today we support arrays on simple types like
uint8[]
and we support instances on branches, but we have no real mechanism to define structured types and to define arrays on them. Branches with instances does not really provide any solution if the array can have an arbitrary size.Have there been any discussion to introduce some form of type definition for structs, possibly like below? Do we see a need for it?
The text was updated successfully, but these errors were encountered: