Skip to content

Add reboot service #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add reboot service #359

wants to merge 3 commits into from

Conversation

mattrouss
Copy link

Add /reboot service to restart camera on failure. Support USB and GMSL.
Please note that GMSL reboot impacts all connected cameras.

@mattrouss mattrouss requested review from Myzhar and Copilot July 11, 2025 13:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new /reboot service to allow restarting the ZED camera on failure, with support for both USB and GMSL inputs.

  • Registers the reboot service in initServices
  • Implements camera restart logic (restartCamera, threadFunc_zedRestart) and synchronization helpers (guardDataThread, releaseDataThread)
  • Updates grab and sensor threads to pause during camera reboot

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
zed_camera_component_main.cpp Added reboot service, restart logic, synchronization, and callback
zed_camera_component.hpp Declared new methods, members, and service pointer for reboot
sl_types.hpp Added rebootSrvPtr typedef
Comments suppressed due to low confidence (3)

zed_components/src/zed_camera/include/zed_camera_component.hpp:1017

  • [nitpick] The name mSrvReboot (service name) is ambiguous next to mRebootSrv (service pointer). Rename it to mSrvRebootName for consistency with other service name members.
  const std::string mSrvReboot = "reboot";

zed_components/src/zed_camera/include/zed_camera_component.hpp:44

  • [nitpick] New methods (guardDataThread, releaseDataThread, restartCamera, threadFunc_zedRestart, callback_reboot) lack comments. Please add Doxygen or inline documentation explaining their purpose and usage.
  void guardDataThread();

zed_components/src/zed_camera/src/zed_camera_component_main.cpp:294

  • The new /reboot service and restartCamera logic are not covered by existing tests. Consider adding unit or integration tests for both successful and failure reboot scenarios.
  srv_name = srv_prefix + mSrvReboot;

// Wait until camera has been closed by reboot service call
mRebootCondVar.wait(lock, [&]() { return !mCameraRebooting; });

if (mRestartThread.joinable()) {
Copy link
Preview

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

Joining the restart thread while holding mRebootMutex can lead to deadlocks or block other camera threads. Consider moving the join() call outside the locked section or unlocking before joining.

Suggested change
if (mRestartThread.joinable()) {
bool shouldJoin = mRestartThread.joinable();
lock.unlock();
if (shouldJoin) {

Copilot uses AI. Check for mistakes.

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

Successfully merging this pull request may close these issues.

2 participants