Skip to content

Conversation

@bmchalenv
Copy link
Contributor

Add a --hide-unmonitored flag to the ncurses frontend. This makes it possible for the user to start greenwave monitor with only the topics that are being monitored visible.

Tests were also added to verify the argument parsing is functional with the frontend.

Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
@greptile-apps
Copy link

greptile-apps bot commented Dec 30, 2025

Greptile Summary

This PR adds a --hide-unmonitored command-line flag to the ncurses frontend, enabling users to start the monitor with only monitored topics visible. The implementation includes:

  • Argument parsing: Added parse_args() function that uses parse_known_args() to handle the new flag while passing through ROS-specific arguments to rclpy.init()
  • Variable renaming: Renamed show_only_monitored to hide_unmonitored throughout for better clarity
  • Dynamic UI help text: Improved the status line to show contextual help (h=show unmonitored vs h=hide unmonitored) based on current state
  • Bash script integration: Updated ncurses_dashboard script to parse and forward the --hide-unmonitored flag
  • Test coverage: Added comprehensive pytest tests for argument parsing including default behavior, flag parsing, and ROS args passthrough

The changes are well-structured, maintain backward compatibility (defaults to showing all topics), and follow existing code patterns. All functionality remains intact with the toggle behavior working both via command-line flag and runtime keyboard shortcut.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation with proper argument parsing, comprehensive test coverage, backward compatibility preserved, and no breaking changes. The renaming from show_only_monitored to hide_unmonitored improves code clarity, and the dynamic help text enhances user experience
  • No files require special attention

Important Files Changed

Filename Overview
greenwave_monitor/greenwave_monitor/ncurses_frontend.py Added --hide-unmonitored argument parsing with proper ROS args passthrough, renamed show_only_monitored to hide_unmonitored, and improved help text to dynamically reflect current toggle state
greenwave_monitor/test/test_ncurses_frontend_argparse.py New test file with comprehensive coverage for argument parsing including defaults, flag parsing, and ROS args passthrough
greenwave_monitor/scripts/ncurses_dashboard Added --hide-unmonitored flag parsing in bash script with proper array handling and updated help documentation
greenwave_monitor/CMakeLists.txt Added pytest test registration for new argument parsing tests with appropriate timeout

Sequence Diagram

sequenceDiagram
    participant User
    participant Script as ncurses_dashboard
    participant ArgParser as parse_args()
    participant Main as main()
    participant Node as GreenwaveNcursesFrontend
    participant UI as curses_main()
    
    User->>Script: ./ncurses_dashboard --hide-unmonitored
    Script->>Script: Parse bash arguments
    Script->>Script: Set HIDE_UNMONITORED=true
    Script->>Main: python3 -m ncurses_frontend --hide-unmonitored
    
    Main->>ArgParser: parse_args(args)
    ArgParser->>ArgParser: parse_known_args()
    ArgParser-->>Main: (parsed_args, ros_args)
    
    Main->>Main: rclpy.init(args=ros_args)
    Main->>Node: GreenwaveNcursesFrontend(hide_unmonitored=True)
    Node->>Node: self.hide_unmonitored = True
    Node->>Node: update_topic_list()
    Node->>Node: update_visible_topics()
    Note over Node: Filters topics based on<br/>hide_unmonitored flag
    
    Main->>UI: curses.wrapper(curses_main, node)
    
    loop Display Loop
        UI->>Node: Check node.hide_unmonitored
        alt hide_unmonitored == True
            UI->>UI: Display "monitored only"
            UI->>UI: Show help "h=show unmonitored"
        else hide_unmonitored == False
            UI->>UI: Display "all topics"
            UI->>UI: Show help "h=hide unmonitored"
        end
    end
    
    User->>UI: Press 'h' key
    UI->>Node: Toggle node.hide_unmonitored
    Node->>Node: update_visible_topics()
    UI->>UI: Update display with new filter
Loading

@greptile-apps
Copy link

greptile-apps bot commented Dec 30, 2025

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

self.status_message = ''
self.status_timeout = 0
self.show_only_monitored = False
self.show_only_monitored = hide_unmonitored
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit but we should pick one name or the other, I don't care too much which (but I'll vote for show_only_monitored)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched it to "hide unmonitored" to stay consistent with the controls in the ncurses interface. We call it that there and should have one consistent naming.

Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
Signed-off-by: Blake McHale <bmchale@nvidia.com>
@bmchalenv bmchalenv requested a review from sgillen December 30, 2025 20:51
Copy link
Collaborator

@sgillen sgillen left a comment

Choose a reason for hiding this comment

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

LGTM

@sgillen sgillen merged commit 984432a into NVIDIA-ISAAC-ROS:main Dec 30, 2025
17 checks passed
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