Repository navigation
feat: DSL standard library — §8.7 physical-object actors (p7-s5) - #97
Merged
Merged
Conversation
Adds osc.standard.domain (namespace std) and its first chapter: the physical-object actors of §8.7, with their structs and enumerations. - The osc_actor → physical_object → movable_object → traffic_participant → vehicle → trailer inheritance chain, plus stationary_object, person and animal; bounding_box, axle, hitch_receiver, hitch_coupler; all 11 §8.7 enums, including the backward-compatibility spellings that the standard keeps equal to their replacements; the §8.7.6.1 measurement methods. - osc.standard.all and the legacy osc.standard now bring both sub-modules; osc.standard.domain pulls the types sub-module with it, since the domain model is written in its physical types. - §8.7 is printed as parameter tables, not as code. A row is declared as a field whether the standard calls it a parameter or a state variable and whether or not it is mandatory — the language has no optional-field marker, and §7.3.11 already lets a scenario leave a field unconstrained. - §8.7.26 (traffic-participant groups) is explicitly non-normative and is not part of the library. The road-dependent physical_object methods are deferred to the §8.12 slice and will arrive as extend blocks, which is how the standard prints their prototypes. Refs #43
Windows CI caught it: 'file://' + 'C:/x/y.osc' reads the drive letter as the URI authority, so an import of an existing file was rejected as naming a host. §7.7.5.1.1's own examples spell the path 'file:///c:/Users/...', 'file:/c:/Users/...' and '/c:/Users/...' — the slash in front of the drive letter is URI syntax, not part of the path, and dropping it is what makes the reference absolute rather than relative to the current drive. The URI test now builds a spec-shaped reference and exercises all three spellings; a new case pins that a genuine authority is still rejected. Refs #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of the stacked PRs for #43, on top of #96. It opens
osc.standard.domain(namespacestd) with the physical-object actors of §8.7.What lands
The entity model: the
osc_actor→physical_object→movable_object→traffic_participant→vehicle→trailerinheritance chain, plusstationary_object,personandanimal; thebounding_box,axle,hitch_receiverandhitch_couplerstructs; all eleven §8.7 enumerations; andthe §8.7.6.1 measurement methods (
time_to_collision,time_gap,space_gap,time_headway,space_headway).osc.standard.alland the legacyosc.standardnow bring both sub-modules.osc.standard.domainpulls the types sub-module along with it, because thedomain model is written in its physical types — §7.7.5.1's import-once rule
makes the duplicate reference free.
Reading a specification that stopped printing code
§8.14 gave the library as DSL code blocks. From §8.7 onward the standard prints
parameter tables instead, so each declaration is a translation rather than a
transcription. Three judgement calls, all recorded in the source and the README:
state variable, and whether or not it is marked mandatory. The language has no
optional-field marker, and §7.3.11 already lets a scenario leave a field
unconstrained, so nothing is lost by declaring them uniformly.
stationary_object.location(), which ismodifier stationary_object.location— not
modifier location of stationary_object, because §7.3.12.2'sofnames a scenario or an action. The resolver caught this: it was the only thing
the first draft of the module got wrong.
non-normative, so they are not part of the library.
The backward-compatibility spellings the standard keeps (
truck = heavy_truck,vru_vehicle = micro_mobility_device,fire = fire_brigade,road_assistance = roadside_assistance,road_construction = construction) maponto §7.2.2.2.2's
= other_memberform exactly, and a test asserts each legacyname really does carry its replacement's value.
Deferred, deliberately
The road-dependent
physical_objectmethods —road_distance,distance_to_route_point,get_s_coord,get_route_point,distance_along_route, … — need §8.12'sroute,route_point,xyz_pointandodr_point. They arrive with the §8.12 slice asextend physical_object:blocks, which is precisely how the standard prints their prototypes.
set_bmwaits on §8.6's
behavioral_modelthe same way.Tests
1235 → 1246 gtest. Eleven new cases in
dsl_stdlib_test.cpp, led byTheDomainSubModuleChecksClean— the library loads throughimport osc.standard.allwith zero diagnostics of any severity, which ishalf of p7-s5's exit criterion.
ImportingTheStandardLibraryTwiceLoadsItOncenow names all four module references and still ends with exactly two library
files.
Local gate green: build, 1246/1246 ctest, 184 pytest,
format.sh --check,check_detmath.sh,check_coverage_matrix.py.Refs #43