Repository navigation
YAML behavior files, ivpico_bhv, and inline behaviors - #26
Open
tsaubergine wants to merge 1 commit into
Open
tsaubergine wants to merge 1 commit into
tsaubergine wants to merge 1 commit into
Conversation
Behaviors can now come from .bhv.yml files, checked against a JSON Schema, or inline in HelmConfig.behaviors, as well as from .bhv files. - behaviors.proto: ivp.interface.BehaviorSet, what one behavior file holds. The parameters every behavior takes are typed fields; a behavior's own parameters are an ordered list. Values keep their source text. - The helm converts YAML and inline behaviors to .bhv text for the unchanged Populator. With any of them, every behavior file (in the order given) and then the inline sets go into one temporary file, and the Populator's warnings are rewritten to the original file, line and column, or the path in the configuration. Configs with only .bhv files keep pHelmIvP's path. - yaml-cpp is optional (enable_yaml, on when found; HAS_YAML). YAML is read with it so parameter order and repeats are kept, scalars are read as written, and every error names its line and column. Merges (<<) and x- keys allow shared settings. - ivpico_bhv: convert (YAML to .bhv), import (.bhv to YAML), check (builds the behaviors, reporting each problem where it was written) and schema. share/ivpico/bhv.schema.json is generated from the BehaviorSet message, committed and installed. - The alpha launch uses alpha.bhv.yml. Tests: unit tests of the reader, writers and the helm; every fixture .bhv round-trips through .bhv and YAML; replay_<fixture>_yaml replays every fixture from YAML; the committed schema must match the generated one, and imported fixtures and alpha.bhv.yml must validate against it; s1_alpha closed loops from alpha.bhv.yml and from inline behaviors. CI also builds without yaml-cpp on one job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLcYK4e29B5FiPbDDJy5fp
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.
Implements Y1–Y6 of the YAML behavior files plan, with yaml-cpp optional. Behaviors can now come from
.bhv.ymlfiles, checked against a JSON Schema, or inline in the helm configuration, as well as from.bhvfiles..bhvstays the reference: everything else is converted to.bhvtext for MOOS-IvP's unchanged Populator.Changes
ivp.interface.BehaviorSet(behaviors.proto) holds what one behavior file does:initialize, deferred or not;Values keep their source text.
HelmConfig.behaviorstakes sets inline.The helm (
behavior_file.{h,cpp}):.bhvreader: ports the Populator's line handling, including its brace splitting,\continuations andsetblocks..bhvwriter: reports values.bhvcan't hold, such as//, a newline or a brace where the Populator splits.file:line:column, or at the path in the configuration (behaviors[0].behavior[1].param[2])..bhvfiles keep pHelmIvP's path, with files read in sorted order.YAML (
behavior_yaml.cpp, only with yaml-cpp):3.10,on,0x1);<<: *name) and top-levelx-keys allow shared settings.yaml-cpp is optional: the
enable_yamloption is ON when yaml-cpp is found and definesHAS_YAML. Without it, YAML files are a config warning and the tool says so; inline behaviors still work.ivpico_bhv:convert: YAML to.bhv;import:.bhvto YAML, with ayaml-language-serverschema line;check: builds the behaviors and reports each problem where it was written;schema: prints the JSON Schema.share/ivpico/bhv.schema.jsonis generated fromBehaviorSet, committed and installed.The alpha launch uses
alpha.bhv.yml.init.shinstallslibyaml-cpp-dev, pluspython3-jsonschemaandpython3-yamlfor the schema test.README: outline of a "Behavior files" section, for you to fill in.
Testing
behavior_fileunit tests:.bhvconstruct, and lines the Populator rejects;.bhvround-trips through.bhvand YAML to the sameBehaviorSet.replay_<fixture>_yaml: all 19 fixtures replay with pass conditions identical to the originals, with their behaviors loaded from YAML converted from their.bhv.bhv_schema: the committed schema matches the generated one.bhv_schema_examples: every imported fixture andalpha.bhv.ymlvalidate, and seven files the reader rejects fail.closed_loop_s1_alpha_yamlandclosed_loop_s1_alpha_inline: the full s1_alpha mission, including stopping at the return point.-Denable_yaml=OFF. CI now also builds without yaml-cpp on one job.🤖 Generated with Claude Code
https://claude.ai/code/session_01VLcYK4e29B5FiPbDDJy5fp