122 lines
4.0 KiB
C#
122 lines
4.0 KiB
C#
namespace RobotNet10.RobotApp.Shared.NavigationMonitor;
|
|
|
|
/// <summary>
|
|
/// Real-time telemetry snapshot from NavigationMonitorService
|
|
/// </summary>
|
|
public class NavigationTelemetryDto
|
|
{
|
|
public long TimestampMs { get; set; }
|
|
public double X { get; set; }
|
|
public double Y { get; set; }
|
|
public double Theta { get; set; } // radians
|
|
public double LinearVelocity { get; set; } // m/s
|
|
public double AngularVelocity { get; set; } // rad/s
|
|
public double LinearAcceleration { get; set; } // m/s²
|
|
public double AngularAcceleration { get; set; } // rad/s²
|
|
public string NavigationState { get; set; } = "Idle";
|
|
public bool Driving { get; set; }
|
|
public double CrossTrackError { get; set; } // meters (0 if no path)
|
|
public double HeadingError { get; set; } // radians (0 if no path)
|
|
public double DistanceToGoal { get; set; } // meters (0 if no path)
|
|
public double ModelConfidence { get; set; }
|
|
|
|
/// <summary>
|
|
/// DockTo-specific telemetry (null when not docking)
|
|
/// </summary>
|
|
public DockToTelemetryDto? DockTo { get; set; }
|
|
|
|
/// <summary>
|
|
/// Current navigation path waypoints (downsampled for visualization).
|
|
/// Empty when not navigating.
|
|
/// </summary>
|
|
public List<WaypointDto> Waypoints { get; set; } = [];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Safety violation detected by NavigationSafetyChecker
|
|
/// </summary>
|
|
public class NavigationSafetyViolationDto
|
|
{
|
|
public long TimestampMs { get; set; }
|
|
public SafetyViolationType Type { get; set; }
|
|
public SafetyViolationSeverity Severity { get; set; }
|
|
public double Value { get; set; }
|
|
public double Threshold { get; set; }
|
|
public string Message { get; set; } = string.Empty;
|
|
}
|
|
|
|
public enum SafetyViolationType
|
|
{
|
|
LinearVelocity = 1,
|
|
AngularVelocity = 2,
|
|
LinearAcceleration = 3,
|
|
CrossTrackError = 4,
|
|
HeadingError = 5
|
|
}
|
|
|
|
public enum SafetyViolationSeverity
|
|
{
|
|
Warning = 1,
|
|
Critical = 2
|
|
}
|
|
|
|
/// <summary>
|
|
/// Current state of NavigationMonitorService
|
|
/// </summary>
|
|
public class NavigationMonitorStateDto
|
|
{
|
|
public bool TelemetryEnabled { get; set; }
|
|
public bool SafetyStopEnabled { get; set; }
|
|
public bool SafetyStopLatched { get; set; }
|
|
public string SafetyStopReason { get; set; } = "";
|
|
public NavigationSafetyConfigDto SafetyConfig { get; set; } = new();
|
|
public double UpdateFrequencyHz { get; set; } = 10;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Configurable safety thresholds
|
|
/// </summary>
|
|
public class NavigationSafetyConfigDto
|
|
{
|
|
public double MaxLinearVelocity { get; set; } = 1.5; // m/s
|
|
public double MaxAngularVelocity { get; set; } = 6.0; // rad/s
|
|
public double MaxLinearAcceleration { get; set; } = 3.0; // m/s²
|
|
public double MaxCrossTrackError { get; set; } = 0.5; // meters
|
|
public double MaxHeadingError { get; set; } = 45.0; // degrees
|
|
}
|
|
|
|
/// <summary>
|
|
/// DockTo-specific telemetry data, included when robot is in Docking or FinePositioning state
|
|
/// </summary>
|
|
public class DockToTelemetryDto
|
|
{
|
|
public string Phase { get; set; } = ""; // "Approaching", "Aligning", "Advancing"
|
|
public string Direction { get; set; } = ""; // "FORWARD" or "BACKWARD"
|
|
public int RetryCount { get; set; }
|
|
public int MaxRetries { get; set; }
|
|
public double GoalX { get; set; }
|
|
public double GoalY { get; set; }
|
|
public double GoalTheta { get; set; } // radians
|
|
public int TotalWaypoints { get; set; }
|
|
public double StartX { get; set; }
|
|
public double StartY { get; set; }
|
|
public double StartTheta { get; set; } // radians
|
|
public List<DockWaypointDto> Waypoints { get; set; } = [];
|
|
}
|
|
|
|
public class DockWaypointDto
|
|
{
|
|
public double X { get; set; }
|
|
public double Y { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Navigation path waypoint for visualization
|
|
/// </summary>
|
|
public class WaypointDto
|
|
{
|
|
public double X { get; set; }
|
|
public double Y { get; set; }
|
|
public string Direction { get; set; } = "FORWARD"; // "FORWARD" or "BACKWARD"
|
|
}
|