Files
FlyShotHost/src/Flyshot.ControllerClientCompat/ControllerClientCompatServiceCollectionExtensions.cs
yunxiao.zhu 91c1494cde feat(*): 添加轨迹产物导出与规划速度倍率隔离
* 新增 FlyshotTrajectoryArtifactWriter,支持 saveTrajectory
  将规划结果导出到 Config/Data/name(JointTraj、CartTraj、
  ShotEvents 等)
* RobotConfig 新增 PlanningSpeedScale,区分规划阶段限速倍率
  与运行时 J519 下发倍率
* 轨迹缓存键纳入 planningSpeedScale,避免降速规划误用缓存
* 完善 FanucCommandClient 命令参数日志与状态通道重连
* 补充 RuntimeOrchestrationTests 覆盖产物导出与倍率隔离
* 更新 README 进度文档
2026-04-30 13:52:09 +08:00

43 lines
1.8 KiB
C#

using Flyshot.Core.Config;
using Flyshot.Runtime.Common;
using Flyshot.Runtime.Fanuc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace Flyshot.ControllerClientCompat;
/// <summary>
/// 提供 ControllerClient HTTP 兼容层的依赖注入注册入口。
/// </summary>
public static class ControllerClientCompatServiceCollectionExtensions
{
/// <summary>
/// 将 HTTP-only 的 ControllerClient 兼容服务注册到当前宿主。
/// </summary>
/// <param name="services">当前宿主服务集合。</param>
/// <param name="configuration">宿主配置根。</param>
/// <returns>同一服务集合,便于链式调用。</returns>
public static IServiceCollection AddControllerClientCompat(this IServiceCollection services, IConfiguration configuration)
{
ArgumentNullException.ThrowIfNull(services);
ArgumentNullException.ThrowIfNull(configuration);
services
.AddOptions<ControllerClientCompatOptions>()
.Bind(configuration.GetSection("ControllerClientCompat"));
services.AddSingleton(static serviceProvider => serviceProvider.GetRequiredService<IOptions<ControllerClientCompatOptions>>().Value);
services.AddSingleton<RobotModelLoader>();
services.AddSingleton<RobotConfigLoader>();
services.AddSingleton<ControllerClientCompatRobotCatalog>();
services.AddSingleton<ControllerClientTrajectoryOrchestrator>();
services.AddSingleton<FlyshotTrajectoryArtifactWriter>();
services.AddSingleton<JsonFlyshotTrajectoryStore>();
services.AddSingleton<IControllerRuntime, FanucControllerRuntime>();
services.AddSingleton<IControllerClientCompatService, ControllerClientCompatService>();
return services;
}
}