11#!/usr/bin/env python3
22
33# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
4- # Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+ # Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
55#
66# Licensed under the Apache License, Version 2.0 (the "License");
77# you may not use this file except in compliance with the License.
2020"""
2121Ncurses-based frontend for Greenwave Monitor.
2222
23- This module provides a terminal interface for monitoring ROS topics
24- similar to the old curses dashboard but using the GreenwaveUiAdaptor .
23+ This module provides a terminal-based interface for monitoring ROS2 topics
24+ with real-time diagnostics including publication rates, latency, and status .
2525"""
2626
2727import curses
@@ -49,7 +49,7 @@ def __init__(self):
4949
5050 # Topic management
5151 self .topics_lock = Lock ()
52- self .all_topics = {} # topic_name -> topic_type
52+ self .all_topics = set () # Set of all available topic names
5353 self .visible_topics = [] # Filtered list of topics to display
5454
5555 # UI state
@@ -80,18 +80,11 @@ def update_topic_list(self):
8080 if (not topic_name .endswith ('/nitros' )) and ('/nitros/' not in topic_name )
8181 ]
8282
83- topic_dict = {topic_name : topic_type [0 ] if topic_type else ''
84- for topic_name , topic_type in topic_names_and_types }
83+ topic_set = {topic_name for topic_name , topic_type in topic_names_and_types }
8584
8685 with self .topics_lock :
8786 # Update topics
88- for topic , topic_type in topic_dict .items ():
89- self .all_topics [topic ] = topic_type
90-
91- # Remove topics that no longer exist
92- to_remove = [topic for topic in self .all_topics if topic not in topic_dict ]
93- for topic in to_remove :
94- del self .all_topics [topic ]
87+ self .all_topics = topic_set
9588
9689 # Update visible topics with filtering
9790 self .update_visible_topics ()
@@ -101,7 +94,7 @@ def update_topic_list(self):
10194
10295 def update_visible_topics (self ):
10396 """Update the visible topics list based on current filters."""
104- all_topic_names = list (self .all_topics . keys () )
97+ all_topic_names = list (self .all_topics )
10598
10699 if self .show_only_monitored and self .ui_adaptor :
107100 # Filter to only show topics that have diagnostic data (are being monitored)
0 commit comments