Repository navigation
docs(contract): write down the spatial conventions; state the import callback rule the code keeps - #242
Merged
Conversation
…callback rule the code keeps Two contract texts that 1.0 would otherwise freeze wrong or missing. Spatial conventions. Nothing said which unit positions are in, which way a quaternion rotates, or how a FrameTransform maps a point. Geometry.proto now states them once: metres, right-handed frames, quaternions as (x, y, z, w) with v' = q * v * conjugate(q), all-zero read as the identity, and p_parent = R(rotation) * p_child + translation. This is what the decoders and PlotJuggler's transform code already do. The worked example in FrameTransforms.proto, copied from the upstream schema, gave (-1, 3, 0) where the result is (1, 3, 0). Descriptor import. The header promised that no job callback occurs before start_import returns true. A provider cannot keep that: a worker thread cannot be ordered against the return itself, and provider_job.hpp already said so. The rule is now what ProviderJob does: no callback before out_job is populated, none when start_import returns false, and the host has its callback state ready before it calls. Comments, docs and the changelog only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Two contract texts that 1.0.0 would otherwise freeze missing or wrong. Both came out of the Codex readiness review of
main. Comments, Markdown and the changelog only: no code token changes.1. Spatial conventions
Nothing in the schemas said which unit positions use, which way a quaternion rotates, or how a
FrameTransformmaps a point. Changing any of these after 1.0 would reinterpret recorded data, so they need to be stated before the tag.Geometry.protonow states them once, anddocs/builtin_type.mdrepeats them for readers of the C++ types:encodingfor depth, screen pixels underscale_invariant).frame_id.(x, y, z, w),wscalar, Hamilton:v' = q * v * conjugate(q). Unit length. All zeros is read as the identity.p_frame = R(orientation) * p_local + positionp_parent = R(rotation) * p_child + translationThese describe existing behaviour, checked in two places:
geometry_codec.hpp);pj_tf::Transformappliest + q * pand its buffer normalizes on write.Metres and right-handed frames are the ROS and Foxglove convention the types mirror; I did not find code that would contradict them, but they are a statement of intent rather than something a test pins.
The worked example was wrong.
FrameTransforms.protosaid that with translation(1, 2, 0)and a 90° rotation about z, the point(1, 0, 0)maps to(-1, 3, 0). The rotation gives(0, 1, 0), and adding the translation gives(1, 3, 0). I computed it to confirm. The same sentence is in the upstream Foxglove schema this file was copied from.2. Descriptor import: callback timing
descriptor_import_protocol.hpromised that no job callback may occur beforestart_importreturns true. No provider can keep that: the worker is released as the last statement beforereturn true, and a thread cannot be ordered against the return itself.provider_job.hppalready said this; the C header did not.The rule is now what
ProviderJobdoes:out_jobis populated;start_importreturns false;start_importhas returned, so the host has its callback state ready before it calls.Three comments that quoted the old rule (in
provider_job.cppand the extension test) are reworded to match.For the host: PlotJuggler should already prepare its callback context before calling
start_import. I did not check that in the app.Verification
Pre-commit passes. Nothing was built locally: the diff touches comments and Markdown only, and CI compiles the headers and the test file.
🤖 Generated with Claude Code