西安泽景光学自动化测试台架项目
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-10-19 12:02:54 +08:00
lib 添加项目文件。 2025-10-19 12:02:49 +08:00
packages 添加项目文件。 2025-10-19 12:02:49 +08:00
SrsPlc 添加项目文件。 2025-10-19 12:02:49 +08:00
XIANRobotTest 添加项目文件。 2025-10-19 12:02:49 +08:00
.gitattributes 添加 .gitattributes、.gitignore、README.md 和 LICENSE.txt 2025-10-19 11:59:52 +08:00
.gitignore 添加项目文件。 2025-10-19 12:02:49 +08:00
LICENSE Initial commit 2025-10-19 03:48:05 +00:00
LICENSE.txt 添加 .gitattributes、.gitignore、README.md 和 LICENSE.txt 2025-10-19 11:59:52 +08:00
README.md 更新 'README.md' 2025-10-19 04:01:53 +00:00
XIANRobotTest.sln 添加项目文件。 2025-10-19 12:02:49 +08:00

西安泽景光学自动化测试台架项目

项目描述

主要用于实现西门子PLC对机械臂和伺服控制轴的数据基本读写操作

更新记录

日期 说明
25.6.20 初版提交
25.6.23 优化代码结构及可读性
25.7.28 前往海壁自动化测试伺服部分控制逻辑,机械臂未测试
25.10.11 前往西安泽景实验室测试伺服和机械臂点位

接口列表

PLC连接

功能 方法签名 参数说明 返回值
与PLC建立连接 public bool Connect(string ip, string plcTypeString = "S1200")
  • ip:PLC设备IPv4地址
  • plcTypeString:PLC型号(默认S1200,支持S1500/S7-200)
    • true:连接成功
    • false:连接失败
    与PLC断开连接 public void Disconnect() ---- ----
    轮询PLC点位数据 public (RobotModel,ServoModel) PollingPlcData(EServoIndex index)
  • index:伺服控制轴索引
  • RobotModel:机械臂模型
  • ServoModel:伺服模型
  • 机械臂操作

    功能 方法签名 参数说明 返回值
    机械臂移动至指定位置 public bool RobotGoPosition(PositionModel position)
  • position:伺服控制轴位置
  • position:伺服控制轴位置
  • true:执行成功
  • false:执行失败
  • 机械臂数据写入(DB202)

    功能 方法签名 参数说明 返回值
    设置机械臂位置 public bool SetRobotPos(PositionModel position)
  • position:机械臂位置
  • true:执行成功
  • false:执行失败
  • 设置机械臂启动 public bool SetRobotOn(bool isOn)
  • isOn:是否启动
  • true:执行成功
  • false:执行失败
  • 机械臂数据读取(DB203)

    功能 方法签名 参数说明 返回值
    获取机械臂位置 public PositionModel GetRobotPos() ----
  • position:机械臂位置
  • 获取机械臂状态 public RobotStateType GetRobotState() ----
  • stateType:机械臂状态
  • 获取机械臂模式 public RobotModeType GetRobotMode() ----
  • modeType:机械臂模式
  • 获取机械臂是否在移动 public bool GetRobotIsMoving() ----
  • isMoving:机械臂是否启动
  • 伺服操作

    功能 方法签名 参数说明 返回值
    伺服移动至指定位置 public bool ServoGoPosition(EServoIndex eServoIndex, EServoPosition eServoPosition, float position, float speed)
  • position:伺服控制轴位置
  • position:伺服控制轴位置
  • true:执行成功
  • false:执行失败
  • 设置JOG点动 public bool JOGMove(EServoIndex index, bool dir, bool flag)
  • index:伺服轴索引
  • dir:移动方向
  • flag:启动标志
  • true:执行成功
  • false:执行失败
  • 伺服数据写入(DB200)

    功能 方法签名 参数说明 返回值
    设置伺服位置 public bool SetServoPosition(EServoIndex eServoIndex, EServoPosition eServoPosition, float position)
  • eServoIndex:伺服控制轴索引
  • eServoPosition:伺服控制轴位置
  • position:位置大小
  • true:执行成功
  • false:执行失败
  • 设置伺服速度 public bool SetServoSpeed(EServoIndex eServoIndex, EServoPosition eServoPosition, float speed)
  • eServoIndex:伺服控制轴索引
  • eServoPosition:伺服控制轴位置
  • speed:速度大小
  • true:执行成功
  • false:执行失败
  • 设置伺服启动 public bool SetServoOn(EServoIndex eServoIndex, EServoPosition eServoPosition, bool isOn)
  • eServoIndex:伺服控制轴索引
  • eServoPosition:伺服控制轴位置
  • isOn:是否启动
  • true:执行成功
  • false:执行失败
  • 设置JOG点动 public bool SetJOGMove(EServoIndex index, bool dir, bool flag)
  • index:伺服控制轴索引
  • dir:JOG点动方向
  • flag:启动标志
  • true:执行成功
  • false:执行失败
  • 伺服数据读取(DB201)

    功能 方法签名 参数说明 返回值
    获取伺服实际位置 public float GetServoActPos(EServoIndex eServoIndex)
  • eServoIndex:伺服控制轴索引
  • true:执行成功
  • actPos:伺服轴实际位置
  • 获取伺服到达状态 public bool[] GetServoState(EServoIndex eServoIndex,int num)
  • eServoIndex:伺服控制轴索引
  • num:伺服位置数量
  • true:伺服轴位置到达状态
  • 获取JOG互锁状态 public bool GetJOGInlock(EServoIndex index, bool dir)
  • index:伺服控制轴索引
  • dir:JOG点动方向
  • true:执行成功
  • false:执行失败
  • 获取伺服定位互锁 public bool GetAutoInlock(EServoIndex index)
  • index:伺服控制轴索引
  • true:执行成功
  • false:执行失败