Axis-Config.md 9.3 KB

轴配置说明

1. 概述

本文档详细说明SISO系统中运动轴的配置方法,包括配置文件格式、参数说明以及配置示例。轴配置对于系统的运动控制精度和稳定性至关重要,用户应根据实际设备情况正确配置相关参数。

2. 配置文件格式

轴配置可以通过配置文件或系统界面进行设置。配置文件通常采用XML或JSON格式,存储在系统配置目录中。

2.1 基本配置结构

<?xml version="1.0" encoding="utf-8" ?>
<AxesConfig>
  <Axes>
    <Axis>
      <Id>1</Id>
      <Name>X-Axis</Name>
      <Type>Linear</Type>
      <MotorType>Servo</MotorType>
      <ControllerId>1</ControllerId>
      <AxisNumber>0</AxisNumber>
      <Enable>true</Enable>

      <!-- 机械参数 -->
      <Mechanical>
        <TravelRange>1000.0</TravelRange>
        <Unit>mm</Unit>
        <GearRatio>1.0</GearRatio>
        <LeadScrewPitch>5.0</LeadScrewPitch>
        <PulleyRatio>1.0</PulleyRatio>
      </Mechanical>

      <!-- 编码器参数 -->
      <Encoder>
        <CountsPerRevolution>131072</CountsPerRevolution>
        <CountsPerUnit>26214.4</CountsPerUnit>
        <Direction>Positive</Direction>
      </Encoder>

      <!-- 运动参数 -->
      <Motion>
        <MaxSpeed>500.0</MaxSpeed>
        <MaxAcceleration>1000.0</MaxAcceleration>
        <MaxDeceleration>1000.0</MaxDeceleration>
        <Jerk>10000.0</Jerk>
        <HomeSpeed>50.0</HomeSpeed>
        <JogSpeed>30.0</JogSpeed>
        <CreepSpeed>10.0</CreepSpeed>
      </Motion>

      <!-- 限位配置 -->
      <Limits>
        <PositiveLimit>1000.0</PositiveLimit>
        <NegativeLimit>0.0</NegativeLimit>
        <SoftLimitEnable>true</SoftLimitEnable>
        <HardLimitEnable>true</HardLimitEnable>
      </Limits>

      <!-- 回零配置 -->
      <Homing>
        <HomeMode>ActiveLimitHome</HomeMode>
        <HomeDirection>Negative</HomeDirection>
        <HomeOffset>10.0</HomeOffset>
        <HomeSensorId>101</HomeSensorId>
      </Homing>

      <!-- IO映射 -->
      <IOMapping>
        <PositiveLimitSensor>1</PositiveLimitSensor>
        <NegativeLimitSensor>2</NegativeLimitSensor>
        <HomeSensor>3</HomeSensor>
        <ServoEnable>11</ServoEnable>
        <ServoAlarm>12</ServoAlarm>
      </IOMapping>
    </Axis>

    <!-- 更多轴配置... -->
  </Axes>
</AxesConfig>

3. 配置参数说明

3.1 基本参数

参数 类型 说明 是否必需
Id Integer 轴的唯一标识ID
Name String 轴的名称(如X轴、Y轴等)
Type String 轴类型(Linear-直线轴、Rotary-旋转轴)
MotorType String 电机类型(Servo-伺服电机、Stepper-步进电机)
ControllerId Integer 控制器ID
AxisNumber Integer 在控制器中的轴号
Enable Boolean 是否启用该轴

3.2 机械参数

参数 类型 说明 是否必需
TravelRange Double 轴的行程范围
Unit String 单位(mm、deg等)
GearRatio Double 齿轮传动比
LeadScrewPitch Double 丝杠导程(对于直线轴)
PulleyRatio Double 皮带轮传动比

3.3 编码器参数

参数 类型 说明 是否必需
CountsPerRevolution Integer 编码器每转脉冲数
CountsPerUnit Double 每单位移动对应的脉冲数
Direction String 运动方向(Positive-正向、Negative-反向)

3.4 运动参数

参数 类型 说明 是否必需
MaxSpeed Double 最大运动速度
MaxAcceleration Double 最大加速度
MaxDeceleration Double 最大减速度
Jerk Double 加加速度
HomeSpeed Double 回零速度
JogSpeed Double 点动速度
CreepSpeed Double 爬行速度(用于精确定位)

3.5 限位配置

参数 类型 说明 是否必需
PositiveLimit Double 正向软限位值
NegativeLimit Double 负向软限位值
SoftLimitEnable Boolean 是否启用软限位
HardLimitEnable Boolean 是否启用硬限位

3.6 回零配置

参数 类型 说明 是否必需
HomeMode String 回零模式
HomeDirection String 回零方向
HomeOffset Double 回零偏移量
HomeSensorId Integer 回零传感器ID

3.7 IO映射

参数 类型 说明 是否必需
PositiveLimitSensor Integer 正向限位传感器IO点
NegativeLimitSensor Integer 负向限位传感器IO点
HomeSensor Integer 回零传感器IO点
ServoEnable Integer 伺服使能IO点
ServoAlarm Integer 伺服报警IO点

4. 回零模式说明

回零模式 描述
ActiveLimitHome 主动回零(碰到限位后返回)
PassiveHome 被动回零(等待外部信号触发)
SensorHome 传感器回零(找到原点传感器信号)
IndexHome 编码器索引回零
NoHome 无需回零

