Skip to content

Add required restart trigger node and wire /phenaix/controller restart button with confirmation#29

Merged
marc-hanheide merged 4 commits into
mainfrom
copilot/add-restart-button-to-controller-html
May 13, 2026
Merged

Add required restart trigger node and wire /phenaix/controller restart button with confirmation#29
marc-hanheide merged 4 commits into
mainfrom
copilot/add-restart-button-to-controller-html

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

This change adds a controller-side Restart action that cleanly terminates the ROS 2 launch context. It does so by introducing a dedicated trigger-service node and marking it as required in launch so its exit shuts down the full system.

  • Launch lifecycle integration

    • Added a new restart_service_node process to viewer.launch.py.
    • Configured it with on_exit=Shutdown(...) so exiting this node stops the entire launch tree.
  • New restart trigger service node

    • Added ros2_web_viewer/restart_service_node.py.
    • Exposes std_srvs/Trigger service at /restart_system.
    • On successful request, it returns a trigger response and then shuts down its rclpy context to exit the process.
  • Packaging / executable wiring

    • Registered new console entry point in setup.py:
      • restart_service_node = ros2_web_viewer.restart_service_node:main
  • Controller UI update

    • Added a Restart button to web/phenaix/controller.html.
    • Wired via existing trigger bridge attributes:
      • data-trigger-service="/restart_system"
    • Added confirmation gating for restart:
      • data-trigger-confirm="Restart the system now?"
      • Clicking Restart opens a confirmation popup.
      • Confirm proceeds with the trigger call.
      • Cancel/close dismisses the popup without calling restart.
  • Frontend trigger handling update

    • Updated web/app.js so buttons with data-trigger-confirm require explicit user confirmation before calling /api/trigger.
  • Docs update

    • Updated README trigger-button section to note the default /restart_system behavior and required-node shutdown semantics.
<button
  class="ctrl-btn ctrl-btn-restart"
  data-trigger-service="/restart_system"
  data-trigger-confirm="Restart the system now?"
  data-trigger-timeout="2"
  data-trigger-cooldown="3">
  Restart
</button>
https://github.com/user-attachments/assets/a1abe134-c8d6-4f8f-889c-b507f39fd58b

Copilot AI linked an issue May 12, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add restart button to phenaix/controller.html Add required restart trigger node and wire /phenaix/controller restart button May 12, 2026
Copilot AI requested a review from marc-hanheide May 12, 2026 08:45
@marc-hanheide marc-hanheide marked this pull request as ready for review May 12, 2026 13:51
Print
</button>

<button
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

change the logic for the restart button so that the actual restart needs confirmation by the user. Clicking the main restart button should open a pop up with a question if a restart should really be carried out, and on the button confirming the restart should actually trigger the restart while closing the popup or declining the restart should just close the popup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented in commit 3fdc33e. Restart now requires user confirmation: the Restart button opens a confirmation popup (Restart the system now?), and only confirming proceeds with the trigger call; cancel/close dismisses without calling restart. Screenshot: https://github.com/user-attachments/assets/a1abe134-c8d6-4f8f-889c-b507f39fd58b

Copilot AI changed the title Add required restart trigger node and wire /phenaix/controller restart button Add required restart trigger node and wire /phenaix/controller restart button with confirmation May 13, 2026
Copilot AI requested a review from marc-hanheide May 13, 2026 07:04
@marc-hanheide marc-hanheide merged commit bdbc99c into main May 13, 2026
2 checks passed
@marc-hanheide marc-hanheide deleted the copilot/add-restart-button-to-controller-html branch May 13, 2026 08:37
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.

Shutdown button and node.

2 participants