4th Axis rotation angle limit problem

More
16 Apr 2012 17:43 - 16 Apr 2012 17:45 #19251 by SvenH
Thanks Andy,
I am very happy to have something new to try!

Should I use a different g-code to set speed and turn the 4th axis to "on"?

On a side note, would it be possible to use both the angular motion and velocity motion without changing to a different machine configuration by restarting LinC
Last edit: 16 Apr 2012 17:45 by SvenH.

Please Log in or Create an account to join the conversation.

More
16 Apr 2012 18:56 #19253 by andypugh
SvenH wrote:

Thanks Andy,
I am very happy to have something new to try!

Hmm, actually, I am not at all sure that motor-vel-cmd is the right signal to use.
Can you explain what you are trying to achieve? Are you wanting to use the A both as a spindle and as an axis? If that is the case then you might want to run two independent stepgens, and connect/disconnect them from the actual driver (in software) as required.

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 05:19 #19292 by SvenH
I think the same as the OP, use my 4 axis mill to do some lathe like turning.*

I want to set my a-axis to "on" (degrees per minute) at the start of the program, then do some milling and at the end, turn 4th axis off.

Just as OP mentioned, I only see the option of breaking up the current code in to small segments as the only way you can get the 4th move together with other axis is to have the movements programmed on the same line.



* if this is not what OP wants I'll open another post but it seems he and I want the same result.

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 10:17 #19305 by andypugh
SvenH wrote:

Just as OP mentioned, I only see the option of breaking up the current code in to small segments as the only way you can get the 4th move together with other axis is to have the movements programmed on the same line.


Linking the A-axis stepper drive to an extra velocity-mode stepgen, with velocity supplied from a G-code M68 command would be a possibility.

One way to achieve this would be to use a custom M-code to rewire the HAL (for example M100 could delete the connections between the parport pins and the position-mode stepgen, and re-wire them to the velocity-mode one, and M101 could reverse that process).
Alternatively I can imagine doing it purely in HAL with logic blocks, though that might get unwieldy.

Unless you are doing production work it might be simpler to create two machine configs, one in which the A-axis is controlled as a spindle with speed controlled from the S-word (assuming that you intend to use a fixed lathe-like tool) and another for conventional milling. Just load the config you need for the operations you want to perform. My combo mill/lathe works this way. If you create a lathe-mode configuration you will even get lathe-mode preview in Axis, and tool shape etc.

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 11:19 #19308 by SvenH
andypugh wrote:

Linking the A-axis stepper drive to an extra velocity-mode stepgen, with velocity supplied from a G-code M68 command would be a possibility.

One way to achieve this would be to use a custom M-code to rewire the HAL (for example M100 could delete the connections between the parport pins and the position-mode stepgen, and re-wire them to the velocity-mode one, and M101 could reverse that process).
Alternatively I can imagine doing it purely in HAL with logic blocks, though that might get unwieldy.

Unless you are doing production work it might be simpler to create two machine configs, one in which the A-axis is controlled as a spindle with speed controlled from the S-word (assuming that you intend to use a fixed lathe-like tool) and another for conventional milling. Just load the config you need for the operations you want to perform. My combo mill/lathe works this way. If you create a lathe-mode configuration you will even get lathe-mode preview in Axis, and tool shape etc.[/quote]

I had been looking for information about custom M-code after looking in to 3D printer software which also has to turn a stepper on and off. After seeing the M- code I thought that might be the way to go but I could not find the info that explained the basics.

I guess that part of the problem is that I do not have a technical background+ I am non native in English. Both of them separate never seem to be a problem but the two combined make for hard searching...

So if I understand correctly:

With the use of M-code I could tell the controler to use a different setting, actually turning the position guided axis in to a velocity axis and turning it back in to position if I need it.

I have the 4 axis setup working, is there any info available on how I can set up and use M100 codes for the purpose of setting the 4th to spin?

I indeed intend to use this in a production environment but for now just having it run to check if I can actually make what I need is fine.

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 11:56 #19309 by andypugh
SvenH wrote:

With the use of M-code I could tell the controler to use a different setting, actually turning the position guided axis in to a velocity axis and turning it back in to position if I need it.
I have the 4 axis setup working, is there any info available on how I can set up and use M100 codes for the purpose of setting the 4th to spin?


This is all guesswork, as I don't have LinuxCNC here, I will try to find the time to have a fiddle with both methods tonight.

However, it is likely to involve a script something like:
File M100:

#! /bin/bash
halcmd unlinkp parport.0.pin-01-out
halcmd unlinkp parport.0.pin-02-out
halcmd net vel-mode-step => parport.0.pin-01-out
halcmd net vel-mode-dir => parport.0.pin-02-out

and
File M101:

