fix: the type error after vehicle lights implementation#119
Conversation
| ]; | ||
| } | ||
|
|
||
| function isMovingObject(obj: MovingObject | StationaryObject): obj is MovingObject { |
There was a problem hiding this comment.
Shouldn't the name be rather "hasLightState" as that is what is checked? I am also wondering why you mention the StationaryObject here?
I am also questioning if the lightstate is actually sufficient as it is allowed to have e.g. only the field: license_plate_illumination_rear filled out without a break light state?
I am quoting Thomas:
This should be checked again. Pedestrians or animals usually don't have lights at all and in my opinion it should also be allowed to have incomplete OSI data (vehicles without light definitions) and still be able to render the rest of the object.
In which situations is this feature supposed to be used and when should the lights be rendered? I Would say the moment the state in that field is set and not undefined?
There was a problem hiding this comment.
Null checks were separated out specifically. Now it is checking for brakelights and indicator lights only and if they are not defined or null we are not rendering any of lights.
For mentioning StationaryObject:
osiObject can be also StationaryObject
https://github.com/lichtblick-suite/asam-osi-converter/pull/119/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R95
|
TODO: Please create a follow-up PR for some unit tests |
|
The changes of this PR only partially solve the issues I recently mentioned. If I understand the code correctly, both
So for those situations, the lights are not rendered at all, which is correct. Though, if the object is a All basic typed fields (string, int, enum, etc.) of a protobuf message are deserialized to their default values if they are not explicitly set, e.g.:
This means that in the above example |
The "vehicle_classification" field could sometimes return null even when it was present (if obj is pedestrian). This bug has been fixed in this PR.