TRIO-basic指令--CAM

你們好,今天更新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.   this

  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. spa

  經過將它們偏移第一個值而後將它們乘以乘數參數,將TABLE值轉換爲位置。這意味着非零起始輪廓將被偏移,以便第一個點爲零,而後使用乘數縮放全部值。而後將它們用做起始位置的絕對位置。code

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

     同時執行的兩個或多個CAM命令可使用表中的相同值。blog

  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:

  一、需求:用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 = 1000
points = 100
' store the table points
TABLE(tablestart,0.0000,0.0160,0.1241,0.4057,0.9316,1.7615,2.9456,4.5241)
TABLE(tablestart + 8,6.5283,8.9810,11.8967,15.2822,19.1375,23.4556,28.2235)
TABLE(tablestart + 15,33.4224,39.0284,45.0129,51.3427,57.9814,64.8890,72.0227)
TABLE(tablestart + 22,79.3375,86.7865,94.3217,101.8938,109.4536,116.9518)
TABLE(tablestart + 28,124.3396,131.5696,138.5958,145.3741,151.8632,158.0247)
TABLE(tablestart + 34,163.8238,169.2295,174.2156,178.7606,182.8486,186.4694)
TABLE(tablestart + 40,189.6196,192.3025,194.5286,196.3166,197.6934,198.6948)
TABLE(tablestart + 46,199.3659,199.7615,199.9468,199.9980,199.9980,199.9468)
TABLE(tablestart + 52,199.7615,199.3659,198.6948,197.6934,196.3166,194.5286)
TABLE(tablestart + 58,192.3025,189.6196,186.4694,182.8486,178.7606,174.2156)
TABLE(tablestart + 64,169.2295,163.8238,158.0247,151.8632,145.3741,138.5958)
TABLE(tablestart + 70,131.5696,124.3396,116.9518,109.4536,101.8938,94.3217)
TABLE(tablestart + 76,86.7865,79.3375,72.0227,64.8890,57.9814,51.3427,45.0129)
TABLE(tablestart + 83,39.0284,33.4224,28.2235,23.4556,19.1375,15.2822,11.8967)
TABLE(tablestart + 90,8.9810,6.5283,4.5241,2.9456,1.7615,0.9316,0.4057,0.1241)
TABLE(tablestart + 98,0.0160,0.0000)
'Stop CamGen Sector1

'test_cam position
BASE(0)
ATYPE = 0
UNITS = 200
SPEED = 200
ACCEL = 999
DECEL = 999
FE_LIMIT = 999
FE_RANGE = 990
DEFPOS(0)
SERVO = 1

WHILE TRUE
    WA(1000) 'yan shi 1s
    TRIGGER 'catch curve
    CAM(1000,1099,1,200)AXIS(0)
    WA(1000) 'yan shi 1s
WEND

  運行的曲線結果:

  

  下面是詳細介紹 CAM 參數值

  CAM(1000,1099,1,200)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等指令。
相關文章
相關標籤/搜索