This document describes how to add battery status from the Argo sailboat system to the XFCE4 desktop panel.
The battery status panel displays real-time battery information from the argo_battery_water.py ROS2 node, including:
- Battery voltage and percentage
- Charging status
- AC power presence
- Critical alerts (low battery, saltwater intrusion, high humidity)
scripts/battery_status_panel.py- Main battery status panel with continuous updatesscripts/battery_status_simple.py- Simple one-shot battery status displayscripts/battery_status_wrapper.sh- Wrapper script with ROS2 environmentscripts/argo_battery_panel.sh- Alternative launcher scriptscripts/setup_battery_panel.sh- Setup and configuration script.local/share/applications/argo-battery-panel.desktop- Desktop entry
-
Run the setup script:
cd ~/argo ./scripts/setup_battery_panel.sh
-
Follow the on-screen instructions to add the Generic Monitor plugin to your XFCE4 panel
- Right-click on the XFCE4 panel
- Select "Panel" → "Add New Items..."
- Choose "Generic Monitor" and click "Add"
- Right-click the new Generic Monitor and select "Properties"
- Configure the plugin:
- Command:
~/argo/scripts/battery_status_genmon_wrapper.sh - Update interval: 10 seconds (or your preference)
- Label: Leave empty or set to "Battery"
- Command:
- Click "Close" to save
You can always check battery status manually:
~/argo/scripts/battery_status_wrapper.shThe Generic Monitor plugin provides rich display capabilities:
- Dynamic Icons: Changes based on battery status (charging, low, normal)
- Color-coded Text: Green for normal, red for alerts
- Detailed Tooltips: Hover to see comprehensive battery information
- Click Actions: Click to open detailed status dialog (if zenity is available)
- Real-time Updates: Configurable update interval (default: 10 seconds)
The battery status displays with icons and text:
🔋 7.2V (45%) 🔌⚡- Normal battery with charging and AC power🔴 6.8V (15%) 🔋- Low battery warning💧 7.1V (42%) 🔌- Saltwater intrusion detected💦 7.3V (48%) ⚡- High humidity detected🔋 Service unavailable- Battery service not available🔋 Error- Service error or timeout
🔋- Normal battery🔴- Low battery alert💧- Saltwater intrusion💦- High humidity🔌- Charging active⚡- AC power present
-
Check if argo_battery_water node is running:
ros2 service list | grep battery_status -
Test the display manually:
~/argo/scripts/battery_status_wrapper.sh -
Check ROS2 environment:
source /opt/ros/humble/setup.bash ros2 service call /battery_status std_srvs/srv/Trigger
If the battery service is not available:
-
Start the argo_battery_water node:
python3 ~/argo/nodes/argo_battery_water.py -
Or start the full Argo system:
al # Using Argo CLI alias
The battery panel includes robust error handling:
- Throttled logging: Errors are logged max once every 30 seconds
- Graceful degradation: Shows "Service unavailable" when service is down
- Automatic recovery: Resumes normal operation when service returns
- Timeout handling: 2-second timeout for service calls
- Panel script: 5 seconds (configurable with
--update-interval) - Simple script: One-shot display
- XFCE4 Generic Monitor: 10 seconds (recommended)
You can modify the display format by editing the _format_battery_display() method in the Python scripts.
The battery panel integrates seamlessly with the Argo sailboat system:
- Uses the existing
/battery_statusservice fromargo_battery_water.py - Respects the same error handling and logging patterns
- Works with the Argo lifecycle management system
- Compatible with simulation mode (shows mock data)
- ROS2 Humble
- Python 3
- XFCE4 desktop environment
argo_battery_water.pynode runningstd_srvsROS2 package
- The panel will show "Service unavailable" when the Argo system is not running
- Battery status updates automatically when the Argo system starts
- No manual intervention required after initial setup
- Works in both real hardware and simulation modes