Files
bj_power/bj_power_mes/internal/robot/machine.go
T

75 lines
2.4 KiB
Go

/*
* Copyright (c) 2025 Beijing Hardman Automation Equipment Co., LTD. All rights reserved.
*
* Project: adapter
* File: dock.go
* Last: 2025-01-13 20:04:51
* Author: wangcheng@bj-hardman.com
*/
package robot
import (
"context"
)
// PlaceWorkpieceToMachine 放料到设备
// @param ctx 上下文
// @param workpieceType 工件类型
// @param machineId 设备id (包括 CNC机床、高压清洗机、去毛刺机、除锈清洗线,其它设备使用专用放置接口)
// @param machineSlot 设备槽位
// @return error 错误
func (c *Controller) PlaceWorkpieceToMachine(ctx context.Context, workpieceType int, machineId int, machineSlot ...int) error {
slotNo := 0
if len(machineSlot) > 0 {
slotNo = machineSlot[0]
}
return c.executeAction(ctx, "PlaceWorkpieceToMachine",
newArg(int8(workpieceType), "workpieceType"), //工件类型
newArg(int8(machineId), "machineId"), //设备id
newArg(int8(slotNo), "slotNo"),
newArg(int8(0)),
newArg(int32(0)),
)
}
// FetchWorkpieceFromMachine 从设备取料
// @param ctx 上下文
// @param workpieceType 工件类型
// @param machineId 设备id (包括 CNC机床、高压清洗机、内窥镜滚筒线、去毛刺机、除锈清洗线,其它设备使用专用取走接口)
// @param slot 设备槽位
// @return error 错误
func (c *Controller) FetchWorkpieceFromMachine(ctx context.Context, workpieceType, machineId int, slot ...int) error {
slotNo := 0
if len(slot) > 0 {
slotNo = slot[0]
}
return c.executeAction(ctx, "FetchWorkpieceFromMachine",
newArg(int8(workpieceType), "workpieceType"), //工件类型
newArg(int8(machineId), "machineId"), //设备id
newArg(int8(slotNo), "slotNo"),
newArg(int8(0)),
newArg(int32(0)),
)
}
// ExchangeWorkpieceToMachine 换料到设备
// @param ctx 上下文
// @param workpieceType 工件类型
// @param machineId 设备id (包括 CNC机床、高压清洗机、除锈清洗线,其它设备不支持换料)
// @param slot 设备槽位
// @return error 错误
func (c *Controller) ExchangeWorkpieceToMachine(ctx context.Context, workpieceType, machineId int, slot ...int) error {
slotNo := 0
if len(slot) > 0 {
slotNo = slot[0]
}
return c.executeAction(ctx, "ExchangeWorkpieceToMachine",
newArg(int8(workpieceType), "workpieceType"), //工件类型
newArg(int8(machineId), "machineId"), //设备id
newArg(int8(slotNo), "slotNo"),
newArg(int8(0)),
newArg(int32(0)),
)
}