feat: Enhance PlotJuggler integration by launching with multiple files in a single instance, improve logging for application events, and update system state for active datasets
This commit is contained in:
parent
02b622cb20
commit
e7cee49b1e
|
@ -7712,8 +7712,180 @@
|
|||
"udp_port": 9870,
|
||||
"datasets_available": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:30:27.188174",
|
||||
"level": "info",
|
||||
"event_type": "application_started",
|
||||
"message": "Application initialization completed successfully",
|
||||
"details": {}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:30:27.238886",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: DAR",
|
||||
"details": {
|
||||
"dataset_id": "DAR",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 2,
|
||||
"prefix": "gateway_phoenix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:30:27.254435",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: Fast",
|
||||
"details": {
|
||||
"dataset_id": "Fast",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 2,
|
||||
"prefix": "fast"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:30:27.266768",
|
||||
"level": "info",
|
||||
"event_type": "csv_recording_started",
|
||||
"message": "CSV recording started: 2 datasets activated",
|
||||
"details": {
|
||||
"activated_datasets": 2,
|
||||
"total_datasets": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:30:27.278705",
|
||||
"level": "info",
|
||||
"event_type": "udp_streaming_started",
|
||||
"message": "UDP streaming to PlotJuggler started",
|
||||
"details": {
|
||||
"udp_host": "127.0.0.1",
|
||||
"udp_port": 9870,
|
||||
"datasets_available": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:34:11.199188",
|
||||
"level": "info",
|
||||
"event_type": "application_started",
|
||||
"message": "Application initialization completed successfully",
|
||||
"details": {}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:34:11.250310",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: DAR",
|
||||
"details": {
|
||||
"dataset_id": "DAR",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 2,
|
||||
"prefix": "gateway_phoenix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:34:11.258310",
|
||||
"level": "info",
|
||||
"event_type": "dataset_activated",
|
||||
"message": "Dataset activated: Fast",
|
||||
"details": {
|
||||
"dataset_id": "Fast",
|
||||
"variables_count": 2,
|
||||
"streaming_count": 2,
|
||||
"prefix": "fast"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:34:11.267317",
|
||||
"level": "info",
|
||||
"event_type": "csv_recording_started",
|
||||
"message": "CSV recording started: 2 datasets activated",
|
||||
"details": {
|
||||
"activated_datasets": 2,
|
||||
"total_datasets": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:34:11.276310",
|
||||
"level": "info",
|
||||
"event_type": "udp_streaming_started",
|
||||
"message": "UDP streaming to PlotJuggler started",
|
||||
"details": {
|
||||
"udp_host": "127.0.0.1",
|
||||
"udp_port": 9870,
|
||||
"datasets_available": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:35:22.096075",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'Clock' created and started",
|
||||
"details": {
|
||||
"session_id": "Clock_1755282922096_2",
|
||||
"variables": [
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:35:27.194980",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1_1755282927194_3",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 36,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:37:39.679531",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'UR29' created and started",
|
||||
"details": {
|
||||
"session_id": "plot_1_1755283059679_4",
|
||||
"variables": [
|
||||
"UR29_Brix",
|
||||
"UR29_ma",
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 36,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-08-15T20:37:44.200561",
|
||||
"level": "info",
|
||||
"event_type": "plot_session_created",
|
||||
"message": "Plot session 'Clock' created and started",
|
||||
"details": {
|
||||
"session_id": "Clock_1755283064200_5",
|
||||
"variables": [
|
||||
"AUX Blink_1.0S",
|
||||
"AUX Blink_1.6S"
|
||||
],
|
||||
"time_window": 10,
|
||||
"trigger_variable": null,
|
||||
"auto_started": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"last_updated": "2025-08-15T20:22:39.890817",
|
||||
"total_entries": 631
|
||||
"last_updated": "2025-08-15T20:37:44.200561",
|
||||
"total_entries": 645
|
||||
}
|
|
@ -342,7 +342,11 @@ class DataStreamer:
|
|||
)
|
||||
row = [timestamp]
|
||||
for var_name in dataset_variables.keys():
|
||||
row.append(data.get(var_name, None))
|
||||
value = data.get(var_name, None)
|
||||
# Convert boolean values to 0 or 1 for CSV consistency
|
||||
if isinstance(value, bool):
|
||||
value = 1 if value else 0
|
||||
row.append(value)
|
||||
|
||||
self.dataset_csv_writers[dataset_id].writerow(row)
|
||||
self.dataset_csv_files[dataset_id].flush()
|
||||
|
|
|
@ -434,13 +434,18 @@ export default function CsvFileBrowser() {
|
|||
if (action === 'plotjuggler') {
|
||||
// Open single file in PlotJuggler
|
||||
try {
|
||||
await api.launchPlotJuggler([fileNode.path])
|
||||
const response = await api.launchPlotJuggler([fileNode.path])
|
||||
toast({
|
||||
title: '🚀 PlotJuggler launched',
|
||||
description: `Opened ${fileNode.value}`,
|
||||
status: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
|
||||
// Show command in console for debugging
|
||||
if (response.command) {
|
||||
console.log('PlotJuggler command:', response.command)
|
||||
}
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: '❌ Failed to launch PlotJuggler',
|
||||
|
@ -577,13 +582,21 @@ export default function CsvFileBrowser() {
|
|||
|
||||
try {
|
||||
const filePaths = Array.from(selectedFiles)
|
||||
await api.launchPlotJuggler(filePaths)
|
||||
const response = await api.launchPlotJuggler(filePaths)
|
||||
|
||||
toast({
|
||||
title: '🚀 PlotJuggler launched',
|
||||
description: `Opened ${filePaths.length} file(s)`,
|
||||
description: filePaths.length === 1
|
||||
? `Opened ${filePaths.length} file`
|
||||
: `Opened ${filePaths.length} files in single instance`,
|
||||
status: 'success',
|
||||
duration: 2000
|
||||
duration: 3000
|
||||
})
|
||||
|
||||
// Show command in console for debugging
|
||||
if (response.command) {
|
||||
console.log('PlotJuggler command:', response.command)
|
||||
}
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: '❌ Failed to launch PlotJuggler',
|
||||
|
|
29
main.py
29
main.py
|
@ -2978,36 +2978,23 @@ def launch_plotjuggler():
|
|||
import subprocess
|
||||
|
||||
if len(file_paths) == 1:
|
||||
# Single file
|
||||
# Single file - use --datafile for compatibility
|
||||
cmd = [plotjuggler_path, "--nosplash", "--datafile", file_paths[0]]
|
||||
else:
|
||||
# Multiple files - launch separate instances
|
||||
commands = []
|
||||
# Multiple files - use single instance with multiple -d flags
|
||||
cmd = [plotjuggler_path, "-n"] # -n for no splash
|
||||
for file_path in file_paths:
|
||||
commands.append(
|
||||
[plotjuggler_path, "--nosplash", "--datafile", file_path]
|
||||
)
|
||||
cmd.extend(["-d", file_path])
|
||||
|
||||
# Execute all commands
|
||||
for cmd in commands:
|
||||
subprocess.Popen(cmd, shell=True)
|
||||
|
||||
return jsonify(
|
||||
{
|
||||
"success": True,
|
||||
"message": f"Launched {len(file_paths)} PlotJuggler instances",
|
||||
"commands": [" ".join(cmd) for cmd in commands],
|
||||
}
|
||||
)
|
||||
|
||||
# Execute single command
|
||||
# Execute command
|
||||
subprocess.Popen(cmd, shell=True)
|
||||
|
||||
return jsonify(
|
||||
{
|
||||
"success": True,
|
||||
"message": "PlotJuggler launched successfully",
|
||||
"command": " ".join(cmd),
|
||||
"message": f"PlotJuggler launched with {len(file_paths)} file(s)",
|
||||
"command": " ".join([f'"{arg}"' if " " in arg else arg for arg in cmd]),
|
||||
"files_count": len(file_paths),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
"should_connect": true,
|
||||
"should_stream": true,
|
||||
"active_datasets": [
|
||||
"Fast",
|
||||
"DAR",
|
||||
"Test",
|
||||
"DAR"
|
||||
"Fast"
|
||||
]
|
||||
},
|
||||
"auto_recovery_enabled": true,
|
||||
"last_update": "2025-08-15T20:23:13.340246",
|
||||
"last_update": "2025-08-15T20:37:12.670764",
|
||||
"plotjuggler_path": "C:\\Program Files\\PlotJuggler\\plotjuggler.exe"
|
||||
}
|
Loading…
Reference in New Issue