PathServiceInstaller.cs
1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Microsoft.Extensions.DependencyInjection;
using Rcs.Application.Services;
using Rcs.Application.Services.PathFind;
using Rcs.Application.Services.PathFind.Realtime;
using Rcs.Infrastructure.PathFinding;
using Rcs.Infrastructure.PathFinding.Realtime;
using Rcs.Infrastructure.PathFinding.Services;
namespace Rcs.Infrastructure.Installs;
/// <summary>
/// 路径相关服务注册
/// </summary>
public static class PathInstaller
{
/// <summary>
/// 安装HttpClient服务
/// </summary>
public static IServiceCollection InstallerPathService(
this IServiceCollection services)
{
// 地图映射服务(按MapCode合并多厂商地图)
services.AddSingleton<IMapMappingService, MapMappingService>();
// 统一交通管制服务(基于 MapCode:NodeCode/EdgeCode)
services.AddSingleton<IUnifiedTrafficControlService, UnifiedTrafficControlService>();
// 导航服务
services.AddSingleton<NavigationService>();
// 全局实时导航协调器(状态事件驱动)
services.AddSingleton<IAvoidanceStrategySelector, AvoidanceStrategySelector>();
services.AddSingleton<IGlobalNavigationCoordinator, GlobalNavigationCoordinator>();
services.AddHostedService<GlobalNavigationCoordinator>(sp => (GlobalNavigationCoordinator)sp.GetRequiredService<IGlobalNavigationCoordinator>());
services.AddSingleton<ITailPatchApplier, TailPatchApplier>();
services.AddSingleton<IGlobalNavigationResumeScheduler, GlobalNavigationResumeScheduler>();
services.AddHostedService<GlobalNavigationResumeScheduler>(sp => (GlobalNavigationResumeScheduler)sp.GetRequiredService<IGlobalNavigationResumeScheduler>());
// AGV寻路服务
services.AddSingleton<IAgvPathService, AgvPathService>();
// 启动时自动初始化合并映射和逆向边关系
services.AddHostedService<PathServiceInitializer>();
return services;
}
}