Difference between revisions of "Circular Motion"

From Wiki
(Created page with "The circular motion command can be used to define curved paths. It is supported from CPRog/iRC and TinyCtrl V13. This article gives a short introduction and hints on how to de...")
 
m (Relative circles)
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
= Defining a Circular Motion =
 
= Defining a Circular Motion =
 +
[[File:CommandCircularConcept.png|thumb|Example of a circle definition. In the plane, the three circle positions can be easily calculated by
 +
adding or subtracting the radius (here 50mm) to the center point]]
 
[[File:CommandCircular.PNG|thumb|Example: Definition of a 90° curve using target position and target angle approach]]
 
[[File:CommandCircular.PNG|thumb|Example: Definition of a 90° curve using target position and target angle approach]]
  
A circular path can be defined using a target position or a target angle. Each approach can be more useful or easier to use in specific situations.
+
A circular path is defined by three points on a circle, as shown in the diagram. The starting point is defined
 +
by the target position of the previous motion command. Positions 1 and 2 are arbitrary points on the
 +
circle. The parameter "Motion ends at" defines whether the circle is left at point 2 or after a certain angle. The
 +
angle can be before or after point 2. It is also possible to circle several times (angle greater than 360°) or move
 +
in the opposite direction (negative angle).
  
== Target Position ==
+
If the tool is to be rotated during the circular movement, the target orientation can be specified. The angles
A circle can be defined by 3 points on it's outline. Defining a circle or circular curve in a robot program uses this idea as follows:
+
from the start orientation to the target orientation are interpolated linearly. If specified, the positions of the
# Create a motion command (linear or joint) to the start point of the circle
+
external axes are also calculated.
# Create a circular command and define the target position ("Position 2") and an intermediate position ("Position 1").
 
  
The robot will move from to the start position, then in a circular path via position 1 to position 2. Note that position 1 defines the direction in which the robot moves around the circle's center.
+
The positions can be defined as constants or via variables and are relative to the given [[User Frame|user frame]].
  
Example (90° motion, radius 50mm):
+
== Teach-In ==
* Start position (linear command): 50mm, 200mm, 0mm
+
If you got a circular curve under your robot the easiest way is to program by teach-in:
* Position 1: 64.7mm, 235.4mm, 0mm
+
# Move the robot to the start position of the curve and add a linear instruction.
* Position 2: 100mm, 250mm, 0mm
+
# Move the robot to any position on the curve, e.g. half way. Add the circle instruction.
* End position: Position 2
+
# Move the robot to the end of the curve and click the "Set current position" button in the "Position 2" line.
 +
# Optional: click the "Set Current Ori + Ext" button if the tool orientation or external axes change during the curve path.
  
Warning: Never use a circular command as first command of your program and be careful with variable motion. If the circular motion starts at an unexpected position the circle can become very big or small.
+
== Circle in a plane ==
 +
If your circle is aligned to the coordinate axes calculating the positions is very easy.
  
== Target Angle ==
+
Refer to the diagram above, you may want to do a similar sketch. First calculate the center position and radius. Add/subtract the radius from the X,Y and/or Z values of the center to get 3 points on the circle. One of them should be the starting position, set this as the target of the previous command. Set the other two as positions 1 and 2 of the circular command (the robot will move via 1 to 2).
Alternatively the end position can be defined by a target angle. This may be easier to calculate in some cases and it can be used to move further than a full circle.
 
  
# Define a circle as explained above. Position 1 and 2 can be any points on the circle.
+
Even if you do not want to move 180°, it is often easiest to use positions 1 and 2 at 0°, 90°,
# Set the target angle in the "End Position" section.
+
180° or 270° and to specify the actual angle to be moved using the end of movement parameter.
 +
This allows the positions to be calculated as described above without trigonometry.
  
Hint: If your circle is aligned to the cartesian axes you easily calculate position 1 and 2 at 90° and 180° by first calculating the center of the circle and adding/subtracting the radius along each axis. Then set the target angle as desired.
+
Calculating the example values in the diagram can be done like this:
 +
# Center: X=100, Y=200, Z=any value (since this circle is in the XY plane), radius: 50mm
 +
# Start position towards negative X: subtract radius from X: X=50, Y=200
 +
# Position 1 (intermediate position): add radius from Y: X=100, Y=250 (you can subtract instead if you want to move in the opposite direction)
 +
# Position 2 (end position): add radius to X: X=150, Y=200
 +
The same approach works if the circle were in a different plane.
  
