GUI Subsystem - foolofato0k/Robo-Studio2 GitHub Wiki
Summary and Scope
This page describes the Robo‑Da‑Vinci GUI subsystem, a Tkinter interface that captures user selfies, previews contours live, allows countdown and style selection, and publishes confirmation for path planning.
- Launching and visualising live vs. processed camera feed
- User controls: countdown timer, style dropdown, capture/retake
- Publishing confirmation messages and saving captured images
- Displaying a progress bar for processing stages
Subsystem Architecture
The GUI subsystem is implemented as a single ROS 2 node that cleanly separates user interface logic from message publishing, It consists of:
- PhotoGUI: Tkinter-based interface handling live camera preview, countdown, style selection, capture/retake, and progress visualisation.
- PhotoPublisher Topic: ROS 2 topic that is published from the GUI, publishes a std_msgs/Bool on the photo_confirmed topic, and triggers path planning processing.
Structure
-
Requirements:
- ROS 2
- Python libs
- Webcam
-
Running:
- Colcon build
- Source
- ROS2 run command
-
UI Elements:
- Live camera pane
- Contours pane
- Countdown timer dropdown
- Style dropdown
- Take Photo / Yes / No buttons
- Progress bar + status labels
-
Behaviour:
- Camera autodetection (/dev/videoX or indices)
- Frame processing (gray → blur → edges → contours)
- Countdown & capture image
- Confirmation → publish, save, and progress visualisation
Expectations
- Live Camera Feed (left)
- Contour Preview (right)
- Countdown Timer: None, 3s, 5s, 10s
- Style Selector: None, Wanted, Style 2-4
-
Take Photo:
- Freezes feed after the countdown
- Prompts Yes / No
-
On Confirm:
- Publishes std_msgs/Bool on photo_confirmed
- Saves image to image_processing/test_images/webcam_img.jpg
- Shows progress: Processing Image → Path Planning → Drawing → Completed
Instructions
Build your workspace:
colcon build --symlink-install
Source your workspace:
source install/setup.bash
Launch the GUI:
ros2 run robo_da_vinci gui_node
- Live Preview: confirm your webcam feed appears on the left, contours on the right.
- Countdown: choose None, 3s, 5s, or 10s before capture.
- Style Selection: pick an artistic style; the label updates immediately.
- Capture: click Take Photo to freeze the image, then use Yes to confirm or No to retake.
- Progress: after confirmation, watch the progress bar advance through Processing Image → Path Planning → Drawing until Completed.
Subsystem Tests
Below is a test plan for the GUI subsystem. Users can run these tests to verify functionality.
Test 1:
Test 1: Live Camera Feed Display
- Requirement: Show a real-time camera feed within the GUI window.
- Assumptions: Webcam functional, OpenCV installed.
- Procedure:
- Connect and power on the webcam.
- Launch the GUI: ros2 run robo_da_vinci gui_node.
- Observe the left pane for live video.
- Move an object in front of the camera.
-
Pass Criteria:
- Feed appears within 5 s
- Updates smoothly with minimal latency.
-
Fail Criteria:
- No feed
- Frozen image
- Program crash.
Test 2:
Test 2: Live Processed Image Display
- Requirement: Show real-time contour-processed preview.
- Assumptions: Image processing runs in real time.
- Procedure:
- With the GUI running, confirm both panes (live and processed) are visible.
- Compare movements between the two.
-
Pass Criteria:
- Processed pane updates in real time
- Mirroring movements.
-
Fail Criteria:
- No processed pane
- Frozen or laggy display.
Test 3:
Test 3: GUI Responsiveness
- Requirement: UI responds promptly to user interactions.
- Procedure:
- Click dropdowns and buttons (timer, style, Take Photo, Yes/No).
- Measure response time.
-
Pass Criteria:
- All interactions respond within 1s.
-
Fail Criteria:
- Delays > 1 s
- Unresponsive elements
- Incorrect actions.
Test 4:
Test 4: Capture Workflow & Style Selection
- Requirement: Countdown, capture, retake, and style dropdown function correctly.
- Procedure:
- Select each timer option and press Take Photo.
- Confirm countdown behaviour.
- Choose a style and verify selection label updates.
- On capture, press Yes and No to test both flows.
-
Pass Criteria: Countdown matches selection
- Style label updates
- Yes, saves and publishes
- No returns to live view.
-
Fail Criteria:
- Incorrect countdown
- Style not applied
- Confirmation flow broken.
Test 5:
Test 5: Progress Bar Synchronisation
- Requirement: Progress bar reflects processing stages.
- Procedure:
- After confirming a capture, observe the progress bar.
- Ensure it transitions through Processing Image → Path Planning → Drawing to Completed.
-
Pass Criteria:
- Bar moves smoothly in sync with simulated stages
- “COMPLETED” appears and blinks.
-
Fail Criteria:
- Bar frozen
- Jumps incorrectly
- Missing stages.