# MC-Basic:CIRCLE

The CIRCLE command issues a circular(arc) path trajectory for the specified group/robot, and uses the properties of that group.

The CIRCLE command has two formats. One specifies the group name, the angle and the circle center. This format enables multi-turn circular motion. The other is defined by a circle point and the final point of the arc.

The optional properties override the permanent values of the properties for the duration of the command. When using an optional property, the keyword must be specified.

For robot models the CIRCLE command issues a circular path in Cartesian space (XYZ). Orientation angles are interpolated proportionally to the circle angle.

For PUMA robots the orientation vector is kept orthogonal to the circular path.

## Syntax

Circle <group> Angle = <angle> CircleCenter = {<vector>} {CirclePlane = <circle plane>} {Optional Nodal Property}*

Or

Circle <group> CirclePoint = <vector> TargetPoint = {<vector>} {Optional Nodal Property}*

All versions

Double

## Range

<group>: An existing group
<angle>: ± MaxDouble - Positive values describe CCW and negative CW rotations

<circle plane>:

• 0 (XY)
• 1 (XZ)
• 2 (YZ)

<vector>: location or joint value

## Default

Permanent property values are used unless specified otherwise. Final velocity is 0.

## Limitations

• Applicable only to groups.
• A group cannot be moved if an axis from the group is being moved individually.
• A group must be attached in order to be moved from within a task.

## Examples

Circle XYTable Angle = 90 CircleCenter = {20,10} Vtran = 500

Circle XYtable CirclePoint = {10,20} TargetPoint = {100,200} Vtran = 500

# Half Circle

Here is a simple example for generating half circle motion with a delta (XYZR) robot.

```Attach DELTA
DELTA.En=1
Record circPnt.rec 100000 Gap=1 RecData = DELTA.SetPoint{1},DELTA.SetPoint{2}, Sys.Clock
Move DELTA #{100,0,426,0}
Delay DELTA 3000
RecordOn
Circle DELTA CirclePoint=#{0,100,426,0} TargetPoint=#{-100,0,426,0}
Delay DELTA 3000
RecordClose
Detach DELTA
```

# Helical

Here is a simple example for circle in 3D. The circle itself was defined at XY plane with additional movement in Z axis.
The code :
At the config file:

```System.NumberAxes = 3
common shared Axes[3] as generic axis
common shared temp_grp  as group Axnm = a1 Axnm = a2  Axnm = a3
common shared PLANE_XY as const long =0
common shared PLANE_XZ as const long =1
common shared PLANE_YZ as const long =2
Program
Axes[1] = a1
Axes[2] = a2
Axes[3] = a3
sys.DoubleFormat = 1
sys.Name = "Helical"
with temp_grp
End Program
```

The setup stage:

```dim shared pdl as long = 2
Program continue
dim i as long = 1
for i = 1 to 3
attach Axes[i]
' **** Setting Motion Parameters ****
Axes[i].fmode = 0
Axes[i].pemax = 10
Axes[i].pfac = 2^16
Axes[i].vfac = Axes[i].pfac/1000/60
Axes[i].afac = Axes[i].vfac/1000
Axes[i].jfac = Axes[i].afac/1000
Axes[i].VCruise = 1000
Axes[i].vmax = 3000
Axes[i].vospd = Axes[i].vmax * 1.2
Axes[i].velocitysafetylimit = Axes[i].vmax * 1.5
Axes[i].amax = 30000
Axes[i].dmax = 30000
Axes[i].jmax = 300000
Axes[i].acc = Axes[i].amax
Axes[i].dec = Axes[i].dmax
Axes[i].jerk = Axes[i].jmax
Axes[i].simulated = ON
detach Axes[i]
next
call SetGroup
terminate Program
```

The used subroutine and fumction at setup:

```sub SetGroup
attach
en=0
vord = 100
Print ".... "; ElementName; " - kinematics/geometric setup"
PeMax    = 1  ' follwing error in mm (envelope)
smooth  = -1
prftype = 1
vfac    = 1/1000
afac    = vfac/1000
jfac    = afac/1000
vmax = max(j1.vmax,j2.vmax)
amax = max(j1.amax,j2.amax)
dmax = amax
decstop = 1.1*dmax
jmax    = max(j1.jmax,j2.jmax)
PositionErrorDelay    = pdl
abs = 1
vcruise = 0.5 * Vmax
acc = amax
dec = dmax
jmax = 10*amax
jerk= jmax
PositionErrorSettle = 0.1 ' 100um
BlendingMethod = 0
configgroup
detach
end sub
```
```function max(byval a as double, byval b as double ) as double
if a > b then
max = a
else
max = b
end if
end function
```

And the actual program:

```dim shared circle_center[8] as joint of XYZ
program
dim index as long = 1
attach
?VesExecute(" sys.Motion= ON")
call InitBuffer
abs = 1
en =1
move {0 , 0 , 0} vcruise = 100 acc= 3000
move {25 , 0 , 0} vcruise =100  acc= 3000
call StillMoving
record test11.rec 100000 gap =1 recdata = pcmd{1} , pcmd{2}, pcmd{3}
recordon
' Start "helical"
for index = 1 to 8
Circle  Angle = 180  CircleCenter = (circle_center[index]+ {0,0,index*5})   Vtran = 500 CirclePlane = PLANE_XY
call StillMoving
print "Position" , pcmd , index
next
sleep 10
recordclose
detach
end program
```

The used subroutines:

```sub StillMoving
while ismoving <> 0
sleep 1
end while
end sub
```
```sub InitBuffer
dim index as long
for index=1 to 8 step 2
circle_center[index] = {0,0,0}
next
for index=2 to 8 step 2
circle_center[index] = {12.5,0,0}
next
end sub
```

The results: