Files
bj_power/bj_power_mes/internal/action/action.go
T

36 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package action 定义硬件动作请求和执行器接口。
// 独立于 eventloop 和 processor 包,避免循环依赖。
package action
import "context"
// RobotAction 机器人动作请求。
// 取料 → 操作 → 放料 三段式结构:
// Src* 字段描述从哪里取工件,Dst* 字段描述放到哪里。
// SrcMachine/DstMachine 为 0 表示暂存台(此时 SrcSlot/DstSlot 为暂存台槽位号)。
type RobotAction struct {
Kind string // 八个新版 kind
JobID int
// 取料位置
SrcSlot int // 暂存台槽位 / 设备槽位
SrcMachine int // 设备 ID0 表示暂存台
SrcDock int // 接驳台号(补料从接驳台)
// 放料位置
DstSlot int // 暂存台槽位 / 设备槽位 / 接驳台槽位
DstMachine int // 设备 ID0 表示暂存台
DstDock int // 接驳台号(下料到接驳台)
// 工件属性
WorkpieceType int
// 额外参数(loadJobID、doneJobID、doneSlots、text、round 等)
Extra map[string]any
}
// HardwareWorker 硬件执行器接口
type HardwareWorker interface {
Execute(ctx context.Context, actions []RobotAction) error
}