NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum General General LinuxCNC Questions 4th Axis rotation angle limit problem

Welcome, Guest
Username: Password: Remember me

TOPIC: 4th Axis rotation angle limit problem

Re:4th Axis rotation angle limit problem 16 Avr 2012 22:19 #19292

  • SvenH
  • SvenH's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 38
  • Karma: 0
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.
The administrator has disabled public write access.

Re:4th Axis rotation angle limit problem 17 Avr 2012 03:17 #19305

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4245
  • Thank you received: 152
  • Karma: 130
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.
The administrator has disabled public write access.

Re:4th Axis rotation angle limit problem 17 Avr 2012 04:19 #19308

  • SvenH
  • SvenH's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 38
  • Karma: 0
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.
The administrator has disabled public write access.

Re:4th Axis rotation angle limit problem 17 Avr 2012 04:56 #19309

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4245
  • Thank you received: 152
  • Karma: 130
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
The administrator has disabled public write access.

Re:4th Axis rotation angle limit problem 17 Avr 2012 05:07 #19310

  • SvenH
  • SvenH's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 38
  • Karma: 0
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?
The administrator has disabled public write access.

Re:4th Axis rotation angle limit problem 17 Avr 2012 05:28 #19311

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4245
  • Thank you received: 152
  • Karma: 130
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 Avr 2012 05:52 by andypugh.
The administrator has disabled public write access.
Time to create page: 2.640 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.