Initial commit

This commit is contained in:
2026-07-13 09:25:40 +07:00
parent c08ff54676
commit bccfb156d7
1938 changed files with 641646 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using RobotNet10.Shared.Enum;
using RobotNet10.Shared.Numbers;
namespace RobotNet10.RobotApp.Shared.DockStation;
public class DockStationConfigDto
{
public Guid Id { get; set; }
public string StationId { get; set; } = string.Empty;
public string? ConfigName { get; set; }
public string? Description { get; set; }
public double X { get; set; }
public double Y { get; set; }
public double Yaw { get; set; }
public double Width { get; set; }
public double Length { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public bool IsActive { get; set; }
public List<DockStationMarkerEntryDto> MarkerEntries { get; set; } = [];
}
public class DockStationMarkerEntryDto
{
public Guid Id { get; set; }
public string MarkerId { get; set; } = string.Empty;
public MarkerType Type { get; set; }
public int Priority { get; set; }
public string? DeviceId { get; set; }
public string? Code { get; set; }
public List<Vector2> ReferencePoints { get; set; } = [];
}
public class CreateDockStationConfigRequest
{
public string StationId { get; set; } = string.Empty;
public string? ConfigName { get; set; }
public string? Description { get; set; }
public double X { get; set; }
public double Y { get; set; }
public double Yaw { get; set; }
public double Width { get; set; }
public double Length { get; set; }
public bool IsActive { get; set; } = true;
public List<DockStationMarkerEntryDto> MarkerEntries { get; set; } = [];
}
public class UpdateDockStationConfigRequest
{
public string? StationId { get; set; }
public string? ConfigName { get; set; }
public string? Description { get; set; }
public double? X { get; set; }
public double? Y { get; set; }
public double? Yaw { get; set; }
public double? Width { get; set; }
public double? Length { get; set; }
public bool? IsActive { get; set; }
public List<DockStationMarkerEntryDto>? MarkerEntries { get; set; }
}
public class DockStationConfigSummaryDto
{
public Guid Id { get; set; }
public string StationId { get; set; } = string.Empty;
public string? ConfigName { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; }
public int MarkerEntryCount { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace RobotNet10.RobotApp.Shared.Enums;
public enum NavigationType
{
Differential,
Forklift,
}

View File

@@ -0,0 +1,7 @@
namespace RobotNet10.RobotApp.Shared.Enums;
public enum RobotDirection
{
FORWARD,
BACKWARD,
}

View File

@@ -0,0 +1,17 @@
namespace RobotNet10.RobotApp.Shared.Enums;
/// <summary>
/// States cho CartographerService state machine
/// </summary>
public enum SLAMState
{
Idle,
Initializing,
Ready,
/// <summary>MCL is computing initial pose; trajectory not added yet. Transitions to Localizing on MclConverged or MclSkipped.</summary>
Relocalizing,
Localizing,
ScanMapping,
SavingMap,
Error
}

View File

@@ -0,0 +1,8 @@
namespace RobotNet10.RobotApp.Shared.Enums;
public enum TrajectoryDegree
{
One,
Two,
Three,
}

View File

@@ -0,0 +1,66 @@
using RobotNet10.Shared.Geometry;
using RobotNet10.Shared.Localization;
namespace RobotNet10.RobotApp.Shared;
/// <summary>
/// Represents the size of a map in meters
/// </summary>
public record MapSize
{
public double Width { get; init; }
public double Height { get; init; }
public MapSize() { }
public MapSize(double width, double height)
{
Width = width;
Height = height;
}
}
/// <summary>
/// Information about a saved map
/// </summary>
public class MapInfo
{
/// <summary>
/// Tên map (tên folder)
/// </summary>
public string Name { get; init; } = string.Empty;
/// <summary>
/// Đường dẫn tuyệt đối đến map folder
/// </summary>
public string FolderPath { get; init; } = string.Empty;
/// <summary>
/// Ngày tạo map
/// </summary>
public DateTime CreatedDate { get; init; }
/// <summary>
/// Resolution của occupancy grid (meters/pixel)
/// </summary>
public double Resolution { get; init; }
/// <summary>
/// Kích thước map (pixels)
/// </summary>
public MapSize Size { get; init; } = new();
/// <summary>
/// Gốc tọa độ của map
/// </summary>
public Pose Origin { get; init; } = new();
/// <summary>
/// Bounds của map (meters)
/// </summary>
public BoundingBox Bounds { get; init; } = new();
/// <summary>
/// Số lượng trajectory nodes
/// </summary>
public int TrajectoryNodeCount { get; init; }
}

View File

@@ -0,0 +1,121 @@
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"
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\RobotNet10.Shared\RobotNet10.Shared.csproj" />
</ItemGroup>
</Project>