Skip to content

Read the starting Focus from the camera - #2

Merged
deepanaishtaweera merged 2 commits into
owl-humblefrom
focus-read-back-initial-from-camera
Oct 7, 2026
Merged

deepanaishtaweera merged 2 commits into
owl-humblefrom
focus-read-back-initial-from-camera

Conversation

@deepanaishtaweera

Copy link
Copy Markdown
Collaborator

This is a follow-up to #1.

  • The read-back now compares against the camera's Focus as it was before the command, not the node's value. The node's value can be stale, since the lens can move Focus on its own, and a stale value let the pre-autofocus focus count as movement and settle early.
  • If no read succeeds within 10 s, the log now says so instead of reporting that the feature is still changing.

Checked on the deck: FocusAuto settled at 9974 2.5 s after the command, and get_parameters returned the same value.

…read

The node's Focus can be stale (the lens moves it on its own, e.g. with zoom),
so take the pre-command value from the camera. If no read succeeds within
the timeout, say so instead of reporting a moving feature.

Copilot AI 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.

🟡 Changes recommended

A failed initial camera read silently falls back to the stale node value and can still cause premature settling.

1 open finding
What changed in this PR

Updates autofocus read-back to use the camera’s current focus as its baseline and improves timeout diagnostics.

Changes:

  • Refreshes focus before executing FocusAuto.
  • Tracks successful post-command reads.
  • Distinguishes total read failure from continued movement.
File Description
camera_aravis2/​src/​camera_driver.cpp Updates autofocus baseline and timeout handling.
camera_aravis2/​include/​camera_aravis2/​camera_driver.h Adds the successful-read counter.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread camera_aravis2/src/camera_driver.cpp Outdated
@deepanaishtaweera
deepanaishtaweera requested a balanced review from Copilot October 7, 2026 15:33
@deepanaishtaweera
deepanaishtaweera merged commit 561ba59 into owl-humble Oct 7, 2026
1 check passed
@deepanaishtaweera
deepanaishtaweera deleted the focus-read-back-initial-from-camera branch October 7, 2026 15:33

Copilot AI 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.

🟡 Changes recommended

The timeout can incorrectly claim no read succeeded when only the final attempt failed.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

{
RCLCPP_WARN(logger_, "'%s' still changing %llds after the command; stopped reading it back.",
read_back_param_.c_str(), static_cast<long long>(kTimeout.count()));
if (read_back_reads_ == 0 || !read_back_last_ok_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants