97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using RobotNet10.NavigationTune.Shared.Models;
|
|
|
|
namespace RobotNet10.NavigationTune.Shared.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Navigation wrapper for tuning system
|
|
/// </summary>
|
|
public interface ITuningNavigation
|
|
{
|
|
/// <summary>
|
|
/// Execute a test with given scenario and parameters.
|
|
/// When testRunId is provided, real-time telemetry is pushed to SignalR group test_{testRunId}.
|
|
/// When onComplete is provided, returns immediately with Status=Running and invokes onComplete when done.
|
|
/// </summary>
|
|
Task<TestExecutionResult> ExecuteTestAsync(
|
|
TestScenario scenario,
|
|
NavigationParameterSet parameters,
|
|
Guid? testRunId = null,
|
|
CancellationToken cancellationToken = default,
|
|
Action<TestExecutionResult>? onComplete = null
|
|
);
|
|
|
|
/// <summary>
|
|
/// Real-time telemetry updates
|
|
/// </summary>
|
|
event Action<TelemetryData>? OnTelemetryUpdate;
|
|
|
|
/// <summary>
|
|
/// Safety violation events
|
|
/// </summary>
|
|
event Action<SafetyViolation>? OnSafetyViolation;
|
|
|
|
/// <summary>
|
|
/// Test status updates
|
|
/// </summary>
|
|
event Action<TestStatus>? OnStatusChanged;
|
|
|
|
/// <summary>
|
|
/// Check if test is currently running
|
|
/// </summary>
|
|
bool IsTestRunning { get; }
|
|
|
|
/// <summary>
|
|
/// Get current test progress
|
|
/// </summary>
|
|
TestProgress GetProgress();
|
|
|
|
/// <summary>
|
|
/// Pause current test
|
|
/// </summary>
|
|
void Pause();
|
|
|
|
/// <summary>
|
|
/// Resume paused test
|
|
/// </summary>
|
|
void Resume();
|
|
|
|
/// <summary>
|
|
/// Stop current test
|
|
/// </summary>
|
|
void Stop();
|
|
|
|
/// <summary>
|
|
/// Emergency stop
|
|
/// </summary>
|
|
void EmergencyStop();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test execution result
|
|
/// </summary>
|
|
public class TestExecutionResult
|
|
{
|
|
public Guid TestRunId { get; set; }
|
|
public TestStatus Status { get; set; }
|
|
public List<TelemetryData> TelemetryData { get; set; } = new();
|
|
public TestMetrics? Metrics { get; set; }
|
|
public List<SafetyViolation> SafetyViolations { get; set; } = new();
|
|
public DateTime StartTime { get; set; }
|
|
public DateTime? EndTime { get; set; }
|
|
public double Duration { get; set; }
|
|
public string? ErrorMessage { get; set; }
|
|
public TuningReport? TuningReport { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Test progress information
|
|
/// </summary>
|
|
public class TestProgress
|
|
{
|
|
public double ProgressPercent { get; set; } // 0.0 - 1.0
|
|
public double DistanceTraveled { get; set; }
|
|
public double DistanceToGoal { get; set; }
|
|
public double ElapsedTime { get; set; }
|
|
public double EstimatedTimeRemaining { get; set; }
|
|
}
|