大家好,今天更新TRIO的运动指令CAM(也就是CAM函数),CAM指令是控制器直接发送编码器脉冲形成的运动曲线,比如:正弦,余弦曲线,根据自己的精度需求进行描点,但并不一定点数越多精度就越高,以实际为准。

下面是指令及简单的小例子:

CAM


Type:

  Axis Command


Syntax:

  CAM(start point, end point, table multiplier, distance)     CAM(开始点,结束点,table(table是临时寄存器)  倍率,距离)


Description:

  The CAM command is used to generate movement of an axis according to a table of positions which define a movement profile.  The table of values is specified with the TABLE command. The   movement may be defined with any number of points from 3 up to the maximum table size available.  The controller performs linier interpolation between the values in the table to allow small          numbers of points to define a smooth profile.   

  CAM命令用于根据定义运动轮廓的位置表生成轴的运动。使用TABLE命令指定值表。可以使用从3到最大可用表大小的任意数量的点来定义移动。控制器在表格中的值之间执行线性插值,以允许少量点定义平滑轮廓。

  The TABLE values are translated into positions by offsetting them by the first value and then multiplying them by the multiplier parameter. This means that a non-zero starting profile will be offset          so that the first point is zero and then all values are scaled with the multiplier. These are then used as absolute positions from the start position.

  通过将它们偏移第一个值然后将它们乘以乘数参数,将TABLE值转换为位置。这意味着非零起始轮廓将被偏移,以便第一个点为零,然后使用乘数缩放所有值。然后将它们用作起始位置的绝对位置。

    Two or more CAM commands executing simultaneously can use the same values in the table.

    同时执行的两个或多个CAM命令可以使用表中的相同值。

  The speed of the CAM profile is defined through the SPEED of the BASE axis and the distance parameter. You can use these two values to determine the time taken to execute the CAM profile.

  CAM轮廓的速度通过BASE轴的SPEED和距离参数定义。您可以使用这两个值来确定执行CAM配置文件所需的时间。

    As with any motion command the SPEED may be changed at any time to any positive value. The SPEED is ramped up to using the current ACCEL value.

    与任何运动命令一样,SPEED可以随时更改为任何正值。 SPEED逐渐增加到使用当前ACCEL值。

  To obtain a CAM shape where ACCEL has no effect the value should be set to at least 1000 times the SPEED value (assuming the default SERVO_PERIOD of 1ms).

  要获得ACCEL无效的CAM形状,应将该值设置为SPEED值的至少1000倍(假设默认SERVO_PERIOD为1ms)。

  When the CAM command is executing, the ENDMOVE parameter is set to the end of the PREVIOUS move

  执行CAM命令时,ENDMOVE参数设置为PREVIOUS移动的结束


Parameters:

start point:

The start position of the cam profile in the TABLE

end point:

The end position of the cam profile in the TABLE

multiplier:

The table values are multiplied by this value to generate the positions.

distance:

The distance parameter relates the speed of the axis to the time taken to complete the cam profile. The time taken can be calculated using the current axis speed and this distance parameter (which are in user units).

起始点:

表中凸轮轮廓的起始位置

结束点:

表格中凸轮轮廓的终点位置

乘值:

表值乘以该值以生成位置。

距离:

距离参数将轴的速度与完成凸轮轮廓所花费的时间相关联。可以使用当前轴速度和该距离参数(以用户单位)计算所花费的时间。


Examples:

  1、需求:用CAM做一个位置弧形的曲线。 网上找的图片 ^_^

  position:

  

  CAM没有跟随轴的概念,所以我们可以直接运行一个虚轴或者实际的轴直接生成你要的位置曲线图。

  打开TRIO编程界面,然后在工具栏 => CamGen => 然后创建一个名称,如下图:

  

  或者:

  

  下一步:

  

  点击OK进入的界面:

  

  点击:选择

  

  选择:yes

 

  注意看下图标注的位置:

  

  上面是简单的介绍,下面我们先规划一条抛物线的位置曲线。

  

  下面即可直接复制生成的代码,直接运动。

  

  把上面复制的代码放在运行的程序中,运行即可。

