#include <mil.h>
MIL_ID MilApplication,
MilSystem,
MilCom;
MIL_CONST_TEXT_PTR ROBOT_IP = MIL_TEXT("127.0.0.1:2001");
void GetNextPosition(MIL_DOUBLE& x, MIL_DOUBLE& y, MIL_DOUBLE& z);
int MosMain(void)
{
MIL_INT64 opcode;
MIL_INT64 status;
MIL_INT64 modelid;
MIL_DOUBLE robot_x, robot_y, robot_z;
MIL_DOUBLE robot_rx, robot_ry, robot_rz;
MappAllocDefault(M_DEFAULT, &MilApplication, &MilSystem,
M_NULL, M_NULL, M_NULL);
McomAlloc(MilSystem, M_COM_PROTOCOL_EPSON, ROBOT_IP, M_DEFAULT, M_DEFAULT, &MilCom);
MosPrintf(MIL_TEXT("Press <Enter> to end.\n"));
while (!MosKbhit())
{
McomWaitPositionRequest(MilCom, &opcode, &status, &modelid, &robot_x, &robot_y, &robot_z, &robot_rx, &robot_ry, &robot_rz, M_DEFAULT, M_DEFAULT);
GetNextPosition(robot_x, robot_y, robot_z);
McomSendPosition(MilCom, M_COM_ROBOT_FIND_POSITION_RESULT, 0, modelid, robot_x, robot_y, robot_z, robot_rx, robot_ry, robot_rz, M_DEFAULT, M_DEFAULT);
}
McomFree(MilCom);
MappFreeDefault(MilApplication, MilSystem, M_NULL, M_NULL, M_NULL);
return 0;
}
void GetNextPosition(MIL_DOUBLE& x, MIL_DOUBLE& y, MIL_DOUBLE& z)
{
x += 15;
if (x > 300)
x = 0;
}