Author Topic: How does CNC _actually_ work?  (Read 401 times)

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1857
  • Country: gb
How does CNC _actually_ work?
« on: April 14, 2017, 12:02:52 PM »
OK, that might seem like an odd (and pretty wide) question.... so let me boil it down by way of a couple of examples...

Let's say I wanted to machine a straight line between the position my cutter is at now, and another position which is 10 inches away at an angle of 14.8 degrees (some nice random numbers there...)

I'm assuming that the controller figures out that for every N steps in the X-direction, there must be 1 step in the Y-direction. But how does it then apply this to the controller? Does it literally move N steps in the X-axis, then 1 step in the Y, repeat until we arrive at our destination? If N is not a whole number, presumably it keeps track of the remainder & occasionally moves 1 step in the Y axis at N-1 steps, or N+1, or whatever.

OK, so next question... This time we need to move in an arc. I can't remember exactly what my machine requires to machine an arc (in polar coords), but let's say it takes the distance around the arc, and the radius - and the start point, which is the current cutter position. I'm assuming(!) that the controller, in this case, "chops" the arc into hundreds or thousands of little straight lines, then applies the same logic as above (N X-steps, 1 Y-step, or 1-X step, N Y-steps, whatever), would that be correct?

So... my final question... but first, a bit of setup...

Imagine an upside-down "V" shaped pair of identical length arms. Linked together a bit like a pantograph, but in the vertical axis. As the angle between arm "A" and the bed changes from zero (flat) and 90 degrees (dead upright), the angle between arm "A" and arm "B" changes from 180 degrees to zero degrees. i.e. the joint between the arms is always at the exact mid-point of the distance between the arms.

With me so far? Then I shall continue...

Imagine arm "A" is mounted at the centre of a rotary table. It can be rotated between 0 and 180 degrees, where 0 points due south, and 180 points due north.

If the arms were 1 meter long, therefore, at maximum extension the far end of arm "B" would describe a semicircle some 2 meters in radius. Depending on how close in one could get, this gives us a reasonable working rectangle of 1.5 x 2.5 meters, with a little reserve left in the tank.

Anyway, assuming you've got this far.... does anyone have any idea of what the maths would be to convert that straight line, or (worse) the arc, into the 2x angles needed to drive such a contraption?



Postscript: This is the sort of thing that happens when you've got all day to yourself, and no workshop to play in... I've been following Andrew Mawson's CNC plasma adventures with much tool envy... but, with the best will in the world, I just don't have room for a flat-bed CNC plasma cutter, even a home made one. Well, unless I can hang it on the wall maybe...  So. my hyperactive mind thinks: Robot arms... if you made it compact enough, in theory it would take up very little space when "parked", and could be more or less bolted to a regular bench when in use. Yes, you still need the space when it's actually being operated; but that can usually be arranged. For storage, it all folds up and out of the way...  With this in mind, I figured if it were accurate to the nearest 1mm, that's probably close enough for plasma work; in fact, in the "distance" angle, a resolution of 0.01 degrees allows precision no worse than 0.3mm per step at the full 2m stretch. I haven't figured the rotation accuracy yet, but I'm assuming it'd be similar. This would be fairly easy to achieve using a 10:1 driver & 36-position rotary encoder. And beyond that... I haven't thought any further yet. Thought I ought to get some knowledge about how CNC systems actually work first. Hence, the question :)
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Or: Zhengzhou, China. An even longer way from anywhere...
Skype: adev73

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5090
  • Country: gb
  • East Sussex, UK
Re: How does CNC _actually_ work?
« Reply #1 on: April 14, 2017, 01:30:19 PM »
Ade,

Cutting straight to the end of your post - GRAVITY is your issue with a vertical table - the bits need to fall away from the cut without snagging on your expensive plasma torch and breaking it. I went through this thought process when I actually HAD a professional welding hardened robotic arm, but discounted it due to Newtons Apple.