Example (90° motion, radius 50mm):
+
== Complex circles ==
* Center 100mm, 200mm, 0mm
+
For more complex circles, e.g. circles that are in a tilted plane or whose starting point is not on a X/Y/Z line to the center point, may need some trigonometric calculations or measuring from a good sketch.
* Start position (linear command): 50mm, 200mm, 0mm
 
* Position 1: 100mm, 250mm, 0mm
 
* Position 2: 150mm, 200mm, 0mm
 
* End Position: Angle = 90°
 
  
== Orientation and External Axes ==
+
== Relative circles ==
To rotate the tool enter the target orientation.
+
[[File:CircleRelative.png|thumb|This command does a relative circle of 100mm diameter at the current tool position.]]
Warning: The robot kinematic will choose the shortest rotation direction. This may lead to joint limit errors or the direction swapping if the rotation is 180° or more.
 
  
To move external axes enter their target positions.
+
Doing a circle at a relative position may be necessary when working with variable positions, e.g. when using a matrix or camera. There are two ways to do relative circles.
 +
 
 +
The easiest way is shown in the screenshot. Set the frame to "#tool" and smoothing to 0. Then enter the radius in position 1 (e.g. for X and Y) and the diameter in position 2. This approach does not support motion smoothing so the robot will stop shortly before starting the circle. If you enter a smoothing value other than 0 the circle may be unexpectedly large or small.
 +
 
 +
The second approach is by defining the circle positions 1 and 2 by variables. Define and calculate positions 1 and 2 before starting the motion, set the position source to "variable" (see the source selection at the top left of the circular command) and enter the variables.
 +
 
 +
== Tool Orientation and External Axes ==
 +
To rotate the tool enter the target orientation, the value is linearly interpolated over the entire motion.
 +
Warning: The robot kinematic will choose the shortest rotation direction. This may lead to joint limit errors or the direction swapping if the rotation is 180° or more. In this case you may need to split the circle into multiple partial motions.
 +
 
 +
To move external axes enter their target positions, the value is linearly interpolated over the entire motion
  
 
== Variable Positions ==
 
== Variable Positions ==
Line 49: Line 66:
 
== Smoothing and Combined Paths ==
 
== Smoothing and Combined Paths ==
 
The circular motion is compatible to the linear motion so that a combined path without stops can be defined. Smoothing can be used to smooth discontinuities between commands. E.g. if a circular curve is followed by a linear motion or another curve and the commands are not perfectly aligned smoothing will cut some distance off each motion command and add a smooth curve inbetween. A higher value of the smoothing parameter will cut more, which can lead to the circular and linear path being followed less precisely. A value of 0 will disable smoothing, in this case the robot will shortly stop before continuing the next command.
 
The circular motion is compatible to the linear motion so that a combined path without stops can be defined. Smoothing can be used to smooth discontinuities between commands. E.g. if a circular curve is followed by a linear motion or another curve and the commands are not perfectly aligned smoothing will cut some distance off each motion command and add a smooth curve inbetween. A higher value of the smoothing parameter will cut more, which can lead to the circular and linear path being followed less precisely. A value of 0 will disable smoothing, in this case the robot will shortly stop before continuing the next command.
 +
 +
Hint: Use a low smoothing value of e.g. 1% to avoid stopping while keeping the motion precise.
  
 
Please note: Smoothing is limited by the value of the "LookAhead" parameter in the robot configuration. This means that after X succeeding commands the smoothing will ignored for one command. If you define a long path you may notice this as the robot stopping each X commands.
 
Please note: Smoothing is limited by the value of the "LookAhead" parameter in the robot configuration. This means that after X succeeding commands the smoothing will ignored for one command. If you define a long path you may notice this as the robot stopping each X commands.
Line 55: Line 74:
 
This package contains example programs that show how the circular motion command can be used: [[File:CircularMotionExamples.zip]]. You can run them in the iRC simulation.
 
This package contains example programs that show how the circular motion command can be used: [[File:CircularMotionExamples.zip]]. You can run them in the iRC simulation.
  
[[Category:CPRog]][[Category:TinyCtrl]]
+
[[Category:CPRog]][[Category:Robot Programming]][[Category:TinyCtrl]]

Latest revision as of 12:58, 2 October 2024

The circular motion command can be used to define curved paths. It is supported from CPRog/iRC and TinyCtrl V13. This article gives a short introduction and hints on how to define curves.

Defining a Circular Motion

Example of a circle definition. In the plane, the three circle positions can be easily calculated by adding or subtracting the radius (here 50mm) to the center point
Example: Definition of a 90° curve using target position and target angle approach

