make a arc mid-point coördinaten for kuka robot

Having problems with or questions about SheetCam? Post them here.
Post Reply
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

make a arc mid-point coördinaten for kuka robot

Post by dinosar »

]Hello, i have try to get the arc center/ midpoint coördinaten but i dont know how i can get
its for an kuka robot arm the straight lines will work but on an Circular move the robot will run away

i need to place acr midle point and arc end point the start point is where the robot is already

this i need to get
CIRC {X 50,Y 55,Z -5,A 0,B 0,C 0} , {X -5,Y 0,Z -5,A 0,B 0,C 0} C_DIS
this is what i get from sheetcam
CIRC { X -55, Y -0, Z -5.0000 } , { X -5.0000, Y 0.0000, Z -5.0000 }
this example is a half circle of 100mm wide with a tool diameter of 10mm

Code: Select all

function OnArc()
   if(arcAngle <0) then
      post.Text ("CIRC {")
   else
      post.Text ("CIRC {")
   end
      local needComma = false
      
   if(arcCentreX < 1e17) then
      post.Text(" X ")
      post.Number ((arcCentreX - currentX), "0.##")
      needComma = true
   end
   
   if(arcCentreY < 1e17) then
      if(needComma) then post.Text(",") end
      post.Text(" Y ")
      post.Number ((arcCentreY - currentY), "0.##")
      needComma = true
   end
      if(endZ < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Z ")
      post.Number(endZ * scale,  "0.0000")
      needComma = true
   end
   
   post.Text (" } , { ")


   if(endX < 1e17) then
      post.Text(" X ")
      post.Number(endX * scale,  "0.0000")
      needComma = true
   end
   if(endY < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Y ")
      post.Number(endY * scale,  "0.0000")
      needComma = true
   end
   if(endZ < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Z ")
      post.Number(endZ * scale,  "0.0000")
      needComma = true
   end
   post.Text (" }\n")
   post.ModalNumber ("$VEL.CP=", feedRate * scale, "0.0###\n")
   post.Eol()
   
end


this is what the robot need to do on an Circular move

CIRC – Circular – Motion at a defined velocity and accerlation along a circular path or a portion of a circular path. This motion requires the programmer to “teach” two points, the mid-point and the end point. Using the start point of the robot (defined as the end point in the previous motion command) the robot interpolates a circular path through the mid-point and to the end point
Attachments
Kuka.scpost
(4.47 KiB) Downloaded 50 times
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by Les Newell »

Do you need absolute or or relative arc center points? Your code outputs the arc center relative to the start point.
A couple of extra thoughts - you don't need to check if the coordinates are less than 1e17 when cutting arcs. 1e17 indicates the number is unknown. This can only happen for the first few rapid moves.
If those trailing zeros are a problem use the number format "0.##". This only puts in trailing digits if they are needed.
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

i need the a absolute position of the arc center point
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by Les Newell »

Where you have code like this:

Code: Select all

post.Number ((arcCentreX - currentX), "0.##")
Change it to:

Code: Select all

post.Number (arcCentreX, "0.##")
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

did not work it neet the center position from X and y zero location

https://www.youtube.com/watch?v=HEanVlT ... andarTomic like on this video

if i will make a half circle of 100mm and i start the circle on X100 Y100 the center point will be X150 Y150 and the end point will be X200 Y100

but i dont know how i can get this out sheetcam most machines use I and J code

Image
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by Les Newell »

Did you change the code for the Y arc centre as well?

If your robot has plenty of memory you could get the post to break arcs into lots of short lines. Replace your function OnArc() with this one:

Code: Select all

function OnArc()
   post.ArcAsMoves(0.1)
end
Increasing the number will reduce the number of lines of code but it will also reduce accuracy.
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

yes this will work is it also possible to change arcCentreY to anyting else that it will take for the center real x and y coördinaten
now with post.ArcAsMoves(0.1) it is indeed too busy for the memory

Code: Select all

post.Number ((arcCentreY), "0.##")
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by Les Newell »

I found a Kuka manual and I now see what the problem is. The reference point is a point on the arc other than the start or end point. It is not the centre point. Give the attached post a try.
Attachments
Kuka-2.scpost
(3.83 KiB) Downloaded 53 times
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

i have try works good thank you very much
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

Les Newell wrote: Tue Sep 22, 2020 9:40 am I found a Kuka manual and I now see what the problem is. The reference point is a point on the arc other than the start or end point. It is not the centre point. Give the attached post a try.
i see today that on an circle this will not work beause the start and endpoint will be the same i see on other cadcam post it will be make a circle with 2 start and 2 end points to make an compleet circle 2 time a half circle

if i make a jet cutting and use microcut the circle will be cutted but on milling i dont get started beause start and end point are the same

from other cadcam

Code: Select all

LIN {X 197.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS
CIRC {X 100,Y 197.5,Z -2.5,A 0,B 0,C 0} , {X 2.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS
CIRC {X 100,Y 2.5,Z -2.5,A 0,B 0,C 0} , {X 197.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS
from sheetcam

Code: Select all

LIN { X 100, Y 2.5, Z -2.5}
CIRC { X 100, Y 197.5, Z -2.5 } , {  X 100, Y 2.5, Z -2.5 }, CA 360
User avatar
Les Newell
Site Admin
Posts: 3660
Joined: Thu May 11, 2006 8:12 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by Les Newell »

This should fix it.
Attachments
Kuka-3.scpost
(4.21 KiB) Downloaded 59 times
dinosar
Posts: 13
Joined: Sun Apr 26, 2020 1:27 pm

Re: make a arc mid-point coördinaten for kuka robot

Post by dinosar »

yes now it works fine i have set THE CA function off
it was not necessary to mention this sometimes it changes to - if it is + and vice versa then the robot will walk the other way

thank you very much for the support :mrgreen:
Post Reply