I have seen a design for a tilting table - used horizontal and folds like a Z-Bed into the upright position to take less storage space, but I suspect it wouldn't be very rigid  :scratch: You need a table that is pretty stiff and firm to cut reasonable detail.
Andrew Mawson
East Sussex

Offline philf

  • Hero Member
  • *****
  • Posts: 746
  • Country: gb
Re: How does CNC _actually_ work?
« Reply #2 on: April 14, 2017, 02:37:37 PM »
Ade,

I assume that you're describing something like:



Any point within a 2m rad circle will have (or I think they will have) coordinates as follows:

X = 2 * A * COS(V) * COS(R)
Y = 2 * A * COS(V) * SIN(R)

You wouldn't get away with just specifying the two end points of your straight line and expecting the end of arm B to describe a straight line.

Phil.
Phil Fern
Location: Marple, Cheshire

Offline mc

  • Jr. Member
  • **
  • Posts: 6
Re: How does CNC _actually_ work?
« Reply #3 on: April 14, 2017, 03:19:31 PM »
It all depends on the controller.

Something like Mach 3 which doesn't have any kind of built in non-linear kinematics, you would need some method to generate the required G-code to generate the required motion, whereas something like a KFlop you can program to handle the non-linear kinematics internally, and simply provide it with your usual Cartesian coordinates (XYZ) for the movement.
I think LinuxCNC and Mach 4 are also able to handle non-linear kinematics, but you'd have to check.

To given an example of the KFlop doing it, here's a video of Dynomotion's Geppetto 6-axis demonstration robot-
https://www.youtube.com/watch?v=MSONYPXe3bE
If you run full screen, you'll see the g-code being run only contains XYZ moves. The moves get transferred to the KFlop, which then handles all the kinematic calculations before moving the required motors/axes to achieve the movement. I think the hardest part of these kind of setups is making sure the required kinematic calculations are correct, but philf has already provided the basics.

This video may be a bit more suitable for what you're thinking, but it only shows the movement, not the code being run -
https://www.youtube.com/watch?v=MV42zmiT_4I

Offline PK

  • Full Member
  • ***
  • Posts: 240
  • Country: au
Re: How does CNC _actually_ work?
« Reply #4 on: April 14, 2017, 05:42:53 PM »
Quote
Something like Mach 3 which doesn't have any kind of built in non-linear kinematics,
I've used mach3 to control a mates scara arm with a grab on the end. You can key in formula that compute output positions for real axii (usually the rotary ones) based on X and Y.
Might have a pic somewhere....

Offline mc

  • Jr. Member
  • **
  • Posts: 6
Re: How does CNC _actually_ work?
« Reply #5 on: April 14, 2017, 05:53:30 PM »
Quote
Something like Mach 3 which doesn't have any kind of built in non-linear kinematics,
I've used mach3 to control a mates scara arm with a grab on the end. You can key in formula that compute output positions for real axii (usually the rotary ones) based on X and Y.
Might have a pic somewhere....

I thought Mach 3 had limitations on what it could do?
It could be I'm mixing it up with some other feature (geometric corrections?), as it's not something I've ever paid much attention to.

Regardless, what the OP wants to do is achievable.

Offline PK

  • Full Member
  • ***
  • Posts: 240
  • Country: au
Re: How does CNC _actually_ work?
« Reply #6 on: April 14, 2017, 06:16:14 PM »
I thought Mach 3 had limitations on what it could do?
I admit it was some time ago, so I just went out to the shed and checked.

Function Cfgs->Formulas, whilst notionally for screw pitch error correction and bed leveling, allows you to implement arbitrary kinematics..

