机器人编程运动指令、信号处理指令等示例说明.docxVIP

  • 9
  • 0
  • 约2.51千字
  • 约 3页
  • 2025-06-20 发布于河南
  • 举报

机器人编程运动指令、信号处理指令等示例说明.docx

机器人编程运动指令、信号处理指令等示例说明

1运动指令

MJOINT(pj0,speed1,zone1,tool0); //以指定运动参数运动到关节点位pj0

MLIN(pc1,speed2,zone2,tool0); //以指定运动参数运动到笛卡尔点位pc1

MCIRC(pc1,pc2,speed2,zone2,tool0);//以指定运动参数沿圆弧轨迹,途经pc1点运动到笛卡尔点位pc2

MPATH(pc_array,speed3,zone3,tool0);//多节点连续平滑轨迹

MLIN(pc1,speed2,zone2,tool,wobj=wobj1);//以指定运动参数运动到笛卡尔点位pc1,参考坐标系为wobj1

2信号处理指令

SetDOut(DO1,true);//设置数字信号

SetDOut(DO2,false);

SetAOut(AO1,10); //设置模拟信号

SetAOut(AO2,5);

WaitDI(DI1,true,-1);//等待数字输入信号

WaitDO(DO1,true,3);//等待数字输出信号,超时时间为3s

WaitAI(AI1,1,1);//等待模拟输入信号

WaitAO(AO1,4,2);

3触发器指令

//设置一个触发器,于距离运动起始点位101mm的位置,延迟1ms触发中断信号intr1

trigdata1=TrigDist(trigref::from_start,1.0,101,intr1);

TRIGGLIN(pc1,speed2,trigdata1,zone2,tool0);

//设置一个触发器,于距离运动起始点位101mm的位置,延迟1ms将DO1设置为false

stringsig_name=DO1;

numsig_value=0;

trigdata2=TrigDist(trigref::from_start,1.0,-101.0,sig_name,sig_value);

TRIGGLIN(pc1,speed2,trigdata2,zone2,tool0);

4中断指令

intnumiv1;//中断标识

//中断处理函数

voidtrapf(){

print(traptriggered:%n\n,x);

}

voidmain(){

connect(iv1,trapf);//关联中断变量于中断标识

itimer(1,iv1);//注册中断标识变量,订阅定时器中断

isleep(iv1);//禁用中断iv1

iwatch(iv1);//使能中断iv1

idisable();//禁用所有中断

ienable();//使能所有中断

}

5数学运算指令

numres;

boolflag;

res=Limit(-0.1,0.1,10);//0.1

res=Limit(5,0,10);//5F

res=Mod(-6.5,-1.5);//-0.5

res=AbsFMod(-6.5,1.5);//1

res=Random(-10,10); //生成[-10,10)的随机数

SRand(1); //设置随机种子

res=Random(-10,10);

flag=Range(-0.1,0.1,10);//false

flag=Range(0.1,0.1,10);//true

res=Sign(1);//1

res=Sign(-2);//-1

6字符串处理指令

ValToString(false);//false

ValToString(-20.1);//-20.1

boolb;

boolret;

ret=StringToVal(false,b);//b=false,ret=true

ret=StringToVal(2.44,n);//2.44

StrLen(hello)//5

Left(hello,world,5);//hello

Right(hello,world,5);//world

SubStr(hello,1,3);//hel

Insert(hello,world,2);//heworldllo

Delete(hello,new,world,7,4);//hello,world

Replace(hel

文档评论(0)

1亿VIP精品文档

相关文档