Skip to content

Commit 726c070

Browse files
authored
Add nccurses based frontend (#3)
Adds a simple curses based frontend, less featureful, but more performant with large number of topics than r2s_gw
1 parent f05a269 commit 726c070

File tree

6 files changed

+700
-13
lines changed

6 files changed

+700
-13
lines changed

.github/workflows/debian-packages.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,54 @@ jobs:
128128
129129
# Verify packages are installed
130130
dpkg -s ros-${{ matrix.ros_distro }}-r2s-gw ros-${{ matrix.ros_distro }}-greenwave-monitor ros-${{ matrix.ros_distro }}-greenwave-monitor-interfaces
131+
shell: bash
132+
133+
- name: Test ncurses_dashboard execution (no extra dependencies)
134+
run: |
135+
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
136+
137+
# Test ncurses frontend BEFORE installing any pip dependencies
138+
# This verifies it works with only stdlib (curses) from the debian package
139+
echo "Testing ncurses_dashboard (no extra dependencies required)..."
140+
141+
# Start monitor node in background for ncurses to connect to
142+
ros2 run greenwave_monitor greenwave_monitor > /dev/null 2>&1 & echo $! > /tmp/gwm_ncurses.pid
143+
sleep 3
144+
145+
# Run ncurses frontend with simulated terminal and quit command
146+
# Exit code 0 means clean exit (not 11 for SIGSEGV or 134 for SIGABRT)
147+
set +e
148+
timeout 10s script -qfec 'python3 -m greenwave_monitor.ncurses_frontend' /dev/null <<< $'q'
149+
EXIT_CODE=$?
150+
set -e
151+
152+
if [ $EXIT_CODE -eq 0 ]; then
153+
echo "✓ ncurses_dashboard exited cleanly"
154+
elif [ $EXIT_CODE -eq 124 ]; then
155+
echo "✗ ncurses_dashboard timed out"
156+
kill -9 "$(cat /tmp/gwm_ncurses.pid)" 2>/dev/null || true
157+
exit 1
158+
elif [ $EXIT_CODE -eq 11 ] || [ $EXIT_CODE -eq 139 ]; then
159+
echo "✗ ncurses_dashboard crashed with SIGSEGV (code: $EXIT_CODE)"
160+
kill -9 "$(cat /tmp/gwm_ncurses.pid)" 2>/dev/null || true
161+
exit 1
162+
elif [ $EXIT_CODE -eq 134 ]; then
163+
echo "✗ ncurses_dashboard crashed with SIGABRT/core dump (code: $EXIT_CODE)"
164+
kill -9 "$(cat /tmp/gwm_ncurses.pid)" 2>/dev/null || true
165+
exit 1
166+
else
167+
echo "✓ ncurses_dashboard exited with code: $EXIT_CODE (acceptable)"
168+
fi
131169
132-
# Install Python dependencies
170+
# Cleanup
171+
kill -INT "$(cat /tmp/gwm_ncurses.pid)" 2>/dev/null || true
172+
sleep 1
173+
kill -9 "$(cat /tmp/gwm_ncurses.pid)" 2>/dev/null || true
174+
shell: bash
175+
176+
- name: Install Python dependencies for r2s_gw
177+
run: |
178+
# Install Python dependencies (only needed for r2s_gw, not ncurses)
133179
apt-get install -y python3-pip || true
134180
if [[ "${{ matrix.ros_distro }}" == "jazzy" || \
135181
"${{ matrix.ros_distro }}" == "kilted" || \

README.md

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ The diagnostics messages follow conventions from [Isaac ROS NITROS](https://gith
66

77
Finally, we provide monitoring code as a standalone C++ header, which can be integrated into your own nodes.
88

9-
## Dashboard Interface
9+
## Dashboard Interfaces
1010

11-
The Greenwave Monitor ships with a fork of [r2s](https://github.com/mjcarroll/r2s) to provide an intuitive terminal interface that displays real-time statistics for all monitored topics. Click around with your mouse and tab key, and see the bottom bar with keyboard shortcuts.
11+
The Greenwave Monitor provides two terminal-based dashboard options:
12+
13+
### r2s_gw Dashboard (Rich TUI)
14+
Ships with a fork of [r2s](https://github.com/mjcarroll/r2s) to provide an intuitive terminal interface that displays real-time statistics for all monitored topics. Click around with your mouse and tab key, and see the bottom bar with keyboard shortcuts.
1215

1316
![r2s_gw + Greenwave Monitor Dashboard](docs/images/greenwave_r2s_dashboard.png)
1417

18+
### ncurses Dashboard (Lightweight)
19+
A lightweight ncurses-based interface focused specifically on topic monitoring with keyboard navigation. Features color-coded status indicators, interactive frequency management, and filtering options.
20+
1521
## Key Features
1622

1723
- **High Performance**: Up to 10x more CPU efficient than the built-in `ros2 topic hz` command
18-
- **Interactive Dashboard**: Real-time visualization of monitoring data with an easy-to-use terminal interface
19-
- **Dynamic Topic Management**: Add or remove topics from monitoring without restarting
20-
- **Topic Status Indicators**: Color-coded topic status to easily catch topics that are not working as expected
24+
- **Multiple Dashboard Options**: Choose between rich TUI (r2s_gw) or lightweight ncurses interface
25+
- **Real-time Monitoring**: Live visualization of topic rates, latency, and status with color-coded indicators
26+
- **Interactive Management**: Add/remove topics and set expected frequencies directly from the interface
2127
- **Universal Compatibility**: Displays diagnostics from any source that publishes a compatible `/diagnostics` topic, including NVIDIA Nova sensors and other hardware drivers
2228

2329
## Installation
@@ -34,27 +40,59 @@ source install/setup.sh
3440

3541
## Usage
3642

37-
### Monitor Dashboard (Recommended)
43+
### Monitor Dashboards
44+
45+
The easiest way to use Greenwave Monitor is with one of the all-in-one dashboard commands, which provide visibility into all diagnostics, including those from drivers that publish their own diagnostic data.
3846

39-
The easiest way to use Greenwave Monitor is with the all-in-one dashboard, which provides visibility into all diagnostics, including those from drivers that publish their own diagnostic data:
47+
#### r2s_gw Dashboard (Rich TUI)
4048

4149
```bash
4250
ros2 run greenwave_monitor r2s_gw_dashboard
4351
```
4452

45-
This command:
46-
- Starts the greenwave monitor node in the background
47-
- Launches the r2s_gw TUI frontend in the foreground
48-
- Automatically handles cleanup when you exit
53+
Features:
54+
- Mouse and keyboard navigation
55+
- Tabbed interface (Topics, Nodes, Interfaces)
56+
- Rich text rendering and charts
57+
- Comprehensive ROS 2 system overview
58+
59+
#### ncurses Dashboard (Lightweight)
60+
61+
```bash
62+
ros2 run greenwave_monitor ncurses_dashboard
63+
```
64+
65+
Features:
66+
- Keyboard-only navigation (↑/↓ arrows, Enter, etc.)
67+
- Real-time topic monitoring with color-coded status
68+
- Interactive frequency management (`f` to set, `c` to clear)
69+
- Topic filtering (`h` to hide unmonitored topics)
70+
- Minimal resource usage
71+
72+
##### ncurses Dashboard Controls
73+
74+
- **↑/↓ arrows**: Navigate topics
75+
- **Enter/Space**: Toggle monitoring for selected topic
76+
- **f**: Set expected frequency for selected topic
77+
- **c**: Clear expected frequency for selected topic
78+
- **h**: Toggle between showing all topics vs monitored only
79+
- **q**: Quit
80+
81+
Both commands:
82+
- Start the greenwave monitor node in the background
83+
- Launch the respective frontend in the foreground
84+
- Automatically handle cleanup when you exit
4985

5086
#### Dashboard Options
5187

5288
```bash
5389
# Launch with demo publisher nodes
5490
ros2 run greenwave_monitor r2s_gw_dashboard --demo
91+
ros2 run greenwave_monitor ncurses_dashboard --demo
5592

5693
# Enable logging to a directory
5794
ros2 run greenwave_monitor r2s_gw_dashboard --log-dir /path/to/logs
95+
ros2 run greenwave_monitor ncurses_dashboard --log-dir /path/to/logs
5896
```
5997

6098
### Manual Launch (ros2 topic hz mode)

greenwave_monitor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ install(
6868
install(
6969
PROGRAMS
7070
scripts/r2s_gw_dashboard
71+
scripts/ncurses_dashboard
7172
DESTINATION lib/${PROJECT_NAME}
7273
)
7374

0 commit comments

Comments
 (0)