How do I read current system variable into my Gcode program?

More
14 Feb 2018 18:42 - 14 Feb 2018 18:55 #105941 by Grotius
@update,

Okey it is working now.

I had to do a postgui.hal thing :
net test adaptive.velocity
So now i have " test " used as g-code variable and that's working if you do it in combination like this :
#1 = 200
g0 x100
g0 y100
g0 x#1

#2 = 400
g0 x100
g0 y100
g0 x#2

#3 = #<_hal[test]>
g0 x100
g0 y100
g0 x#3

m30

So you have to : #3 = #<_hal[test]>



You also have to add in ini file :

[RS274NGC]
FEATURES=12 ( source linuxcnc forum )

This feature is loaded at the line. If you change the variable after that, it is not responding realtime.
So that is no problem for me.

Now i can expand this function with tool list for plasma. And make a special postprocessor that lives on variables.
Tommorrow i wil try to make dxf2gcode working. After that i can make the variable based postprocessor for the selected plamsa tools.
Attachments:
Last edit: 14 Feb 2018 18:55 by Grotius.

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

More
14 Feb 2018 19:58 #105944 by Todd Zuercher
Your "adaptive.velocity" is a hal pin. Hal pin values are not normally available as G-code parameter values. And they certainly are not available in real time as/if the hal pin value changes during the run.
There is a way to read a hal pin value but it is kind of kludgey and the values can not be trusted if the hal pin can be expected to change it's value during the run.
By inserting the line "FEATURES = 8" under the [RS274NGC] section of your ini file will give you a set of read only g-code parameters for hal pin values. (for your example #<_hal[adaptive.velocity]>
linuxcnc.org/docs/html/remap/remap.html#...i_file_configuration
But like I said the values are read when the g-code file is started, and they are not updated in a timely fashion during the run.

If you want accurate updates of hal pin values to use in your g-code file it much more reliable to use motion digital in and analog in hal pins and M62-M68 commands get those values into g-code parameters.
The following user(s) said Thank You: Grotius

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

More
14 Feb 2018 20:10 - 14 Feb 2018 20:14 #105946 by Grotius
@Todd,

This is very good info, thanks.

I have now made a program example for selecting plasma tool from a tool library i made in linuxcnc.
And it's working perfect.


I will look to integrate dxf2gcode on a sercain way. I noticed that the installing of dxf2gcode is a problem on itself.

This is the gcode program i have loaded :
(explanation)
(variables :  #1 = #<_hal[cutspeed]>     F#_value)
(variables :  #2 = #<_hal[piercespeed]>  )
(variables :  #3 = #<_hal[piercedelay]>  G04 P#_value)
(variables :  #4 = #<_hal[plasmapower]>  S#_value)

#1 = #<_hal[cutspeed]>
#2 = #<_hal[piercespeed]> 
#3 = #<_hal[piercedelay]>
#4 = #<_hal[plasmapower]>

(Post processor: grotius-automatic-toolset)
(Date: 02/14/2018)
G21 (Units: mm)
G40 G90
F#1 S#4

G00 Z10.0000 
G00 X0 Y0 
G01 Z3.0000 F#1
M03
G04 P#3
G01 Z0 F#1
G01 X100 Y100 F#1
G01 X0 Y0 F#1
M05 M30
Attachments:
Last edit: 14 Feb 2018 20:14 by Grotius.

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

More
14 Feb 2018 20:19 #105947 by waxelson
Tod,
Thank you for your advice. I will have to do some research on building LinuxCNC from source and give it a try.

I feel a great deal of trepidation however because I am working with a production system that was first created by others and a "rebuild" by me might break the basic functionality, which is working adequately.
Wayne

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

More
14 Feb 2018 20:27 - 14 Feb 2018 20:31 #105949 by Grotius
@Waxelson,

Maybe make a set up board with the basic motor on it next to your pc. Then you can test independently in your office room.

I noticed that macro M47 is not available in linuxcnc.
So i made a loop for 1000 times.

O12 REPEAT[1000]
... g-code over here.
O12 ENDREPEAT

Maybe they can add M47 to the linux system?
Last edit: 14 Feb 2018 20:31 by Grotius.

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

More
14 Feb 2018 20:48 #105950 by rodw
This is a very interesting and valuable thread that taught me something.

I feel a great deal of trepidation however because I am working with a production system

The move to master (which is what the external offset branch is based on) will probably break your system but there is meant to be a scrip to detect this change automatically and update your config files. I don't have any experience with this and have always been on master. I'd install on a different PC and play with the sims to see how it might work first. You can run sims on a virtual PC as there is no need for real time.

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

More
14 Feb 2018 20:57 - 14 Feb 2018 21:03 #105951 by Grotius
@Rodw,

At the end the g-code looks like this, because you can direct write the value without making the #1 = #.....
O12 REPEAT[1000]

G21 (Units: mm)
G40 G90
F#<_hal[cutspeed]> S#<_hal[plasmapower]>

G00 Z10.0000 
G00 X0 Y0 
G01 Z3.0000 F#<_hal[cutspeed]>
M03
G04 P#<_hal[piercedelay]>
G01 Z0 F#<_hal[cutspeed]>
G01 X100 Y100 F#<_hal[cutspeed]>
G01 X0 Y0 F#<_hal[cutspeed]>
M05
O12 ENDREPEAT

It's amazing. normally you have to do a postprocessor again to get cut parameters right. But now, your tool settings in linux are the master !! You can change them or select them in seconds without to go to cam program, hihi.

I think this code sample can be the basis for true hole technologie. If we add the A and B axis we can compensate
the cutting angle or do bevel operations.
I will think about a script for this option.
Last edit: 14 Feb 2018 21:03 by Grotius.

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

More
14 Feb 2018 21:09 #105953 by waxelson
Rod,
Yes, good idea.

I will install the "new" version of linuxcnc on a different machine and play with it in a safe situation until I am sure it will work on the production machine.
Thanks,
Wayne

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

More
14 Feb 2018 21:35 #105954 by waxelson
Tod,
In a recent response to Grotius you said:
"If you want accurate updates of hal pin values to use in your g-code file it much more reliable to use motion digital in and analog in hal pins and M62-M68 commands get those values into g-code parameters."

I think this approach could work for me as well, if I could get my rotary axis under better control. Right now I am able to spin it at a constant rate (thanks to help from you a few weeks ago... ;-) using the M68 E0 Qx.x command but I cannot command it to a position.

1) If I was to reconfigure my rotating platform to be axis 'C' (a "proper" angular axis in linuxcnc) instead of 'U' (a secondary linear axis...), would I get better angular control?

2) Currently, the u_pos_fb parameter displays values in cumulative decimal angles instead of degrees (0 to 359.99). So, after more than 241 revolutions, the value reads something like "241.5342", which is problematic. This is despite the fact I have WRAPPED_ROTARY = 1, which the documentation says should produce values between 0 and 359.99.

3) If an angular axis is properly configured, is it possible to send it to a specific angle? Something like:
G1 C40 F5 (Move the C rotary axis to 40 degrees at 5 degrees/sec)

4) If all this can be made to work, I should be able to do what I need to do using Gcode something like this:
G1 C40 F5 (Move the C rotary axis to 40 degrees at 5 degrees/sec)
M64 P0 (Move the Z-axis into contact)
G1 C100 F5 (Move the C rotary axis to 100 degrees at 2 degrees/sec)
M65 P0 (Lift the Z-axis away from contact)

Is this possible?

Thanks again for all your help...
Wayne

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

More
14 Feb 2018 22:21 #105959 by rodw
Wayne, can you explain what should happen when you move the axis into contact and away from contact? How do you know when you are in contact?

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

Time to create page: 0.139 seconds
Powered by Kunena Forum