5. 配置示例

5.1 X轴配置示例

<Axis>
  <Id>1</Id>
  <Name>X-Axis</Name>
  <Type>Linear</Type>
  <MotorType>Servo</MotorType>
  <ControllerId>1</ControllerId>
  <AxisNumber>0</AxisNumber>
  <Enable>true</Enable>

  <!-- 机械参数 -->
  <Mechanical>
    <TravelRange>1000.0</TravelRange>
    <Unit>mm</Unit>
    <GearRatio>1.0</GearRatio>
    <LeadScrewPitch>5.0</LeadScrewPitch>
    <PulleyRatio>1.0</PulleyRatio>
  </Mechanical>

  <!-- 编码器参数 -->
  <Encoder>
    <CountsPerRevolution>131072</CountsPerRevolution>
    <CountsPerUnit>26214.4</CountsPerUnit>
    <Direction>Positive</Direction>
  </Encoder>

  <!-- 运动参数 -->
  <Motion>
    <MaxSpeed>500.0</MaxSpeed>
    <MaxAcceleration>1000.0</MaxAcceleration>
    <MaxDeceleration>1000.0</MaxDeceleration>
    <Jerk>10000.0</Jerk>
    <HomeSpeed>50.0</HomeSpeed>
    <JogSpeed>30.0</JogSpeed>
    <CreepSpeed>10.0</CreepSpeed>
  </Motion>

  <!-- 限位配置 -->
  <Limits>
    <PositiveLimit>1000.0</PositiveLimit>
    <NegativeLimit>0.0</NegativeLimit>
    <SoftLimitEnable>true</SoftLimitEnable>
    <HardLimitEnable>true</HardLimitEnable>
  </Limits>

  <!-- 回零配置 -->
  <Homing>
    <HomeMode>ActiveLimitHome</HomeMode>
    <HomeDirection>Negative</HomeDirection>
    <HomeOffset>10.0</HomeOffset>
    <HomeSensorId>101</HomeSensorId>
  </Homing>
</Axis>

5.2 旋转轴配置示例

<Axis>
  <Id>4</Id>
  <Name>Theta-Axis</Name>
  <Type>Rotary</Type>
  <MotorType>Servo</MotorType>
  <ControllerId>1</ControllerId>
  <AxisNumber>3</AxisNumber>
  <Enable>true</Enable>

  <!-- 机械参数 -->
  <Mechanical>
    <TravelRange>360.0</TravelRange>
    <Unit>deg</Unit>
    <GearRatio>10.0</GearRatio>
    <LeadScrewPitch>0.0</LeadScrewPitch>
    <PulleyRatio>1.0</PulleyRatio>
  </Mechanical>

  <!-- 编码器参数 -->
  <Encoder>
    <CountsPerRevolution>131072</CountsPerRevolution>
    <CountsPerUnit>364.09</CountsPerUnit>
    <Direction>Positive</Direction>
  </Encoder>

  <!-- 运动参数 -->
  <Motion>
    <MaxSpeed>180.0</MaxSpeed>
    <MaxAcceleration>360.0</MaxAcceleration>
    <MaxDeceleration>360.0</MaxDeceleration>
    <Jerk>3600.0</Jerk>
    <HomeSpeed>60.0</HomeSpeed>
    <JogSpeed>30.0</JogSpeed>
    <CreepSpeed>10.0</CreepSpeed>
  </Motion>

  <!-- 限位配置 -->
  <Limits>
    <PositiveLimit>360.0</PositiveLimit>
    <NegativeLimit>0.0</NegativeLimit>
    <SoftLimitEnable>false</SoftLimitEnable>
    <HardLimitEnable>false</HardLimitEnable>
  </Limits>

  <!-- 回零配置 -->
  <Homing>
    <HomeMode>SensorHome</HomeMode>
    <HomeDirection>Positive</HomeDirection>
    <HomeOffset>0.0</HomeOffset>
    <HomeSensorId>104</HomeSensorId>
  </Homing>
</Axis>

5. 参数调整建议

5.1 运动参数调整

  • 速度参数:根据负载情况和设备刚性调整,避免机械振动
  • 加速度/减速度:过大可能导致机械冲击,过小会影响效率
  • 加加速度(Jerk):平滑运动过渡,减少振动
  • 回零参数:回零速度不宜过快,确保定位准确性

5.2 安全参数

  • 限位配置:确保硬限位和软限位都正确设置,避免机械碰撞
  • 方向设置:确保运动方向正确,避免反方向运动造成危险
  • 使能控制:设置正确的伺服使能信号,确保安全运行

6. 常见问题与解决方案

6.1 运动精度问题

  • 检查编码器参数设置是否正确
  • 确认机械传动部分是否存在间隙或松动
  • 调整速度和加速度参数,减少振动

6.2 回零异常

  • 确认回零传感器安装位置和连接是否正确
  • 检查回零模式设置是否与实际硬件匹配
  • 调整回零速度和方向参数

6.3 运动不平滑

  • 增加Jerk参数值,使速度变化更加平滑
  • 检查机械系统是否有卡滞或摩擦过大的情况
  • 调整PID参数(如果控制器支持)

6.4 限位触发

  • 确认限位传感器连接和设置是否正确
  • 检查软限位参数是否设置合理
  • 确认轴的运动范围与实际机械结构匹配