Difference between revisions of "Program Examples:Backlash Compensation Table"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "==Introduction== This article demonstrates the use of compensation tables for eliminating position backlash . [[File:BACKLASHCOMPENSATION.PNG|Backlash compensation value in ...")
 
Line 7: Line 7:
 
== Program ==
 
== Program ==
  
First, attach the axis, go to an initial position (zero):
+
First, define two compensation tables each one for opposite directions:
  
 
<pre>
 
<pre>
  Attach A1   
+
common shared compAxAPlus  as comp
  Move A1 0
+
common shared compAxAMinus as comp
 
</pre>
 
</pre>
  
Set the backlash value and the alpha smoothing factor:
+
attach the axis, go to an initial position (-100):
  
 
<pre>
 
<pre>
   A1.PositionBacklash = 0.5
+
  Attach AxA    
  A1.PositionBacklashAlpha = 0.9
+
  Move A1 -100
 
</pre>
 
</pre>
 +
 +
Define the number of points in each table (10):
 +
 +
<pre>
 +
  CreateComp compAxAPlus  10
 +
  CreateComp compAxAMinus 10
 +
</pre>
 +
 +
Both are active between -100 and +100:
 +
 +
<pre>
 +
  CreateComp compAxAPlus  10
 +
  CreateComp compAxAMinus 10
 +
</pre>
 +
 +
 +
Set the both tables acting on same axis(AxA):
 +
 +
<pre>
 +
  CompSet compAxAPlus  AxA On AxA
 +
  CompSet compAxAMinus AxA On AxA
 +
</pre>
 +
  
 
Checking the actual compensation value from terminal should return 0 as no motion has been done:
 
Checking the actual compensation value from terminal should return 0 as no motion has been done:
  
 
<pre>
 
<pre>
-->?a1.CompPCmd - a1.PCmd
+
  compAxAPlus.MinPosition[1] = -100
0
+
  compAxAPlus.MaxPosition[1] = +100
 +
 
 +
  compAxAMinus.MinPosition[1] = -100
 +
  compAxAMinus.MaxPosition[1] = +100
 
</pre>
 
</pre>
  
 +
Set the compensation values linearly between 0.1 for -100 and 1.0 for +100 for '''positive''' direction and -0.1 to -1.0 for '''negative''' direction:
 +
<pre>
 +
  for i = 1 to 10
 +
      compAxAPlus.TargetData[1][i] = 0.1*i
 +
      compAxAMinus.TargetData[1][i] = -0.1*i
 +
    next
 +
</pre>
 +
 +
Set direction of compensation activity, one table is only active in positive movement (vcmd > 0) direction the other is negative (vcmd <0):
  
Move back (negative direction):
 
 
<pre>
 
<pre>
  MOVE A1 -100
+
    compAxAPlus.direction = 1
 +
    compAxAMinus.direction = -
 
</pre>
 
</pre>
  
Checking the actual compensation value from terminal should return -0.5 as motion was in negative direction:
+
 
 +
Set both tables active, it means both will be active  each one in different direction:
  
 
<pre>
 
<pre>
-->?a1.CompPCmd - a1.PCmd
+
    compAxAPlus.CompActive = 1
-0.5
+
    compAxAMinus.CompActive = 1
 
</pre>
 
</pre>
  
Move forward (positive direction):
+
 
 +
Start Motion:
 +
 
 
<pre>
 
<pre>
  MOVE A1 +100
+
    AxA.PositionBacklashAlpha = 0.9
 +
 
 +
    Sleep 100
 +
    Move AxA 99.9 Abs = 1  Vcruise = 10000
 +
    Delay AxA 100   
 +
    Move AxA -99.9  Abs = 1 Vcruise = 10000
 +
    Delay AxA 100   
 
</pre>
 
</pre>
  
Checking the actual compensation value from terminal should return +0.5 as motion was in positive direction:
 
  
 +
Detach the axis:
 
<pre>
 
<pre>
-->?a1.CompPCmd - a1.PCmd
+
  Detach AxA   
0.5
+
  End Program
 
</pre>
 
</pre>

Revision as of 08:14, 29 September 2014

Introduction

This article demonstrates the use of compensation tables for eliminating position backlash .

Backlash compensation value in different movement directions

Program

First, define two compensation tables each one for opposite directions:

common shared compAxAPlus  as comp
common shared compAxAMinus as comp

attach the axis, go to an initial position (-100):

  Attach AxA    
  Move A1 -100

Define the number of points in each table (10):

  CreateComp compAxAPlus  10
  CreateComp compAxAMinus 10

Both are active between -100 and +100:

  CreateComp compAxAPlus  10
  CreateComp compAxAMinus 10


Set the both tables acting on same axis(AxA):

   CompSet compAxAPlus  AxA On AxA
   CompSet compAxAMinus AxA On AxA


Checking the actual compensation value from terminal should return 0 as no motion has been done:

   compAxAPlus.MinPosition[1] = -100
   compAxAPlus.MaxPosition[1] = +100

   compAxAMinus.MinPosition[1] = -100
   compAxAMinus.MaxPosition[1] = +100

Set the compensation values linearly between 0.1 for -100 and 1.0 for +100 for positive direction and -0.1 to -1.0 for negative direction:

   for i = 1 to 10
      compAxAPlus.TargetData[1][i] = 0.1*i
      compAxAMinus.TargetData[1][i] = -0.1*i
    next 

Set direction of compensation activity, one table is only active in positive movement (vcmd > 0) direction the other is negative (vcmd <0):

    compAxAPlus.direction = 1
    compAxAMinus.direction = -1  


Set both tables active, it means both will be active each one in different direction:

    compAxAPlus.CompActive = 1
    compAxAMinus.CompActive = 1


Start Motion:

    AxA.PositionBacklashAlpha = 0.9

    Sleep 100
    Move AxA 99.9 Abs = 1  Vcruise = 10000
    Delay AxA 100    
    Move AxA -99.9  Abs = 1 Vcruise = 10000
    Delay AxA 100    


Detach the axis:

  Detach AxA    
  End Program