Added Field metadata #1033
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Copper’s debug/introspection pipeline to preserve semantic metadata (time vs duration, quantities with units, geodetic coordinates) so the remote debug API can render values more accurately.
Changes:
- Introduces richer debug field descriptors/semantics in
cu29-traitsand generates output + state schemas in the remote debug server using reflect/type registration. - Splits
CuTimeinto a dedicated timestamp type (no longer an alias ofCuDuration) and updates call sites accordingly. - Adds
GeodeticPositionand migrates GNSS payloads/call sites from{latitude,longitude}toposition, including logviz + example updates.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/cu_rp_balancebot/src/resim.rs | Adjusts replay clock syncing for new CuTime semantics. |
| examples/cu_gnss_ublox_demo/src/tasks.rs | Switches GNSS fix formatting to position.{lat,lon}_degrees() helpers. |
| examples/cu_flight_controller/src/tasks/vtx.rs | Uses new GNSS position accessors for OSD display. |
| examples/cu_flight_controller/src/tasks/gnss.rs | Logs GNSS coordinates via position and removes degree import. |
| examples/cu_flight_controller/src/sim_support.rs | Refactors sim GNSS shared state visibility; populates fix position. |
| examples/cu_flight_controller/src/sim.rs | Moves sim GNSS/battery setters into sim binary; re-homes GNSS tests with a lock. |
| examples/cu_flight_controller/python/print_gnss_from_log.py | Updates Python log reader for payload.position.{latitude,longitude}. |
| examples/cu_flight_controller/justfile | Adds resim-debug alias target. |
| examples/cu_flight_controller/copperconfig.ron | Enables mixer task logging in the example configuration. |
| examples/cu_flight_controller/README.md | Documents just resim-debug. |
| examples/cu_caterpillar/src/resim.rs | Updates replay/keyframe timestamp handling to use CuTime. |
| examples/cu_caterpillar/src/determinism_test.rs | Updates determinism test clock syncing to CuTime::as_nanos(). |
| examples/cu_bridge_test/src/resim.rs | Updates replay clock extraction/signatures to use CuTime. |
| core/cu29_value/src/lib.rs | Hash/serde unexpected handling for Value::CuTime now uses as_nanos(). |
| core/cu29_value/src/de.rs | Deserializer visits CuTime as u64 via as_nanos(). |
| core/cu29_units/src/lib.rs | Adds debug scalar registrations for SI wrapper types (quantity + unit semantics). |
| core/cu29_units/Cargo.toml | Adds cu29-traits dependency to support debug scalar registration types. |
| core/cu29_traits/src/lib.rs | Adds DebugFieldDescriptor/kind/semantics and updates TaskOutputSpec to expose payload type path via fn. |
| core/cu29_runtime/src/remote_debug.rs | Reworks schema endpoints to emit structured field catalogs + metadata descriptors and adds state field catalogs. |
| core/cu29_runtime/src/reflect.rs | Ensures TypePath exists without reflect (incl. primitives) and adds a test. |
| core/cu29_runtime/src/monitoring.rs | Adjusts timestamp formatting call site for new time conversion semantics. |
| core/cu29_runtime/src/lib.rs | Adds extern crate self as cu29 for proc-macro generated paths. |
| core/cu29_runtime/src/debug.rs | Exposes app()/app_mut() accessors on debug session wrapper. |
| core/cu29_runtime/src/curuntime.rs | Updates loop rate limiter tests to use CuTime::from_nanos. |
| core/cu29_runtime/Cargo.toml | Adds optional cu29-units for remote-debug schema/semantics and enables its reflect feature. |
| core/cu29_reflect_derive/src/lib.rs | Makes the non-reflect Reflect derive emit TypePath impls (unless opted out). |
| core/cu29_reflect_derive/Cargo.toml | Adds syn/quote/proc-macro2 dependencies for the derive implementation. |
| core/cu29_logviz/tests/payload_as_components.rs | Adds coverage for logging GeodeticPosition as rerun components. |
| core/cu29_logviz/tests/auto_dispatch.rs | Extends auto-dispatch tests to include GeodeticPosition. |
| core/cu29_logviz/src/lib.rs | Adds GeodeticPosition logging + auto-dispatch support. |
| core/cu29_export/src/logstats.rs | Updates option-time extraction to use CuTime instead of CuDuration. |
| core/cu29_derive/src/lib.rs | Changes generated TaskOutputSpec to use TypePath::type_path instead of stringifying types. |
| core/cu29_clock/src/lib.rs | Introduces real CuTime type (timestamp) and debug scalar registrations for time/duration kinds. |
| components/sources/cu_rp_encoder/src/lib.rs | Switches encoder interrupt TOV storage from CuDuration to CuTime. |
| components/sources/cu_gnss_ublox/src/protocol.rs | Populates GNSS fix position from decoded degrees and removes direct lat/lon fields. |
| components/payloads/cu_spatial_payloads/tests/rerun_components.rs | Adds rerun component emission test for GeodeticPosition. |
| components/payloads/cu_spatial_payloads/src/rerun_components.rs | Implements rerun AsComponents for GeodeticPosition via GeoPoints. |
| components/payloads/cu_spatial_payloads/src/lib.rs | Adds GeodeticPosition payload type and aligns no_std/core usage. |
| components/payloads/cu_gnss_payloads/src/lib.rs | Migrates GNSS fix to position: GeodeticPosition and reexports the type. |
| components/payloads/cu_gnss_payloads/Cargo.toml | Adds dependency on cu-spatial-payloads for shared GeodeticPosition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type Output = CuTime; | ||
|
|
||
| fn mul(self, rhs: CuTime) -> Self::Output { | ||
| CuTime(self as u64 * rhs.as_nanos()) |
Comment on lines
+3423
to
+3454
| debug_field_descriptor( | ||
| "tov", | ||
| None, | ||
| "object", | ||
| "message_metadata::Tov", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Struct, | ||
| vec![ | ||
| debug_field_descriptor( | ||
| "tov.kind", | ||
| None, | ||
| "string", | ||
| "alloc::string::String", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Scalar, | ||
| Vec::new(), | ||
| ), | ||
| debug_registered_scalar_field_descriptor::<CuTime>("tov.time_ns", None, false), | ||
| debug_registered_scalar_field_descriptor::<CuTime>("tov.start_ns", None, false), | ||
| debug_registered_scalar_field_descriptor::<CuTime>("tov.end_ns", None, false), | ||
| ], | ||
| ), | ||
| debug_field_descriptor( | ||
| "process_time", | ||
| None, | ||
| "object", | ||
| "message_metadata::ProcessTime", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Struct, |
Comment on lines
+3442
to
+3519
| debug_registered_scalar_field_descriptor::<CuTime>("tov.time_ns", None, false), | ||
| debug_registered_scalar_field_descriptor::<CuTime>("tov.start_ns", None, false), | ||
| debug_registered_scalar_field_descriptor::<CuTime>("tov.end_ns", None, false), | ||
| ], | ||
| ), | ||
| debug_field_descriptor( | ||
| "process_time", | ||
| None, | ||
| "object", | ||
| "message_metadata::ProcessTime", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Struct, | ||
| vec![ | ||
| debug_registered_scalar_field_descriptor::<CuTime>( | ||
| "process_time.start_ns", | ||
| None, | ||
| true, | ||
| ), | ||
| debug_registered_scalar_field_descriptor::<CuTime>( | ||
| "process_time.end_ns", | ||
| None, | ||
| true, | ||
| ), | ||
| ], | ||
| ), | ||
| debug_field_descriptor( | ||
| "status_txt", | ||
| None, | ||
| "string", | ||
| "alloc::string::String", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Scalar, | ||
| Vec::new(), | ||
| ), | ||
| debug_field_descriptor( | ||
| "origin", | ||
| None, | ||
| "object", | ||
| "message_metadata::Origin", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Struct, | ||
| vec![ | ||
| debug_field_descriptor( | ||
| "origin.subsystem_code", | ||
| None, | ||
| "integer", | ||
| "u16", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Scalar, | ||
| Vec::new(), | ||
| ), | ||
| debug_field_descriptor( | ||
| "origin.instance_id", | ||
| None, | ||
| "integer", | ||
| "u32", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Scalar, | ||
| Vec::new(), | ||
| ), | ||
| debug_field_descriptor( | ||
| "origin.cl_id", | ||
| None, | ||
| "integer", | ||
| "u64", | ||
| None, | ||
| false, | ||
| DebugFieldKind::Scalar, | ||
| Vec::new(), | ||
| ), | ||
| ], | ||
| ), | ||
| ] |
Comment on lines
103
to
+136
| @@ -113,7 +113,7 @@ | |||
| ( | |||
| id: "mixer1", | |||
| type: "tasks::QuadXMixer", | |||
| logging: (enabled: false), | |||
| logging: (enabled: true), | |||
| config: { | |||
| "motor_index": 1, | |||
| "props_out": true, | |||
| @@ -123,7 +123,7 @@ | |||
| ( | |||
| id: "mixer2", | |||
| type: "tasks::QuadXMixer", | |||
| logging: (enabled: false), | |||
| logging: (enabled: true), | |||
| config: { | |||
| "motor_index": 2, | |||
| "props_out": true, | |||
| @@ -133,7 +133,7 @@ | |||
| ( | |||
| id: "mixer3", | |||
| type: "tasks::QuadXMixer", | |||
| logging: (enabled: false), | |||
| logging: (enabled: true), | |||
This is to improve the rendering of values, preserve the units etc on the debug API.
3ea0a68 to
21a88be
Compare
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.
Summary
This is to improve the rendering of values, preserve the units etc on the debug API.
Related issues
Changes
Testing
just fmtjust lintjust testjust std-ci(if std/runtime paths are impacted)just nostd-ci(if embedded/no_std paths are impacted)pro-tip:
justwith no parameters in the root defaults tojust fmt,just lint, andjust test.Checklist
Breaking changes (if any)
Additional context