LinuxCNC can do it too. We can (but don't) program this in an XYZAB space.
<a href="http://www.youtube.com/watch?v=3g9bU17gxf4" target="_blank">http://www.youtube.com/watch?v=3g9bU17gxf4</a>

Quote
Regardless, what the OP wants to do is achievable.
Agreed.
« Last Edit: April 15, 2017, 02:02:16 AM by PK »

Offline RodW

  • Full Member
  • ***
  • Posts: 100
  • Country: au
    • Vehicle Modifications Network
Re: How does CNC _actually_ work?
« Reply #7 on: April 14, 2017, 06:44:56 PM »
You should read this LinuxCNC page on kinematics.
http://linuxcnc.org/docs/html/motion/kinematics.html

There are some simulators in the default Linuxcnc installation  for various robot arms etc that allow you to command a 3d drrawing of the machine on screen but i have not played with them.
As far as gravity and a vertical plasma table  all you need to do is to tab your parts which  is supported in sheetcam.
RodW
Brisbane, Australia

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1857
  • Country: gb
Re: How does CNC _actually_ work?
« Reply #8 on: April 14, 2017, 11:22:54 PM »
Many thanks for all the replies! Seems others were waaay ahead of me - I had no idea that there were controllers out there with reprogrammable kinematics. Cool! Now all I need to do is work out the formulae.... that should take me most of a day at least :D

Andrew - yes, gravity... I've been bitten by it more than once! As Rod says, leave tabs to keep the piece in place & free it with an angle grinder is one option. Problem is, even with a vertical table, it's going to take a fair amount of room; fume extraction is difficult, there's a very real danger of setting fire to the building (OK, you'd put a backplate behind it to stop the sparks...), and I'm still not sure I've actually got room for it.

I see my "robot arm" (TBH that's being generous to it) being something that stands unobtrusively out of the way when not being used, then gets dragged into the middle of the room, attached to a bench & used once in a while. I'll still need some kind of bed to hold the metal while it's being cut; but this doesn't need to be anything like as fancy as yours. I'm thinking a lightweight ali box with a few curved slats to hold the sheet being cut, and some way of clamping it down (magnets?) whilst its being cut.

Maybe I've been watching too many of those "Make it Extreme" videos...  :lol:
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Or: Zhengzhou, China. An even longer way from anywhere...
Skype: adev73

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5090
  • Country: gb
  • East Sussex, UK
Re: How does CNC _actually_ work?
« Reply #9 on: April 15, 2017, 03:29:15 AM »
Beware of magnetic hold downs, they deflect the plasma jet so it doesn't cut where you want it to.

A while back someone developed a device with two axis's that clamped to the plate of steel being cut, and was CNC controlling the movement of an oxy-acetylene torch. Basically just two beams mutually at right angles with an appropriate carriage.OK it had relatively small operating envelope, but handy on site never the less. I seem to remember that they were hugely expensive.  No reason it couldn't carry a plasma torch.
« Last Edit: April 15, 2017, 08:21:43 AM by awemawson »
Andrew Mawson
East Sussex

Offline russ57

  • Jr. Member
  • **
  • Posts: 54
Re: How does CNC _actually_ work?
« Reply #10 on: April 15, 2017, 08:18:00 AM »
AvE (YouTube) recently described something a bit like you are talking about, but still horizontal. Packs away, as it doesn't have a table.


-russ


Offline PekkaNF

  • Hero Member
  • *****
  • Posts: 1603
  • Country: fi
Re: How does CNC _actually_ work?
« Reply #11 on: April 15, 2017, 01:31:44 PM »
just thinking here aloud on alphanumerals....polar cordinates are ok with bearings....but gears and position sensors are harder than you think prior taking pen and paper and then industrial robot sounds really good.

I don't know about plasma much, then ones I heard have water table.

But if you solve the "table" and bolt down the plate both cut and off-cut - why not? After all direction of the gravity does not change.

Slight angle might help. Is there anything to learn from vertical panel saw?
http://www.productiq.com/DesktopModules/ProductIQ/Shared/ProductImage.aspx?Large=1&ProductId=75637

http://www.dbkeighley.co.uk/images/koolkut_kk12.jpg


Pekka