realtime independent motor control with linuxcnc
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
10 Aug 2016 06:05 #78559
by giantstone
Replied by giantstone on topic realtime independent motor control with linuxcnc
I see, yes I'm dealing with a variable surface, I'm planning to control the Z axis by one stepper motor, using a camera's feedback to adjust the cutting depth. Andy told me I can do this via a HAL pin called offset, and I'm trying to figure out how to do it starting from 0 knowledge. thanks for your suggestions btw, if you find my camera approach useful to you maybe we can help each other further.
Please Log in or Create an account to join the conversation.
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
10 Aug 2016 08:20 #78561
by giantstone
Replied by giantstone on topic realtime independent motor control with linuxcnc
btw do you know how to control the A axis? I need to keep my blade tangent to the cutting curves.
Please Log in or Create an account to join the conversation.
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
10 Aug 2016 08:29 #78562
by giantstone
Replied by giantstone on topic realtime independent motor control with linuxcnc
hey Andy, I begin to put everything together,
Before I feed the Offset HAL pin in real-time to adjust my Z axis, I need to check the motion mode to be in the mode right before LNC starts cutting things, there are (1: Traverse 2: Linear feed 3: Arc feed 4: Tool change 5: Probing 6: Rotary axis indexing) in total 6 modes. I suppose the mode I'm looking for is between the Traverse mode and a Feed mode. Can I pause the motion when the motion mode changes from Traverse mode to a Feed mode, then adjust the Z axis? How do I do that?
Before I feed the Offset HAL pin in real-time to adjust my Z axis, I need to check the motion mode to be in the mode right before LNC starts cutting things, there are (1: Traverse 2: Linear feed 3: Arc feed 4: Tool change 5: Probing 6: Rotary axis indexing) in total 6 modes. I suppose the mode I'm looking for is between the Traverse mode and a Feed mode. Can I pause the motion when the motion mode changes from Traverse mode to a Feed mode, then adjust the Z axis? How do I do that?
Please Log in or Create an account to join the conversation.
10 Aug 2016 11:08 #78567
by andypugh
Replied by andypugh on topic realtime independent motor control with linuxcnc
Rather than use "offset" for this, given the similarity to torch-height-controlled Plasma have a look at:
linuxcnc.org/docs/2.7/html/man/man9/thc.9.html
The manual page is rather specific to use with a Mesa THCAD board, but the pins:
thc.encoder-vel float in - Connect to hm2_5i20.0.encoder.00.velocity
thc.current-vel float in - Connect to motion.current-vel
thc.requested-vel float in - Connect to motion.requested-vel
Have absolutely no requirement to be ecoder velocities, they can be any floating-point number, such as your optically measured distance.
As a completely separate approach, you could consider this:
wiki.linuxcnc.org/cgi-bin/wiki.pl?ProbeKins
linuxcnc.org/docs/2.7/html/man/man9/thc.9.html
The manual page is rather specific to use with a Mesa THCAD board, but the pins:
thc.encoder-vel float in - Connect to hm2_5i20.0.encoder.00.velocity
thc.current-vel float in - Connect to motion.current-vel
thc.requested-vel float in - Connect to motion.requested-vel
Have absolutely no requirement to be ecoder velocities, they can be any floating-point number, such as your optically measured distance.
As a completely separate approach, you could consider this:
wiki.linuxcnc.org/cgi-bin/wiki.pl?ProbeKins
Please Log in or Create an account to join the conversation.
10 Aug 2016 11:13 #78568
by andypugh
Normally a roation around the Z axis is called a C-axis.
The best way to do this is at the G-code creation stage, adding an C-move to match every XY move. This allows pre-positioning the C-axis before the move starts.
It is possible to calculate the tangent on-the-fly but that approach can't pre-position the axis for the start of a cut.
Replied by andypugh on topic realtime independent motor control with linuxcnc
btw do you know how to control the A axis? I need to keep my blade tangent to the cutting curves.
Normally a roation around the Z axis is called a C-axis.
The best way to do this is at the G-code creation stage, adding an C-move to match every XY move. This allows pre-positioning the C-axis before the move starts.
It is possible to calculate the tangent on-the-fly but that approach can't pre-position the axis for the start of a cut.
Please Log in or Create an account to join the conversation.
10 Aug 2016 13:25 #78572
by Badger
Replied by Badger on topic realtime independent motor control with linuxcnc
I think this topic is on two threads?
To keep the blade tangent research all things "tangent knife". I use "Inkscape" and the extension "gcodetools" and the tool "tangent knife" to generate the rotation of my mechanism to follow the trajectory of the XY moves. Works like a champ. All free opensource software and is supported by helpful folks on the "English Language" section of the forum of cnc-club.ru (Nick rocks). I don't need to be concerned about penetration angles, or sharp turns with the blade deep in the material so I don't know how well those features work or don't work.
There is a way to get LinuxCNC to automatically do the rotation using some "tangent" commands but I think I had problems with it reversing direction to get to the other side 0 degrees which made is less desirable for my project than having the moves in the gcode.
You may want to look at using a reciprocating tangent knife if cutting leather. They are commercially available but probably big bucks.
For height control you may want to look at other distant sensing technology than video. There are various optical and ultrasonic range sensors on sites such as Adafruit and Sparkfun that work with Audrino and such micro-controllers that may work for you.
Lastly what you probably should to do is use a laser. They cut leather like butter, are non-contact so they don't move the material and can cut fine detail adjacent to other cuts.
To keep the blade tangent research all things "tangent knife". I use "Inkscape" and the extension "gcodetools" and the tool "tangent knife" to generate the rotation of my mechanism to follow the trajectory of the XY moves. Works like a champ. All free opensource software and is supported by helpful folks on the "English Language" section of the forum of cnc-club.ru (Nick rocks). I don't need to be concerned about penetration angles, or sharp turns with the blade deep in the material so I don't know how well those features work or don't work.
There is a way to get LinuxCNC to automatically do the rotation using some "tangent" commands but I think I had problems with it reversing direction to get to the other side 0 degrees which made is less desirable for my project than having the moves in the gcode.
You may want to look at using a reciprocating tangent knife if cutting leather. They are commercially available but probably big bucks.
For height control you may want to look at other distant sensing technology than video. There are various optical and ultrasonic range sensors on sites such as Adafruit and Sparkfun that work with Audrino and such micro-controllers that may work for you.
Lastly what you probably should to do is use a laser. They cut leather like butter, are non-contact so they don't move the material and can cut fine detail adjacent to other cuts.
The following user(s) said Thank You: giantstone
Please Log in or Create an account to join the conversation.
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
11 Aug 2016 02:24 #78592
by giantstone
Replied by giantstone on topic realtime independent motor control with linuxcnc
I think the THC Plasma and the Z-offset approach both can do well,
one thing I don't understand is that why not using real-time path tracking algorithms to do all the cuttings,
but to generate G-code for pre-positioning cutting mechanics. In my opinion, with good motor precision path tracking algorithms should produce very nice cut results as well ( and easier to implement/control in my case).
I'm doubting I can make my workstation work within two weeks especially if I need to buy a new physical board. (I have a tight time-line )
one thing I don't understand is that why not using real-time path tracking algorithms to do all the cuttings,
but to generate G-code for pre-positioning cutting mechanics. In my opinion, with good motor precision path tracking algorithms should produce very nice cut results as well ( and easier to implement/control in my case).
I'm doubting I can make my workstation work within two weeks especially if I need to buy a new physical board. (I have a tight time-line )
Please Log in or Create an account to join the conversation.
11 Aug 2016 12:17 #78605
by andypugh
What is your path tracking algorithm tracking?
CNC machines typically follow a pre-programmed path defined by a G-code file. LinuxCNC has a G-code interpreter to support this.
G-code-defied paths have the advantage that the motion controller can look ahead along the path and optimise speed within the mechanical constraints of the physical machine.
If your cutting paths are generated in some other way (you have not given any useful details about that) then it would be entirely possible to skip the G-code layer and feed position commands directly in to the motion control. But then what controls the feed-rate?
Replied by andypugh on topic realtime independent motor control with linuxcnc
one thing I don't understand is that why not using real-time path tracking algorithms to do all the cuttings,
but to generate G-code for pre-positioning cutting mechanics.
What is your path tracking algorithm tracking?
CNC machines typically follow a pre-programmed path defined by a G-code file. LinuxCNC has a G-code interpreter to support this.
G-code-defied paths have the advantage that the motion controller can look ahead along the path and optimise speed within the mechanical constraints of the physical machine.
If your cutting paths are generated in some other way (you have not given any useful details about that) then it would be entirely possible to skip the G-code layer and feed position commands directly in to the motion control. But then what controls the feed-rate?
Please Log in or Create an account to join the conversation.
- giantstone
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 0
11 Aug 2016 13:55 #78612
by giantstone
Replied by giantstone on topic realtime independent motor control with linuxcnc
I generate my cutting paths ( a series of curves, mostly an arc) in the form of a series of coords.
Yes I'm not sure what the feed-rate should be.
but, I figured it out that if I use another driver (independent of linuxcnc) to drive my Z axis and C axis I will be able to achieve my goal very fast with linuxcnc controling the X-Y axis. I use linuxcnc to generate G-code (from depth image) and perform cutting actions; I use motion HAL logic pins to read and control the end-tool's motion mode( pause, Traverse, cutting etcs.) and coords etc. , and meanwhile I publish the motion info to another script ( a ROS node) that controls the Z and C axis accordingly. In this way I don't have to hack a lot HAL pins and configs ( save me a bunch of time).
Therefore, if i figure out how to pause the motion at the right time based on the motion state (1: Traverse 2: Linear feed 3: Arc feed 4: Tool change 5: Probing 6: Rotary axis indexing) , I will be able to run my cuttting station in a foreseeable time.
Could you give me another hint? ( I need to pause the X-Y motion just before and just after cutting a curve.)
If I import linuxcnc in a python scrip, I will be able to read linuxcnc.stat attributes that include (motion_mode (may be the 6 modes mentioned above), state(RCS_DONE, RCS_EXEC, RCS_ERROR.),and coordinates and etcs.
code:
import linuxcnc
s = linuxcnc.stat()
If I then control the read rate of the linuxcnc.stats (running s.poll() at 50 Hz) , store the current motion mode in a variable, and the previous motion mode in another vairable, when I detect a switch between Traverse mode and linear/arc feed mode, I use
c = linuxcnc.command()
c.brake(linuxcnc.BRAKE_ENGAGE) ,c.brake(linuxcnc.BRAKE_RELEASE)
or
c.auto(linuxcnc.AUTO_PAUSE), c.auto(linuxcnc.AUTO_RESUME)
to pause and resume the motion.
If the above "if" all holds, I'm confident to coordinate my C and Z axis with linuxcnc by another script.
Do you think my plan will work well?
Thanks very much
Yes I'm not sure what the feed-rate should be.
but, I figured it out that if I use another driver (independent of linuxcnc) to drive my Z axis and C axis I will be able to achieve my goal very fast with linuxcnc controling the X-Y axis. I use linuxcnc to generate G-code (from depth image) and perform cutting actions; I use motion HAL logic pins to read and control the end-tool's motion mode( pause, Traverse, cutting etcs.) and coords etc. , and meanwhile I publish the motion info to another script ( a ROS node) that controls the Z and C axis accordingly. In this way I don't have to hack a lot HAL pins and configs ( save me a bunch of time).
Therefore, if i figure out how to pause the motion at the right time based on the motion state (1: Traverse 2: Linear feed 3: Arc feed 4: Tool change 5: Probing 6: Rotary axis indexing) , I will be able to run my cuttting station in a foreseeable time.
Could you give me another hint? ( I need to pause the X-Y motion just before and just after cutting a curve.)
If I import linuxcnc in a python scrip, I will be able to read linuxcnc.stat attributes that include (motion_mode (may be the 6 modes mentioned above), state(RCS_DONE, RCS_EXEC, RCS_ERROR.),and coordinates and etcs.
code:
import linuxcnc
s = linuxcnc.stat()
If I then control the read rate of the linuxcnc.stats (running s.poll() at 50 Hz) , store the current motion mode in a variable, and the previous motion mode in another vairable, when I detect a switch between Traverse mode and linear/arc feed mode, I use
c = linuxcnc.command()
c.brake(linuxcnc.BRAKE_ENGAGE) ,c.brake(linuxcnc.BRAKE_RELEASE)
or
c.auto(linuxcnc.AUTO_PAUSE), c.auto(linuxcnc.AUTO_RESUME)
to pause and resume the motion.
If the above "if" all holds, I'm confident to coordinate my C and Z axis with linuxcnc by another script.
Do you think my plan will work well?
Thanks very much
Please Log in or Create an account to join the conversation.
11 Aug 2016 14:02 #78613
by andypugh
Replied by andypugh on topic realtime independent motor control with linuxcnc
I still have basically no idea what you are doing or why.
But if you have a set of coordinates then i would suggest converting them to G-code in X, Y _and_ C offline, then running the G-code with the Z-axis actively tracking in realtime.
But if you have a set of coordinates then i would suggest converting them to G-code in X, Y _and_ C offline, then running the G-code with the Z-axis actively tracking in realtime.
The following user(s) said Thank You: giantstone
Please Log in or Create an account to join the conversation.
Time to create page: 0.074 seconds