4th Axis rotation angle limit problem

More
19 Apr 2012 13:12 #19374 by SvenH
Andy, you are my newest bestest friend!

The setup works, you have made me very, very happy!
This puts an end to a 3 week puzzle, allowing me to focus on actually trying to get done what I need.

I'll try and put up a video later on.

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

More
15 Sep 2013 07:36 #38847 by pietvr
Hi

Not sure if this thread is still alive.

I am trying to get my 4th axis to spin independently from the spindle (Not using M3, M4 and M5), yet I still want to control the rpm's of the 4th axis. I am trying to spin the 4th axis like a lathe spindle with M-Codes (M120 and stop it with M121) and then pass control back to angular control so I can control its angle with g-code.

Is this at all possible with LinuxCNC?

Any help will be much appreciated

Regards

Piet

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

More
15 Sep 2013 17:56 #38862 by andypugh

Is this at all possible with LinuxCNC?


Almost anything is possible. Some things are harder than others.

Do you just want to run the 4th axis in either velocity or position mode? Do you need it to return to a repeatable position when you return to position mode?

Is this a stepper system or a servo system?

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

More
16 Sep 2013 10:40 #38872 by pietvr
Hi Andy

Thank you for your quick response.

It is a stepper setup.

I need to run the 4th axis in velocity mode to round the work piece initially (without using M3 and M5 as the spindle is using these Mcodes) and when it is round I change to position mode to do indexing all while the spindle is running (I am running it that way in Mach3). I do need rpm's to be set though. I was thinking of using the HAL iocontrol.0.coolant-mist function with M7 and M9 but the speed setting is a problem, but if I cant find another way I will go that route and make the 4thaxis spin at max velocity but I will still need a way to change between velocity mode and position mode

I got the spindle to spin by using and tweaking the HAL settings in this thread but using M3 and M5. I tried to setup an extra axis as b-axis in velocity mode but I was unable thus far to connect the 2 axis to the same step and direction pins, I tried with 2or, but could not get that to work either. I thought I could swap between the two axis by using the M100 and M101 example you used earlier in this thread, but I can not get HAL to work with that either.

When returning to position mode I won't need a repeatable position as the workpiece will then be round and I will just offset A-axis to zero with G92

Regards

Piet

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

More
16 Sep 2013 17:47 #38877 by andypugh

I got the spindle to spin by using and tweaking the HAL settings in this thread but using M3 and M5. I tried to setup an extra axis as b-axis in velocity mode but I was unable thus far to connect the 2 axis to the same step and direction pins, I tried with 2or, but could not get that to work either. I thought I could swap between the two axis by using the M100 and M101 example you used earlier in this thread, but I can not get HAL to work with that either.


To swap the parport pins between two different step generators you would need to use a bit-type mux2 component. Unfortunately the mux2 in the released version is floating-point type and won't even run in the base-thread.
There is a configurable mux in the development branch (linuxcnc.org/docs/devel/html/man/man9/mux_generic.9.html) but that isn't particularly useful if you are not running that version. (However, I think it should be possible to download just that file ( git.linuxcnc.org/gitweb?p=linuxcnc.git;a...3cdadf33dc42830d2fad ) and compile/install it with the comp tool.

For your purposes I think it would be easiest to actually re-wire the HAL in a user-defined M-code ( www.linuxcnc.org/docs/html/gcode/m-code.html#sec:M100-to-M199 )
Assuming that you have loaded stepgens with type=p,p,p,p,v to that stepgens 0 to 2 are the XYZ axes, 3 is position-mode A-axis and 4 is velocity-mode A-axis.
You could have two M-codes. M100 to put the axis in position-mode and M101 P100 to put the axis in velocity mode at a speed of 100rpm.
Some thought would be needed on how to enable the velocity-mode tepgen, otherwise it will tend to spin independently of the rest of LinuxCNC. You might, for example want to wire the stepgen.4.enable to the spindle on/off.

If, for the sake of argument, a-step and a-dir are the signals that connect to the parallel port pins.

M100
#! /bin/bash
halcmd unlinkp stepgen.4.step
halcmd unlinkp stepgen.4.dir
halcmd net a-step stepgen.3.step
halcmd net a-dir stepgen.3.dir
halcmd setp stepgen.4.velocity 0
exit 0

M101
#! /bin/bash
rpm = $1
halcmd unlinkp stepgen.3.step
halcmd unlinkp stepgen.3.dir
halcmd setp stepgen.4.velocity $rpm
halcmd net a-dir stepgen.4.dir
halcmd net a-step stepgen.4.step
exit 0

A appreciate that this may look like a very "linuxy" solution to the problem if you are coming from Mach, calling shell scripts to reconfigure the software.

It would be possible to configure the system to use the G-code analogue outputs (M67) to set the spindle speed, (Or even have the G-code A-command do dual duty... but I feel that "M101 P100" looks just a bit more like a spindle command.
The following user(s) said Thank You: pietvr, joneb

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

More
17 Sep 2013 07:00 #38913 by pietvr
Hi Andy

Thank you very much for the help.

I tried the Mcodes above and according to HALSHOW, the pins gets unlinked and net'ed correctly but the somehow the connection to the partport pins for astep and adir are lost. After unlinking, HALWATCH reports signals to the stepgen.4.count and adir and astep but no signal is shown to my parport pins and the same when relinking to to stepgen.3

I tried unlinking the parport pins and re-net'ing them again in the Mcodes, but no luck either.

When I do a unlink before stepgen.4.dir and step net'ing in my main hal file it works perfectly passing the astep and adir to stepgen.4 and then switching on and of with M100 and M101 (commented out the unlinkp and net'ing) only setp stepgen.4.enable false and stepgen4.enable true and stepgen4.velocity-cmd 100

I am now searching for the reason why the signals are lost to the parport pins, but unable to find a solution thus far.

Regards

Piet

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

More
17 Sep 2013 07:35 #38914 by pietvr
Hi again Andy

I found my mistake my setup "astep" and "adir" and I copied from the thread and pasted as is and here they are "a-step" and "a-dir" :laugh: common mistake with blindly just coping and pasting

I changed velocity to velocity-cmd

Thanks again Andy for the help, much appreciated

I am getting much smoother signals to the steppers with LinuxCNC than with Mach3 resulting in higher max speeds from my steppers, that is why I am in the process of changing to LinuxCNC.

Regards

Piet

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

More
09 May 2015 03:56 #58514 by joneb
Hi I have been trying to get my A axis to work in velocity mode by following the instructions in this post. I seem to have something wrong, it works as normal but not in velocity mode.
I have enclosed my config files if someone could have a look and point me in the right direction. There is a note in the file describing what I have done
Thank you.
Attachments:

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

More
09 May 2015 10:00 #58518 by pietvr
Hi

I have attached my working files - have a look at their set up - to run the spindle in velocity call the code M100 and to stop call M101 - how to use m100 is explained in the m100 file's heading (my volcicity channel is set to Axis5) but it works on a xyza channel setup as well.

Hope it helps

Piet
Attachments:
The following user(s) said Thank You: toplakd, eFalegname, joneb, RobiBobi, wesolowskig

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

More
10 May 2015 14:28 #58531 by joneb
Hi Piet
Thank you for your quick reply, what a difference a space makes.
For anyone else following this post I needed to make the following changes to the the M101 file in Andy's post above.
rpm = $1 should be rpm=$1 (no spaces).
Add the line halcmd setp stepgen.4.enable TRUE
Regards
John

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

Time to create page: 0.163 seconds
Powered by Kunena Forum