DIM tablestart, points AS INTEGER
'Start CamGen Sector1
'->ProfileClass=PiecewiseCurve
'->ProfileName=CAM
'->OutputType=Points
'->MinLogicalX=0
'->MaxLogicalX=100
'->CamLinkInput=500
'->Segment=0;0;0.0000;0.0000;0.0000;Point
'->Segment=1;0.5;200.0000;0.0000;0.0000;Point
'->Segment=2;1;0.0000;0.0000;0.0000;Point
'->TableStart=1000
'->TableLength=100
' set the variables
tablestart =
points =
' store the table points
TABLE(tablestart,0.0000,0.0160,0.1241,0.4057,0.9316,1.7615,2.9456,4.5241)
TABLE(tablestart + ,6.5283,8.9810,11.8967,15.2822,19.1375,23.4556,28.2235)
TABLE(tablestart + ,33.4224,39.0284,45.0129,51.3427,57.9814,64.8890,72.0227)
TABLE(tablestart + ,79.3375,86.7865,94.3217,101.8938,109.4536,116.9518)
TABLE(tablestart + ,124.3396,131.5696,138.5958,145.3741,151.8632,158.0247)
TABLE(tablestart + ,163.8238,169.2295,174.2156,178.7606,182.8486,186.4694)
TABLE(tablestart + ,189.6196,192.3025,194.5286,196.3166,197.6934,198.6948)
TABLE(tablestart + ,199.3659,199.7615,199.9468,199.9980,199.9980,199.9468)
TABLE(tablestart + ,199.7615,199.3659,198.6948,197.6934,196.3166,194.5286)
TABLE(tablestart + ,192.3025,189.6196,186.4694,182.8486,178.7606,174.2156)
TABLE(tablestart + ,169.2295,163.8238,158.0247,151.8632,145.3741,138.5958)
TABLE(tablestart + ,131.5696,124.3396,116.9518,109.4536,101.8938,94.3217)
TABLE(tablestart + ,86.7865,79.3375,72.0227,64.8890,57.9814,51.3427,45.0129)
TABLE(tablestart + ,39.0284,33.4224,28.2235,23.4556,19.1375,15.2822,11.8967)
TABLE(tablestart + ,8.9810,6.5283,4.5241,2.9456,1.7615,0.9316,0.4057,0.1241)
TABLE(tablestart + ,0.0160,0.0000)
'Stop CamGen Sector1 'test_cam position
BASE()
ATYPE =
UNITS =
SPEED =
ACCEL =
DECEL =
FE_LIMIT =
FE_RANGE =
DEFPOS()
SERVO = WHILE TRUE
WA() 'yan shi 1s
TRIGGER 'catch curve
CAM(,,,)AXIS()
WA() 'yan shi 1s
WEND

  运行的曲线结果:

  

  下面是详细介绍 CAM 参数值

  CAM(,,,)AXIS(0)

  CAM(“规划曲线的时候,我们填的 TABLE start的值”,
    “Points 里面的值,相当于 从 1000开始 100个TABLE表 1000~1099”,
    “倍率:相当于轴的脉冲数 * 当前的值。上面我们测试的脉冲是 200 * 1 实际电机走的位置为200 ,如果填 2 就相当于 200 * 2 实际电机走的位置就是 400 ”,
    “此值就是:时间 * 当前的速度值,更据测试解释 我希望 1s完成 200的速度,1*200 = 200. 如果我希望0.5s完成200的速度,就是 0.5 * 200 = 100,上面的值就可以填写100,更据实际情况而定”
    ) 运动的轴号  上面是一个简单的应用,如果大家用项目用到,可以当做一个简单的参考,大神请路过。上面有表述有问题的地方,可在评论区留言,本人会更据实际情况进行修改。后期会介绍一些项目中其他的指令,如:MOVELINK , REGIST等指令。

最新文章

  1. 谁偷了我的热更新?Mono,JIT,iOS
  2. EventBus 一
  3. html css 样式继承的问题
  4. [java] 汇率换算器实现(3)
  5. 【代码笔记】iOS-缓存路径操作类
  6. SQLServer索引
  7. asp Gridview绑定形式获取行号
  8. lightning mdb 源代码分析(5)-事务控制
  9. SQL Server 执行计划中的扫描方式举例说明
  10. 用Delphi实现文件关联
  11. java 网络编程-tcp/udp
  12. [BZOJ 1082] [SCOI2005] 栅栏 【二分 + DFS验证(有效剪枝)】
  13. Linux Kernel Vhost 架构
  14. 机器学习-GBDT和XGboost
  15. div,margin,padding
  16. CentOS7设置SVN自启动,提交报错,无权限.手动kill掉后重启,成功.
  17. 自学java_Struts2框架
  18. MySQL-查询结果缓存
  19. canvas-a13prototype.html
  20. MonkeyRunner之MonkeyRecorder录制回放脚本(亲测可正常运行)

热门文章

  1. Odoo中的env详解
  2. Comet OJ - Contest #10 C.鱼跃龙门
  3. 安装glibc
  4. Kubernetes安全策略
  5. Gym - 102056C(2018EC final) -Heretical … Möbius ——CRT
  6. 【java异常】【redis】ERR Client sent AUTH, but no password is set
  7. qhclass
  8. Pandas | 10 排序
  9. 【CF573E】Bear and Bowling
  10. c++开发遇到的错误和引用配置