COVESA / vehicle-information-service-specification

Mozilla Public License 2.0
2 stars 3 forks source link

Support for multilevel path filter operations #21

Open JustinDanielson opened 1 month ago

JustinDanielson commented 1 month ago

Premise:

I want to write code to check the tire pressure of all tires, and potentially in vehicles such as dual rear wheel trucks. I don't know how that spec will be implemented in the future.

All tire's pressures can be returned with

{
    "action": "get",
    "path": "Vehicle.Chassis.Axle",
    "filter": {"variant": "paths", "parameter": ["#.Tire.Pressure"]}  //assuming '#' is multilevel wildcard
}

alternatively, we could supply another parameter to the filter

    "filter": {"variant": "paths", "parameter": ["*.Tire.Pressure"], "multilevel": true}

Challenge:

Current path filter requires me to know that the path has many instances and where they are within the path string.

If the implementation follows the sample vspec(below), then I cannot do the following filter because my paths in the front and rear tires are of different lengths.

{
    "action": "get",
    "path": "Vehicle.Chassis.Axle",
    "filter": {"variant":"paths", "parameter":["*.*.*.*.Tire.Pressure"]},
}

Do I include a second filter parameter? "*.*.*.*.*.*.Tire.Pressure" This is really getting ugly 😅

Assumed front tire path: Axle.Row1.Wheel.Left.Tire.Pressure Assumed rear tire path: Axle.Row2.Wheel.Left.Inside.Tire.Pressure

Assumption of vspec implementation. (this may be incorrect?)

Axle:
  instances:
    - Row[1,2]
  type: branch
  description: Axle signals

Axle.Wheel:
  instances: ["Left","Right"]
  type: branch
  description: Wheel signals for axle

Axle.Row2.Wheel.Left:
  instances: ["Inside", "Outside"]
  type: branch
  description: Wheel signals for dual wheel axle
UlfBj commented 4 weeks ago

The path for the tire pressure Row, Left has the following path today Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure

The following request gets the tire pressure for all tires. { "action": "get", "path": "Vehicle.Chassis.Axle", "filter": {"variant": "paths", "parameter": [".Wheel..Tire.Pressure"]} }

The scenario you present with different number of tires on different axles is not supported with the current instances model in VSS, so what you propose is incorrect. However, this scenario is addressed in the CVIS project, https://github.com/COVESA/commercial-vehicle-information-specifications, where signal trees for truks are being developed. The request above would get you the tire pressure for all tires, also with different numbers of tires per axle in that model.