A circular path is defined by three points on a circle, as shown in the diagram. The starting point is defined by the target position of the previous motion command. Positions 1 and 2 are arbitrary points on the circle. The parameter "Motion ends at" defines whether the circle is left at point 2 or after a certain angle. The angle can be before or after point 2. It is also possible to circle several times (angle greater than 360°) or move in the opposite direction (negative angle).

If the tool is to be rotated during the circular movement, the target orientation can be specified. The angles from the start orientation to the target orientation are interpolated linearly. If specified, the positions of the external axes are also calculated.

The positions can be defined as constants or via variables and are relative to the given user frame.

Teach-In

If you got a circular curve under your robot the easiest way is to program by teach-in:

  1. Move the robot to the start position of the curve and add a linear instruction.
  2. Move the robot to any position on the curve, e.g. half way. Add the circle instruction.
  3. Move the robot to the end of the curve and click the "Set current position" button in the "Position 2" line.
  4. Optional: click the "Set Current Ori + Ext" button if the tool orientation or external axes change during the curve path.

Circle in a plane

If your circle is aligned to the coordinate axes calculating the positions is very easy.

Refer to the diagram above, you may want to do a similar sketch. First calculate the center position and radius. Add/subtract the radius from the X,Y and/or Z values of the center to get 3 points on the circle. One of them should be the starting position, set this as the target of the previous command. Set the other two as positions 1 and 2 of the circular command (the robot will move via 1 to 2).

Even if you do not want to move 180°, it is often easiest to use positions 1 and 2 at 0°, 90°, 180° or 270° and to specify the actual angle to be moved using the end of movement parameter. This allows the positions to be calculated as described above without trigonometry.

Calculating the example values in the diagram can be done like this:

  1. Center: X=100, Y=200, Z=any value (since this circle is in the XY plane), radius: 50mm
  2. Start position towards negative X: subtract radius from X: X=50, Y=200
  3. Position 1 (intermediate position): add radius from Y: X=100, Y=250 (you can subtract instead if you want to move in the opposite direction)
  4. Position 2 (end position): add radius to X: X=150, Y=200

The same approach works if the circle were in a different plane.

Complex circles

For more complex circles, e.g. circles that are in a tilted plane or whose starting point is not on a X/Y/Z line to the center point, may need some trigonometric calculations or measuring from a good sketch.

Relative circles

This command does a relative circle of 100mm diameter at the current tool position.

Doing a circle at a relative position may be necessary when working with variable positions, e.g. when using a matrix or camera. There are two ways to do relative circles.

The easiest way is shown in the screenshot. Set the frame to "#tool" and smoothing to 0. Then enter the radius in position 1 (e.g. for X and Y) and the diameter in position 2. This approach does not support motion smoothing so the robot will stop shortly before starting the circle. If you enter a smoothing value other than 0 the circle may be unexpectedly large or small.

The second approach is by defining the circle positions 1 and 2 by variables. Define and calculate positions 1 and 2 before starting the motion, set the position source to "variable" (see the source selection at the top left of the circular command) and enter the variables.

Tool Orientation and External Axes

To rotate the tool enter the target orientation, the value is linearly interpolated over the entire motion. Warning: The robot kinematic will choose the shortest rotation direction. This may lead to joint limit errors or the direction swapping if the rotation is 180° or more. In this case you may need to split the circle into multiple partial motions.

To move external axes enter their target positions, the value is linearly interpolated over the entire motion

Variable Positions

The positions can be defined as constants or via variables. The latter can be used to dynamically define the path by camera or PLC data. Please keep the hints above on variable positions and orientations in mind and test your program well.

The circular command uses 2 variables. One defines position 1 only, the other defines position 2, as well as the target orientation and external axes.

Smoothing and Combined Paths

The circular motion is compatible to the linear motion so that a combined path without stops can be defined. Smoothing can be used to smooth discontinuities between commands. E.g. if a circular curve is followed by a linear motion or another curve and the commands are not perfectly aligned smoothing will cut some distance off each motion command and add a smooth curve inbetween. A higher value of the smoothing parameter will cut more, which can lead to the circular and linear path being followed less precisely. A value of 0 will disable smoothing, in this case the robot will shortly stop before continuing the next command.

Hint: Use a low smoothing value of e.g. 1% to avoid stopping while keeping the motion precise.

Please note: Smoothing is limited by the value of the "LookAhead" parameter in the robot configuration. This means that after X succeeding commands the smoothing will ignored for one command. If you define a long path you may notice this as the robot stopping each X commands.

Example Programs

This package contains example programs that show how the circular motion command can be used: File:CircularMotionExamples.zip. You can run them in the iRC simulation.