Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# 🐞 FRE Information Panel

ROS 2 package + React/Vite web UI for displaying information (currently only bug detection alerts).
ROS 2 package + React/Vite web UI for displaying information alerts (plant health, pest detection, etc.).

The project uses `rclnodejs/web` as the browser bridge and is containerised through the `aoc_container_base` stack.

## Topics

### Bug Detection
### Alerts

- Topic: `/bug_detection/detected_bugs`
- Topic: `/information_panel/alert`
- Message type: `std_msgs/msg/String`
- Expected options: `[ "bee", "butterfly", "ladybird" ]`
- Expected options: `[ "bee", "butterfly", "ladybird", "diseased_plant" ]`
- Can be passed as `bee,butterfly` when both are detected.
- Example: `diseased_plant` for diseased plant classification.
Comment on lines +11 to +15

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not correct. I will be getting in alerts for diseased_plant and not jute. However, the ROS system underpinning this will have the detections correctly.


## Architecture

Expand All @@ -27,7 +28,7 @@ This package is intentionally coupled so ROS tooling also drives the Node build.
- rosdep installs system dependencies from package.xml, including nodejs.
- colcon build triggers npm install and npm run build via CMake custom target.
- ros2 launch starts the UI and bridge as separate processes.
- The UI display timeout is configurable with the launch argument idle_ms.
- The UI display timeout is configurable with the launch argument alert_persistence_ms.
- Runtime requires Node.js `>=24.11.1 <25` (see `.nvmrc`, `package.json` engines, and Dockerfile configuration).

## Devcontainer Usage
Expand Down Expand Up @@ -59,9 +60,17 @@ This launch file starts two processes separately:
To change how long text remains visible after the most recent topic update:

```bash
ros2 launch fre_information_panel web.launch.py idle_ms:=5000
ros2 launch fre_information_panel web.launch.py alert_persistence_ms:=5000
```

And to remove the introduction sound effects on each detection use the following parameter:

```bash
ros2 launch fre_information_panel web.launch.py alert_announcement_with_introduction:=false
```

These values are both exposed to the final container as environment variables, see [compose.yaml](./compose.yaml).

Services exposed:

- UI: http://localhost:5173
Expand Down Expand Up @@ -126,15 +135,16 @@ ros2 launch fre_information_panel web.launch.py
3. Publish a test message from another ROS terminal in the same domain:

```bash
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'bee'}"
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'butterfly'}"
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'ladybird'}"
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'bee,ladybird'}"
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'bee,butterfly'}"
ros2 topic pub /bug_detection/detected_bugs std_msgs/msg/String "{data: 'bee,butterfly,ladybird'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'bee'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'butterfly'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'ladybird'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'diseased_plant@left'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'bee,ladybird'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'bee,butterfly'}"
ros2 topic pub --once /information_panel/alert std_msgs/msg/String "{data: 'bee,butterfly,ladybird'}"
```

4. Confirm the page updates to indicate that the bug has been found.
4. Confirm the page updates to display the alert.

## Optional Hot-Reload UI Workflow

Expand Down
2 changes: 2 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
- ROS_DOMAIN_ID=10
- RMW_IMPLEMENTATION=rmw_fastrtps_cpp
- FRE_INFORMATION_PANEL_BRIDGE_ENDPOINT=/capability
- FRE_INFORMATION_PANEL_ALERT_PERSISTENCE_MS=5000
- FRE_INFORMATION_PANEL_ALERT_ANNOUNCEMENT_WITH_INTRODUCTION=true

networks:
ros_net:
26 changes: 20 additions & 6 deletions src/fre_information_panel/launch/web.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,33 @@
from launch.conditions import IfCondition
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch.substitutions import LaunchConfiguration
from launch.substitutions import EnvironmentVariable, LaunchConfiguration


def generate_launch_description():
package_share = Path(get_package_share_directory('fre_information_panel'))
idle_ms = LaunchConfiguration('idle_ms')
alert_persistence_ms = LaunchConfiguration('alert_persistence_ms')
alert_announcement_with_introduction = LaunchConfiguration(
'alert_announcement_with_introduction'
)
start_bridge = LaunchConfiguration('start_bridge')
start_ui = LaunchConfiguration('start_ui')

return LaunchDescription([
DeclareLaunchArgument(
'idle_ms',
default_value='5000',
description='Milliseconds to keep the detected bug text visible after the last received message.',
'alert_persistence_ms',
default_value=EnvironmentVariable(
'FRE_INFORMATION_PANEL_ALERT_PERSISTENCE_MS', default_value='5000'
),
description='Milliseconds to keep the detected alert visible after the last received message.',
),
DeclareLaunchArgument(
'alert_announcement_with_introduction',
default_value=EnvironmentVariable(
'FRE_INFORMATION_PANEL_ALERT_ANNOUNCEMENT_WITH_INTRODUCTION',
default_value='true'
),
description='Whether intro audio is enabled for alerts that opt into it.',
),
DeclareLaunchArgument(
'start_bridge',
Expand All @@ -42,7 +55,8 @@ def generate_launch_description():
output='screen',
name='fre_information_panel_ui',
additional_env={
'FRE_INFORMATION_PANEL_IDLE_MS': idle_ms,
'FRE_INFORMATION_PANEL_ALERT_PERSISTENCE_MS': alert_persistence_ms,
'FRE_INFORMATION_PANEL_ALERT_ANNOUNCEMENT_WITH_INTRODUCTION': alert_announcement_with_introduction,
},
condition=IfCondition(start_ui),
),
Expand Down
Loading
Loading