55 lines
1.6 KiB
Go
55 lines
1.6 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"
|
|
|
|
"bj_power_mes/internal/preload"
|
|
)
|
|
|
|
func (c *Controller) FetchWorkpieceFromDock(ctx context.Context, workpieceType int, dockNo int, slotNo int) error {
|
|
err := c.executeAction(ctx, "FetchWorkpieceFromDock",
|
|
newArg(int8(workpieceType), "workpieceType"), //工件类型
|
|
newArg(int8(dockNo), "dockNo"), //接驳台位置号 1-10
|
|
newArg(int8(slotNo), "slotNo"), //工件位置号 1-9
|
|
newArg(int8(0)),
|
|
newArg(int32(0)),
|
|
)
|
|
return err
|
|
}
|
|
|
|
func (c *Controller) PlaceWorkpieceToDock(ctx context.Context, workpieceType int, dockNo int, slotNo int) error {
|
|
err := c.executeAction(ctx, "PlaceWorkpieceToDock",
|
|
newArg(int8(workpieceType), "workpieceType"), //工件类型
|
|
newArg(int8(dockNo), "dockNo"), //接驳台位置号 1-10
|
|
newArg(int8(slotNo), "slotNo"), //工件位置号 1-9
|
|
newArg(int8(0)),
|
|
newArg(int32(0)),
|
|
)
|
|
return err
|
|
}
|
|
|
|
func (c *Controller) PlaceWorkpieceToWasteStation(ctx context.Context, workpieceType int) error {
|
|
err := c.executeAction(ctx, "PlaceWorkpieceToWasteStation",
|
|
newArg(int8(workpieceType), "workpieceType"),
|
|
newArg(int8(0)),
|
|
newArg(int16(0)),
|
|
newArg(int32(0)),
|
|
)
|
|
return err
|
|
}
|
|
|
|
// DockStates 获取接驳台状态
|
|
func (c *Controller) DockStates() ([]bool, error) {
|
|
addr := preload.GetMAddress("DockStates")
|
|
return c.plcClient.ReadBools(addr.Addr.String(), 10)
|
|
}
|