5.6 KiB
Tutorial: Observability and Debugging with the MARTe2 Debug Suite
This guide covers both transport options. Choose the one that fits your workflow:
WebDebugService |
DebugService |
|
|---|---|---|
| Client | Any web browser | Rust native GUI |
| Setup | Config only | Config + cargo run |
| Best for | Quick inspection, remote access | High-performance plots, scripted tooling |
Part A — Web UI (WebDebugService)
A.1 Environment Setup
cd /path/to/your/marte2/project
source /path/to/marte_debug/env.sh
A.2 Add WebDebugService to Your Config
Add the service as a sibling of the +App node (not inside it):
+WebDebugService = {
Class = WebDebugService
HttpPort = 8090
}
+App = {
Class = RealTimeApplication
...
}
Restart your application. You should see:
[WebDebugService] HTTP server listening on port 8090
A.3 Open the Web UI
Navigate to http://localhost:8090 in any browser. The UI connects automatically via SSE.
A.4 Exploring the Object Tree
The Application Tree panel on the left mirrors your live ORD hierarchy.
- Expand
Root → App → Datato find data sources. - Click Info next to any node to see its class, config, and signals in the details panel.
- Click List to expand just the immediate children without recursing.
A.5 Real-Time Signal Tracing
- Locate a signal in the tree, e.g.
Root.App.Data.Timer.Counter. - Click Trace next to the signal. The signal appears in the Traced Signals list with its live last value.
- Click Plot to open it in the real-time Chart.js graph. Use the Follow toggle to keep the time axis scrolling.
- To set the sampling decimation (e.g. every 10th sample), use the command box at the bottom
of the page:
TRACE App.Data.Timer.Counter 1 10 - Click Trace again (or send
TRACE … 0) to stop.
A.6 Signal Forcing
- Find a GAM output signal, e.g.
Root.App.Data.DDB.Counter. - Click Force. A modal dialog appears.
- Enter a value (e.g.
9999) and click Apply. - The signal is locked at that value every RT cycle.
- Click Unforce (or use the Active Controls panel) to release.
A.7 Breakpoints
- Click Break next to a signal.
- Select an operator (
>,<,==, etc.) and enter a threshold. - When the condition fires, the application pauses automatically. The status bar shows PAUSED and the GAM name where execution stopped.
- Use Step to advance one cycle at a time, or Resume to continue.
- Click Break OFF to clear the breakpoint.
A.8 Execution Stepping
While paused (after a breakpoint or manual Pause):
- Enter a step count in the Step box (e.g.
5) and click Step. - The RT loop runs exactly 5 output-broker cycles, then pauses again.
- The status SSE event (
{"type":"status","remaining":…}) keeps the UI updated.
A.9 Signal Monitoring
Monitoring polls a signal at a slow rate without using the RT trace path — useful for
DataSourceI signals not connected to any GAM.
- Click Monitor next to a signal.
- Enter a poll period in milliseconds (e.g.
500). - The signal's current value arrives via SSE every 500 ms as a
{"type":"monitor",…}event.
A.10 Log Viewer
The Logs panel at the bottom shows every REPORT_ERROR call forwarded as SSE events.
Use the level buttons (D / I / W / E) to filter by severity, or type a keyword to search.
Part B — Rust Native GUI (DebugService)
B.1 Environment Setup
source /path/to/marte_debug/env.sh
B.2 Add DebugService to Your Config
+DebugService = {
Class = DebugService
ControlPort = 8080
UdpPort = 8081
LogPort = 8082
}
+App = {
Class = RealTimeApplication
...
}
B.3 Start the GUI Client
cd Tools/gui_client
cargo run --release
The GUI connects to localhost:8080 automatically and requests the tree on startup.
B.4 Exploring the Object Tree
The Application Tree panel on the left shows the live ORD.
- Expand
Root → App → Data. - Click ℹ Info next to any node to see its JSON config in the bottom-left pane.
B.5 Real-Time Signal Tracing (Oscilloscope)
- Locate
Root.App.Data.Timer.Counter. - Click 📈 Trace. The Oscilloscope panel begins plotting.
- The UDP Packets counter in the top bar increments — confirming high-speed telemetry on port 8081.
- Drag additional signals from the Traced Signals list into the oscilloscope panel for multi-signal overlay.
B.6 Signal Forcing
- Find
Root.App.Data.DDB.Counter. - Click ⚡ Force.
- Enter a value (e.g.
9999) and click Apply Force. - The oscilloscope plot immediately jumps to and holds at
9999. - Click ❌ in the Active Controls panel to release the force.
B.7 Global Pause and Resume
- Click ⏸ Pause in the top bar to halt all RT threads.
- Click ▶ Resume to continue.
B.8 Log Terminal
The bottom panel shows all REPORT_ERROR events forwarded from TcpLogger (port 8082).
- Regex Filter: Type a keyword (e.g.
Timer) to isolate events. - ⏸ Pause Logs: Stop scrolling while continuing to capture.
Part C — Scripted / Programmatic Access
Both transports accept plain text commands. You can use nc or any TCP client:
# DebugService
echo -e "DISCOVER\nTRACE App.Data.DDB.Counter 1" | nc localhost 8080
# WebDebugService
curl -s -X POST http://localhost:8090/api/command \
-H "Content-Type: text/plain" \
-d "DISCOVER"
For the full command reference see API.md.