#! /bin/bash
halcmd unlinkp parport.0.pin-01-out
halcmd unlinkp parport.0.pin-02-out
halcmd net pos-mode-step => parport.0.pin-01-out
halcmd net pos-mode-dir => parport.0.pin-02-out

I think that doing it this way avoids following-errors. You would use M101 in the G-code to set one mode, and M100 to set the other.

Alternatively it is probably possible to build a structure of AND and OR gates in HAL to do it:
In this case you would use M64 P0 to set one mode, and M65 P0 to set the other. (M64 / m65 turn on and off the HAL pins called motion.digital-out-NN where NN is the P-number)

(This is done blind with no LinuxCNC to check with, you might want to draw out the logic diagram :-)
loadrt and2 count=4
loadrt or2 count=2
loadrt not count=1

addf and2.0 base-thread
addf and2.1 base-thread
addf and2.2 base-thread
addf and2.3 base-thread
addf or2.0 base-thread
addf or2.1 base-thread
addf not.0 base-thread

net lathe-mode motion.digital-out-00 => not.0.in and2.0.in0 and2.1.in0
net lathe-mode-not  not.0.out => and2.2.in0 and2.3.in0

net rot-mode-step stepgen.3.step => and2.2.in1
net rot-mode-dir stepgen.3.dir => and2.3.in1
net lathe-mode-step stepgen.4.step => and2.0.in1
net lathe-mode-dir stepgen.4.step => and2.1.in1

net rot-mode-step-switched and2.2.out => or2.0.in0
net lathe-mode-step-switched and2.0.out => or2.0.in1
net step-out or2.0.out => parport.0.pin-00-out

net rot-mode-dir-switched and2.3.out => or2.1.in0
net lathe-mode-dir-switched and2.1.out => or2.1.in1
net dir-out or2.1.out => parport.0.pin-01-out

References:
www.linuxcnc.org/docview/html/man/man9/and2.9.html
www.linuxcnc.org/docview/html/man/man9/or2.9.html
www.linuxcnc.org/docview/html/man/man9/not.9.html
www.linuxcnc.org/docview/html/man/man9/motion.9.html
www.linuxcnc.org/docview/html/hal/basic_hal.html

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 12:07 #19310 by SvenH
Thanks andy!

If i read it correctly this is just to change the mode, what do I put in my g-code to spin the 4th axis?

Is it something like this?
M100 (change to velocity mode A axis)
A2000 (turn a axis on to 2000degrees a minute)

(do some other movements)

A0 (turn a axis on to 0 degrees a minute)

M101 (change to position mode A axis)

And the M100 and M101 files go in to the same folder as the other configuration files I use for this machine?

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 12:28 - 17 Apr 2012 12:52 #19311 by andypugh
SvenH wrote:

M100 (change to velocity mode A axis)
A2000 (turn a axis on to 2000degrees a minute)


No, that won't actually work.
Assuming that you have net-ed axis.3.position-cmd to both stepgen.3.pos-cmd and stepgen.4.vel-cmd (guessing pin names here) then the effect of your code above would be to ramp the speed of stepgen.4 to 2000 deg/min at the current feed rate, which probably isn't what you want. (the value of the axis-pos-cmd pins is controlled by the motion controller, and follows trajectory limits and feed rate.

You probably either want to use an analog out (motion.analog-out-00 and M68 E0 Q2000) or to route the motion.spindle-speed-out pin to both the stepgen velocity input and the spindle control (it probably needs to be swapped, if you don't want the milling spindle to turn when in lathe mode) and then you can set the A-axis speed with the S-word.
Last edit: 17 Apr 2012 12:52 by andypugh.

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 12:50 #19312 by SvenH
Oe, that is dazzling :)

Let me give some of my basic here I left those out before:

XYZA configuration, nothing else configured yet (though I did try).
Spindle turned on manually

Want to try out milling acetal bearings with the 4th set up as a C-axis.
I have the contour ready to be milled in XZ plane and it shows up in axis.

I want to get my C axis to turn before the XZ movement starts and keep on turning untill all XZ movement is done.

It would be awsome if I could switch between position mode and velocity mode as it would open up a lot of problem solving options but for now I need to test if I can even make the bearings I have to make.

What do you think would be the quickest/best way to get there?

Please Log in or Create an account to join the conversation.

More
17 Apr 2012 12:56 #19314 by andypugh
SvenH wrote:

What do you think would be the quickest/best way to get there?

Create a config where a velocity-mode stepgen has the velocity cmd linked to spindle speed. Then use M3 / M4 / M5 and S to control that axis. You can do this easily if you have a manually-switched milling spindle.

Please Log in or Create an account to join the conversation.

Time to create page: 0.200 seconds
Powered by Kunena Forum