# Machsupport Forum

## Mach Discussion => General Mach Discussion => Topic started by: bfairey on August 01, 2009, 03:32:34 PM

Title: 4th axis
Post by: bfairey on August 01, 2009, 03:32:34 PM
How do I setup and program my 4th (rotary) axis?
Brian.
Title: Re: 4th axis
Post by: olf20 on August 01, 2009, 06:53:40 PM
Hi Brian, here is a link to a thread. Lots of information.

http://www.machsupport.com/forum/index.php/topic,5281.0.html

Reply 14 has details which I use.

There are several ways to do this depending on your particular machine,
and needs.

Hope this helps!
olf20 / Bob
Title: Re: 4th axis
Post by: Chip on August 01, 2009, 08:41:50 PM
Hi, Brian

Pic's below should get you started, There are a couple of ways to set up Steps Per, Hears 1 way, Determine the number of steps it takes to turn 1 complete turn and divide it by 360, That will give you steps per "Deg.", Enter it as your Steps per value in motor tuning.

Example: Stepper motor 200 steps X 10 micro step driver = 2,000 X 72 turn rot. table = 144,000 steps for 1 turn / 360 = 400 steps per Deg.

It all sounds confusing, Give it a shot and ask more Question's as needed.

Chip
Title: Re: 4th axis
Post by: Cartierusm on August 06, 2009, 07:11:03 PM
Howdy, I just setup my 4th axis today and I had a couple of questions.

Chip, on the Settings Tab that your pictured is that where you put in the diameter of the stock you're working with? If so how does it know if you are using a complex piece that's been made on a lathe with lots of curves that you want to engrave? For your info I think I'll be using 4th Axis option in my RhinoCam so maybe that takes care of that?

Also I'm a bit confused on the calculation, well not confused I understand them but confused on the operation. I have a pulley system as I adapted a spare Lathe Head, just hooked up some timing pulleys and a stepper. I used an online pulley calculator to detemine I have a .416 ratio, which means that it takes 2.4038 turns of my stepper to turn the 4th axis 1 revolution. Now if I go by your calculations I take that and times that by my 2000 steps per revolution of my stepper (200x10microsteps) and then divide by 360, I get 13.354. Now if I put that into my Motor Tuning and then jog it goes real slow, but if I go the full amount 2.4038*2000=4807.6 then it moves at a good rate. Is it supposed to turn slow?

Last question on the first picture above, does that need to be checked for all situations or is that if you are substituting an axis Letter in your G-code? I'm going to be using RhinoCam which has 4th axis support so not sure if it will output it as "A"?

Thanks.
Title: Re: 4th axis
Post by: olf20 on August 06, 2009, 08:10:29 PM

If you have your system setup as A being your rotary you can only use it as rotary / degrees,
If I understand it correctly.

Here is a quote from Art;
You have it right. You cannot do arcs other than in the XY plane, XZ plane or YZ plane. There is no conceptual plane for
a rotary axis. The checkbox for linear/angular only tells an axis not to convert when switching from mm to inch, other than that it
has no purpose. A, B and C are always rotary axis.. So using an IJ with an A axis is an error in syntax, though still legal, the missing Y in this case would simply be interpreted as the current Y location, and the A would just be a linearised motion on that axis during the movement of the XY
in the XY plane arc.

As I do not have any software that supports 4Th axis / A I chose to have my rotary to be driven by my Y axis.
This is where the post that I referred to comes into play.
I'm sorry if I'm not explaining this very well. I'm somewhat new to it all but have got great result with mine so far.

olf20 / Bob
Title: Re: 4th axis
Post by: Cartierusm on August 06, 2009, 08:28:46 PM
I just tried running a file I made in RhinoCam and it moves really slow, I mean it would take 20 hours for it to do anything, so there is something or some setting wrong. Here are my XML and the Gcode.
Title: Re: 4th axis
Post by: Greolt on August 06, 2009, 09:50:52 PM
I ran your code.  5ipm is kinda slow anyway but I am guessing that was intentional.

Play around with the "Rotation Diameters" on the settings page (which I think should read "Rotation Radius")

Every time I think I have a good grasp of what it does there, something comes up to say I have not.  :D

What I think it does, is take the Z DRO value and add it to the Diameter (radius) setting and adjust the A axis feed rate to suit that total.

So if you have Z zero at the centre of rotation then set the "Rotation Diameter" to near zero.  (not zero or it will not work)

And if your Z zero is at the cutting radius then set that as the "Rotation Diameter"

I am very ready to be set straight if this interpretation is incorrect.  :D

Greg
Title: Re: 4th axis
Post by: Cartierusm on August 06, 2009, 10:23:06 PM
Yeah thanks, that confused me even more LOL. I'll reread what you said. I was doing 5IPM because I was engraving with a fine bit.

So I have my parts center as the center so it should be going to like 1.2" up and cutting but it doesn't do much. I'll mess with the settings.
Title: Re: 4th axis
Post by: alenz on August 07, 2009, 12:18:20 AM
Yeah thanks, that confused me even more LOL. I'll reread what you said. I was doing 5IPM because I was engraving with a fine bit.

So I have my parts center as the center so it should be going to like 1.2" up and cutting but it doesn't do much. I'll mess with the settings.
Greg has you on the right track.  Here in a nutshell is what’s required.

In Config> General Config be sure ‘Rot 360 Rollover’ is NOT checked. (Your code uses both pos and neg A values).

In Config> ToolPath select the ‘X-axes’ button; check ‘A-Rotations Enabled’ and check ‘Use Diameter for Feedrate’.

On the Settings page you have a choice with the ‘Rotation Diameter’ DRO. Unfortunately due to a problem within Mach, neither is accurate, but in your case one is better than the other.

If you enter 0.0001 in the DRO then Mach will read all Z values as a diameter and calculate the feed rate accordingly. Obviously, this is incorrect as the Z is actually a radius. The angular component of your X-A move will be off by a factor of 2. Probably not acceptable.

If you enter the Z value that is in the first block containing a Z then in this case (and in this case only) Mach will correctly use this value as a radius. However changes in Z will be incorrectly interpreted as a change in diameter thus creating another error. But this error is less and in fact wouldn’t even be noticeable if your Z clearance height were reduced. (Less change in Z; less error). Is there a reason that you need over an inch of Z clearance? (I normally use something more in the order of 0.050).

Another thing, your code uses only   G01 (no G00), although it does increase the feed from F5 to F20 for the rapids. You may find it more convenient to use G00 for the rapids and thus only have to set the Feed rate once at the beginning. Easier to make changes.

Is it just me, or are you engraving a mirror image?

Hope this helps,
Al
Title: Re: 4th axis
Post by: Cartierusm on August 07, 2009, 12:57:28 PM
No I'm not engraving a mirror image, it's just my name on a round piece of stock. I don't need an inch of clearance, from the tutorial in RhinoCam it says to make the center of the round stock the center. Should I move my part in Rhino Down so the top facing the milling bit is Zero? I'd prefer that way so I can just do a touch off of Z for my Z-Zero.

What I don't understand is that rotational diameter, I don't have to understand it to use it, so I shouldn't put a value of .0001 in, but I should put in the value of the first Z block in my code. So if I set the top of my stock to zero with my bit and the first depth in my Gcode is .005, which is as deep as I'm going with my bit, then this will work?

Thanks.
Title: Re: 4th axis
Post by: Cartierusm on August 07, 2009, 02:13:02 PM
OK some of the settings I did or didn't have checked, now it's working in a more normal way. What confuses me is the motor tuning I came up with 13.3547 steps per degree. After I set my accel and velocity the velocity reads 47,470 and the acceleration reads 3450, and when I jog in normal more it says the FRO is 449. I don't care if it's high if that's just a bug but I want to make sure that's normal?
Title: Re: 4th axis
Post by: Cartierusm on August 07, 2009, 03:19:46 PM
OK, some success. I did get the 4th running and figured out all the weird things you have to do. I actually engraved a test piece, but as Alenx suggested it is cutting a mirror image, why would that be I have a feeling it must be in Rhino, I don't think Mach would have anything to do with that. Any suggestions to why that happens?

Also the cuts are not bad but the lines are not super smooth as when I engrave the same text on a flat bar. They seem to have hesitation marks. Is there some setting such as CV that I should do something with to make it come out smoother or is that just the nature of using a 4th axis. I mean if the timing or something else was off it would be noticeable, right?
Title: Re: 4th axis
Post by: Cartierusm on August 07, 2009, 03:40:12 PM
OK I figured out what I think are the problems, first I reversesd the motor and everything comes out normal, this is good but why would Alenx's come out mirrored too, if reversing the motor was the cause? Is Alenx's motor revered too or is there a bigger problem?

Next I think the hesitation marks are from the Z axis moving up and down just slight per the Gcode, when I engrave from my other CAD program the Z, once making a pass, doesn't vary up and down. Why is this program making it go up and down slightly, is it trying to form somthing like when you do 'V' carving and it has to form the tips of letters. Possibly I have a setting wrong in my CAM program. If changed all the Z that are moving slightly to what the final depth should be would that solve the problem?
Title: Re: 4th axis
Post by: alenz on August 07, 2009, 05:30:33 PM
Yes, I would do exactly what you suggest. (I was only trying to work with the code as presented).
Sure, set Z-zero on the surface of the cylinder and the cut depth to minus .005. Enter the actual radius (to split hairs it would be the radius less .005) of the cylinder in the DRO and it should work fine. The error that I referred to earlier will now be when Z is positive and cutting air, so no problem. In fact, this is how I should have suggested in the first place. Your cylinder is constant diameter so no need for mach to recalculate new angular feeds based on dia change. If the cylinder is not constant diameter for the full length, then mach does have the ability to compensate, that is, it keeps track of the Z value and the angular feed in deg/min is decreased as the diameter increases. It only needs one small tweak to be useable and that is to recognize that a change in Z is NOT a change in diameter but a change in radius.

I’m not familiar with RhinoCam but the code does (IMHO) have a few rough edges. I took the liberty of modifying a few lines to illustrate what I’m referring to. It should run faster. That doesn’t make it right or wrong, just a personal preference. The code is not optimized, that is, it jumps back and forth from place to place.

In regard to the mirror image comment, I had to rotate the view in the tool path window so that it could be read from inside the cylinder looking out <grin

Al

PS Try the modified snippet and see what happens.
Title: Re: 4th axis
Post by: Cartierusm on August 07, 2009, 06:11:07 PM
I just tried to set the top of the part at zero instead of at the radius and RhinoCAM doesn't like that, it has to be set at the raidus for center. But I don't care cause I put the actual part on and I crashed the machine hard, oh well a ton of work down the drain. What I did was pause cutting for the last part so I could reset the height because it was cutting a hair to deep, fine for what it was cutting but the last part has to be shallower. When I did "run from here" and the box popped up it said 1.72, OK, then I hit cycle, but it wanted to go to Z-Zero first instead of Z1.72 and it blew right through my part and broke my bit. WTF!!! the pop up box said move to Z1.72 so why did it go to Z0 first????????????
Title: Re: 4th axis
Post by: alenz on August 07, 2009, 06:59:35 PM
That pop-up box has a 'Rapid Height' setting which appears to be zero by default. Set it to a value greater than your current height and it will go that position instead.
Al Lenz