feat(maintenance): add rotary angle and speed shortcut
This commit is contained in:
parent
09a273d539
commit
a9a1c0e74a
@ -53,6 +53,10 @@
|
||||
:roles="definition.roles"
|
||||
/>
|
||||
<h4>本次运行参数</h4>
|
||||
<p v-if="definition.rotaryRotation" class="maintenance-definition">
|
||||
目标角度为相对底座零位的绝对位置,0° 表示回到零位。角度范围为 -1800° 至 1800°,
|
||||
旋转速度须大于 0 且不超过 57.2957°/秒。
|
||||
</p>
|
||||
<el-form v-if="definition.fields.length" label-position="top">
|
||||
<ParameterFields v-model="runParams" :fields="definition.fields" />
|
||||
</el-form>
|
||||
|
||||
@ -11,6 +11,11 @@ export const maintenanceActions = [
|
||||
label: '旋转底座回零',
|
||||
caseId: 'ead3a87e968248718c2988bd23048d56'
|
||||
},
|
||||
{
|
||||
key: 'rotary-rotate',
|
||||
label: '旋转底座旋转',
|
||||
caseId: '9d5c6253a38f42a191b2a2c067c89bbb'
|
||||
},
|
||||
{
|
||||
key: 'scanner-calibration',
|
||||
label: '扫描仪标定',
|
||||
@ -28,6 +33,27 @@ export const maintenanceActions = [
|
||||
}
|
||||
]
|
||||
|
||||
const rotaryAngleField = 'rotaryTargetAngle'
|
||||
const rotarySpeedField = 'rotaryRotationSpeed'
|
||||
const maxRotarySpeed = 57.2957 // Rounded down to four decimals within the driver's 1 rad/s limit.
|
||||
|
||||
function rotaryMove(graph) {
|
||||
const moves = graph.nodes.filter((node) => node.properties?.action === 'MOTOR_MOVE')
|
||||
if (moves.length !== 1 || !moves[0].id)
|
||||
throw new Error('旋转快捷操作要求用例包含且仅包含一个轮廓位置控制节点')
|
||||
const node = moves[0]
|
||||
const params = {}
|
||||
for (const name of ['targetPosition', 'velocity', 'unit']) {
|
||||
const matches = (node.properties.nodeParams || []).filter((param) => param.name === name)
|
||||
if (matches.length !== 1 || matches[0].type !== 'input')
|
||||
throw new Error('旋转用例参数结构已变化,请检查轮廓位置控制节点')
|
||||
params[name] = matches[0]
|
||||
}
|
||||
if (params.unit.input !== 'DEGREE')
|
||||
throw new Error('旋转快捷操作要求轮廓位置控制节点使用度作为单位')
|
||||
return { node, params }
|
||||
}
|
||||
|
||||
export function formatScannerCalibrationDate(utc) {
|
||||
if (utc == null || (typeof utc === 'string' && !utc.trim())) return '暂无记录'
|
||||
if (typeof utc !== 'string') return '时间格式异常'
|
||||
@ -70,6 +96,39 @@ export async function loadMaintenanceDefinition(action, { readCase, readItem, re
|
||||
throw new Error('已发布的扫描方案流程缺少开始节点')
|
||||
const { graph, errors } = validateFlowResources(source)
|
||||
if (errors.length) throw new Error(errors[0].message)
|
||||
let fields = parameterFields(undefined, graph)
|
||||
let rotaryRotation = false
|
||||
if (action.key === 'rotary-rotate') {
|
||||
const { params } = rotaryMove(graph)
|
||||
if (fields.some((field) => [rotaryAngleField, rotarySpeedField].includes(field.name)))
|
||||
throw new Error('用例运行参数与旋转快捷参数重名,请检查开始节点')
|
||||
rotaryRotation = true
|
||||
fields = [
|
||||
{
|
||||
name: rotaryAngleField,
|
||||
type: 'number',
|
||||
desc: '目标角度(°,绝对位置)',
|
||||
required: true,
|
||||
defaultValue: params.targetPosition.input,
|
||||
min: -1800,
|
||||
max: 1800,
|
||||
step: 1,
|
||||
precision: 4
|
||||
},
|
||||
{
|
||||
name: rotarySpeedField,
|
||||
type: 'number',
|
||||
desc: '旋转速度(°/秒)',
|
||||
required: true,
|
||||
defaultValue: params.velocity.input,
|
||||
min: 0.0001,
|
||||
max: maxRotarySpeed,
|
||||
step: 1,
|
||||
precision: 4
|
||||
},
|
||||
...fields
|
||||
]
|
||||
}
|
||||
return {
|
||||
caseId: action.caseId,
|
||||
caseName: testCase.caseName || testCase.name || action.label,
|
||||
@ -78,7 +137,8 @@ export async function loadMaintenanceDefinition(action, { readCase, readItem, re
|
||||
versionNo: version.versionNo,
|
||||
graph,
|
||||
roles: getResourceRoles(graph),
|
||||
fields: parameterFields(undefined, graph)
|
||||
fields,
|
||||
rotaryRotation
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,12 +229,28 @@ export function prepareMaintenanceRequest(definition, { runtimeAssignments = [],
|
||||
}
|
||||
]
|
||||
})
|
||||
const params = materializeParams(definition.fields, runParams)
|
||||
const graph = sanitizeFlowResourceDefinition(clone(definition.graph))
|
||||
if (definition.rotaryRotation) {
|
||||
const angle = params[rotaryAngleField]
|
||||
const speed = params[rotarySpeedField]
|
||||
if (!Number.isFinite(angle) || angle < -1800 || angle > 1800)
|
||||
throw new Error('目标角度必须在 -1800° 至 1800° 之间')
|
||||
if (!Number.isFinite(speed) || speed <= 0 || speed > maxRotarySpeed)
|
||||
throw new Error('旋转速度必须大于 0 且不超过 57.2957°/秒')
|
||||
const { params: motorParams } = rotaryMove(graph)
|
||||
// Execute a per-run copy through the existing trial workflow; never rewrite the published case.
|
||||
motorParams.targetPosition.input = angle
|
||||
motorParams.velocity.input = speed
|
||||
delete params[rotaryAngleField]
|
||||
delete params[rotarySpeedField]
|
||||
}
|
||||
return {
|
||||
itemId: definition.itemId,
|
||||
flowData: JSON.stringify(sanitizeFlowResourceDefinition(definition.graph)),
|
||||
flowData: JSON.stringify(graph),
|
||||
robotId: assignments[0]?.members[0]?.robotId || '',
|
||||
runtimeAssignments: assignments,
|
||||
runParams: materializeParams(definition.fields, runParams)
|
||||
runParams: params
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,10 @@
|
||||
:model-value="valueOf(field.name)"
|
||||
:disabled="disabled"
|
||||
:controls="false"
|
||||
:min="field.min"
|
||||
:max="field.max"
|
||||
:step="field.step"
|
||||
:precision="field.precision"
|
||||
@update:model-value="setValue(field.name, $event)"
|
||||
/>
|
||||
<el-select
|
||||
|
||||
@ -275,6 +275,14 @@ STL 导出可能包含退化三角面的非有限法向量;在线查看从原
|
||||
|
||||
已运行任务保持冻结版本及失败日志。显式运行 `python scripts/prepare_real_scan_task.py --replace-failed` 可为已停止且全部单件失败的任务准备修正版;准备成功且确认设备空闲后,再取消旧任务并确认资源释放。替代任务重新要求操作人确认收样、装夹及开始动作。不得改写历史执行版本、静默重试采集,或跳过 SDK 快照失败。
|
||||
|
||||
### 旋转底座旋转快捷操作(2026-11-26)
|
||||
|
||||
“我的任务”在“旋转底座回零”旁增加“旋转底座旋转”,关联用例 `9d5c6253a38f42a191b2a2c067c89bbb`。打开时读取该用例当前发布版本及资源角色,可选择本次设备,并输入目标角度(相对底座零位的绝对位置,单位°)和旋转速度(°/秒)。初始值取自已发布轮廓位置控制节点。角度范围为±1800°,速度大于0且不超过57.2957°/秒(保守保留四位小数,不超过驱动1 rad/s上限)。
|
||||
|
||||
确认执行时,将两个输入写入本次执行流程副本的 `MOTOR_MOVE.targetPosition`、`velocity`,沿用原单位DEGREE、加速度、超时、使能步骤和设备分配,通过既有执行接口启动并跟踪实例真实终态。不会保存或改写用例草稿、发布版本及历史记录;开始前复核当前发布版本,变更后要求重新核对。若用例不再只有一个位置控制节点、字段结构或单位变化,则明确报错,避免覆盖错误节点。打开、取消及验证均不下发设备动作。
|
||||
|
||||
本次无新依赖、数据库结构或私有配置变更,沿用本机正式 `platform.ps1 -Action Update` 更新入口。验证包含指定已发布用例的离线参数映射、边界和错误输入、资源必填、流程副本不变性,以及standalone构建;未执行真实使能或运动。
|
||||
|
||||
### 扫描仪标定画面与执行进度(2026-11-21)
|
||||
|
||||
“我的任务”启动扫描仪标定并取得执行实例后,自动打开监视窗口,展示本次冻结流程的步骤、当前节点、耗时和执行结果。进度按实际节点记录计算,只有实例成功终态才能完成;不是扫描仪姿态覆盖率或标定质量百分比。窗口可关闭并通过“查看标定过程”重开,关闭、切页或刷新不会向设备下发停止或重复标定。未结束实例从浏览器会话恢复后,按原实例重新读取冻结流程和日志。
|
||||
|
||||
Loading…
Reference in New Issue
Block a user