Skip to content

Adds Reflection & Schema capability to Copper with a small debug session demo #793

Merged
gbin merged 25 commits into
masterfrom
gbin/schema
Feb 9, 2026
Merged

Adds Reflection & Schema capability to Copper with a small debug session demo #793
gbin merged 25 commits into
masterfrom
gbin/schema

Conversation

@gbin

@gbin gbin commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Related issues

  • Closes #

Changes

Testing

  • just std-ci
  • just lint
  • cargo +stable nextest run --workspace --all-targets
  • Other (please specify):

Checklist

  • I have updated docs or examples where needed
  • I have added or updated tests where needed
  • I have considered platform impact (Linux/macOS/Windows/embedded)
  • I have considered config/logging changes (if applicable)
  • This change is not a breaking change (or I documented it below)

Breaking changes (if any)

  • forces the Reflect traits on all the tasks and messages
  • this in turns forces Clone on some originally more relaxed datastructures like CuArray

Additional context

@gbin gbin marked this pull request as draft February 8, 2026 18:45
@gbin gbin requested a review from makeecat February 8, 2026 18:45
@gbin gbin marked this pull request as ready for review February 9, 2026 15:13
};
Ok(Self {
board,
board: spin::Mutex::new(board),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not worried about that we need to totally nuke it away with resources instead of this horror.

#[reflect(ignore)]
last_lq: Option<LinkStatistics>,
#[reflect(ignore)]
last_rc: Option<RcChannels>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is HW so we won't have any state in replay anyway, only a few key frames, we can improve that if necessary when needed

Tx::Id: Send + Sync + 'static,
Rx::Id: Send + Sync + 'static,
{
#[reflect(ignore)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's go one level deeper if necessary in the future. it is ok that we cut introspection here.

Tx: BridgeChannelSet + 'static,
Rx: BridgeChannelSet + 'static,
Tx::Id: core::fmt::Debug + Send + Sync + 'static,
Rx::Id: core::fmt::Debug + Send + Sync + 'static,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introspection comes with multithreading cost

#[reflect(ignore)]
pending_requests: MspRequestBatch,
#[reflect(ignore)]
tx_buffer: HeaplessVec<u8, TX_BUFFER_CAPACITY>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previously. let's cut here the invasiveness and go deeper as needed

pub struct Lewansoul {
port: Box<dyn SerialPort>,
#[reflect(ignore)]
port: Mutex<Box<dyn SerialPort>>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will never lock but got dragged in by the introspection. If this becomes an issue we can do a pass on it later.

_marker: PhantomData<P>,
#[reflect(ignore)]
_marker: PhantomData<fn() -> P>,
#[reflect(ignore)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

pub struct CuGStreamer<const N: usize> {
#[reflect(ignore)]
pipeline: Pipeline,
#[reflect(ignore)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread components/tasks/cu_apriltag/src/lib.rs Outdated
task: Arc<Mutex<T>>,
#[reflect(ignore)]
output: Arc<Mutex<CuMsg<O>>>,
#[reflect(ignore)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will see later to improve the introspectability

/* move .text to start /after/ the boot info */
_stext = ADDR(.start_block) + SIZEOF(.start_block);

SECTIONS {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because this is the first time we use this section and it was initialized on top of the init one Oo

critical_section::set_impl!(BaremetalCriticalSection);

#[cfg(not(feature = "std"))]
unsafe impl critical_section::Impl for BaremetalCriticalSection {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something unrelated regressed here, I don't get it TBH.

Comment thread Cargo.toml Outdated
derive_more = { version = "2.0", features = ["full"] }
paste = { version = "1.0.15", default-features = false }
bevy_reflect = { version = "0.18.0", default-features = false, features = [
"auto_register_inventory",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is suspect, I am checking this flag out

@gbin

gbin commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator Author

I'll make a documentation pass on another PR as it will be linked to the feature flag etc.

Comment thread core/cu29_runtime/src/payload.rs
Comment thread components/tasks/cu_apriltag/src/lib.rs
Comment thread components/bridges/cu_iceoryx2_bridge/src/lib.rs Outdated
@gbin gbin merged commit b165b50 into master Feb 9, 2026
23 checks passed
@gbin gbin deleted the gbin/schema branch February 9, 2026 23:29
@makeecat

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b165b50f0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +138 to +142
family: String,
bits_corrected: usize,
tagsize: f64,
fx: f64,
fy: f64,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid duplicating AprilTag tunables outside tag_params

These reflected fields introduce a second source of truth for camera/tag parameters, but detection still consumes the hidden tag_params struct in process, so edits made through reflected_task_mut will not affect pose estimation and can leave introspection output inconsistent with runtime behavior. This is user-visible in debug sessions that attempt live tuning, because the reflected values appear updated while the detector continues using stale calibration values.

Useful? React with 👍 / 👎.

Comment on lines +186 to +188
fn type_path() -> &'static str {
"cu29_runtime::simulation::CuSimSrcTask"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include generic parameter in CuSimSrcTask type path

This TypePath implementation erases T, so different concrete simulation source tasks (for different payload types) all register under the same reflected path even though register_reflect_types registers each concrete task type. In missions with multiple simulated source payloads, schema dumps and any type-path based lookup become ambiguous because multiple distinct registrations share cu29_runtime::simulation::CuSimSrcTask.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants