RetCode result;
int exit_cmd = 0;
UINT32 axisIndex = 0;
UINT32 axisIndex = 0;
//库加载
result = YKM_LoadLib();
YKM_BusInfo busInfo;
//等待系统初始化完成
while (!exit_cmd)
{
result = YKM_GetBusInfo(&busInfo);
if (busInfo.running)
break;
Sleep(100);
}
//设置第一段速度运动参数
YKM_MoveVelocityConfig moveVelocityConfig1;
memset(&moveVelocityConfig1, 0, sizeof(YKM_MoveRelativeConfig));
moveVelocityConfig1.direction = YKM_DIRECTION::YKM_DIRECTION_POSITIVE;
moveVelocityConfig1.acceleration = 1000;
moveVelocityConfig1.deceleration = 1000;
moveVelocityConfig1.jerk = 10000;
moveVelocityConfig1.velocity = 100;
//设置第二段速度运动参数
YKM_MoveVelocityConfig moveVelocityConfig2;
moveVelocityConfig2.direction = YKM_DIRECTION::YKM_DIRECTION_POSITIVE;
moveVelocityConfig2.acceleration = 1000;
moveVelocityConfig2.deceleration = 1000;
moveVelocityConfig2.jerk = 10000;
moveVelocityConfig2.velocity = 50;
//设置输入信号参数
UINT32 byteIndex = 0, bitIndex = 0;
//第一段速度运动
result = YKM_MoveContinuesVelocity(axisIndex, moveVelocityConfig1, YKM_BufferMode::YKM_BLENDING_PREV);
print(result);
//输入信号,收到输入信号后切换到下一条指令中去
result = YKM_MoveContinuesInput(axisIndex, byteIndex, bitIndex, YKM_TrigMode::YKM_TRIGMODE_UPEDGE);
print(result);
//相对定位
result = YKM_MoveContinuesVelocity(axisIndex, moveVelocityConfig2, YKM_BufferMode::YKM_BLENDING_PREV);
print(result);
YKM_MoveContinuesStart(axisIndex);
//等待目标位置到达
YKM_AxisStatus status;
while (!exit_cmd)
{
result = YKM_ReadAxisInfo(axisIndex, &status);
if (0 != status.Done)
break;
Sleep(1);
}
|