🐛 fix(flyshot): 修复输出选择并同步现场配置与文档
- 恢复 use_do 对 DO/RO 的选择,保留拍照脉冲与清零 - 统一直接关节移动与飞拍预移动的规划和运行倍率 - 补充输出选择、预生成队列和点对点倍率回归测试 - 更新 WhP_test 轨迹配置、系统说明和 README - 删除本地 Claude 配置文件 验证:构建零警告零错误,定向测试 6 项与集成测试 38 项通过。 核心全量 175 项通过、14 项失败,失败项与修改前基线一致。
This commit is contained in:
@@ -16,6 +16,70 @@ namespace Flyshot.Core.Tests;
|
||||
/// </summary>
|
||||
public sealed class FanucControllerRuntimeDenseTests
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证飞拍输出选择贯通到 J519 命令,DO/RO 模式都输出两周期脉冲并在同一路清零。
|
||||
/// </summary>
|
||||
/// <param name="useDo">true 选择 DO,false 选择 RO。</param>
|
||||
/// <param name="expectedIoType">预期 J519 写入类型,DO 为 2,RO 为 9。</param>
|
||||
/// <param name="usePreparedExecution">是否使用上游已完成触发绑定的最终发送队列。</param>
|
||||
[Theory]
|
||||
[InlineData(true, 2, false)]
|
||||
[InlineData(false, 9, false)]
|
||||
[InlineData(true, 2, true)]
|
||||
[InlineData(false, 9, true)]
|
||||
public void ExecuteTrajectory_FlyshotOutputSelection_PreservesPulseAndClear(bool useDo, int expectedIoType, bool usePreparedExecution)
|
||||
{
|
||||
using var commandClient = new FanucCommandClient();
|
||||
using var stateClient = new FanucStateClient();
|
||||
using var j519Client = new FanucJ519Client();
|
||||
using var runtime = new FanucControllerRuntime(commandClient, stateClient, j519Client);
|
||||
runtime.ResetRobot(TestRobotFactory.CreateRobotProfile(), "FANUC_LR_Mate_200iD");
|
||||
j519Client.EnableCommandHistoryForTests();
|
||||
ForceRealModeEnabled(runtime, speedRatio: 1.0);
|
||||
|
||||
var trigger = new TrajectoryDoEvent(waypointIndex: 1, triggerTime: 0.008,
|
||||
offsetCycles: 0, holdCycles: 2, addressGroup: new IoAddressGroup([1]), useDo: useDo);
|
||||
var samples = Enumerable.Range(0, 4)
|
||||
.Select(index => new FlyshotPreparedSample(index, index * 0.008, index * 0.008,
|
||||
1.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0])).ToArray();
|
||||
var preparedExecution = usePreparedExecution
|
||||
? new FlyshotPreparedExecution(samples,
|
||||
[new FlyshotPreparedTriggerBinding(trigger, samples[1], 1, true)],
|
||||
Array.Empty<IReadOnlyList<double>>(), Array.Empty<IReadOnlyList<double>>(),
|
||||
requestSpeedRatio: 1.0, finalSpeedRatio: 1.0, finalDurationSeconds: 0.024, stretchIterationCount: 0)
|
||||
: null;
|
||||
|
||||
// 静止轨迹隔离运动算法影响,仅验证触发、保持和清零对应的协议字段。
|
||||
var result = new TrajectoryResult(
|
||||
programName: "output-selection",
|
||||
method: PlanningMethod.Icsp,
|
||||
isValid: true,
|
||||
duration: TimeSpan.FromSeconds(0.024),
|
||||
shotEvents: Array.Empty<ShotEvent>(),
|
||||
triggerTimeline: [trigger],
|
||||
artifacts: Array.Empty<TrajectoryArtifact>(),
|
||||
failureReason: null,
|
||||
usedCache: false,
|
||||
originalWaypointCount: 2,
|
||||
plannedWaypointCount: 2,
|
||||
denseJointTrajectory:
|
||||
[
|
||||
new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
|
||||
new double[] { 0.024, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }
|
||||
],
|
||||
preparedFlyshotExecution: preparedExecution);
|
||||
|
||||
runtime.ExecuteTrajectory(result, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]);
|
||||
WaitUntilIdle(runtime);
|
||||
|
||||
var commands = j519Client.GetCommandHistoryForTests();
|
||||
Assert.True(commands.Count >= 4);
|
||||
Assert.All(commands, command => Assert.Equal((byte)expectedIoType, command.WriteIoType));
|
||||
Assert.All(commands, command => Assert.Equal((ushort)1, command.WriteIoIndex));
|
||||
Assert.Equal(new ushort[] { 0, 1, 1, 1 }, commands.Take(4).Select(command => command.WriteIoMask));
|
||||
Assert.Equal(new ushort[] { 0, 1, 1, 0 }, commands.Take(4).Select(command => command.WriteIoValue));
|
||||
}
|
||||
|
||||
private const double SmoothPtpVelocityShapeCoefficient = 2.1875;
|
||||
private const double SmoothPtpAccelerationShapeCoefficient = 7.513188404399293;
|
||||
private const double SmoothPtpJerkShapeCoefficient = 52.5;
|
||||
|
||||
Reference in New Issue
Block a user