- Posts: 596
- Thank you received: 0
Remap M6: Is this philosophy possible?
3 years 6 months ago #268419
by zz912
Remap M6: Is this philosophy possible? was created by zz912
Hello,
I have done Remap M6 pro Brotherc TC-211. I made it by O-word. It worked, but it wasn't perfect. So I started learning python.
I would like to ask if it is possible to implement:
1) I will make HAL component:
2) In Remap code I would like control pins from this compontent:
Is possible import component from another file.py ?
I have done Remap M6 pro Brotherc TC-211. I made it by O-word. It worked, but it wasn't perfect. So I started learning python.
I would like to ask if it is possible to implement:
1) I will make HAL component:
Code:
import hal
h = hal.component("atc-remap")
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
.....
h.ready()
2) In Remap code I would like control pins from this compontent:
Code:
h['out'] = 1002.45
Please Log in to join the conversation.
3 years 6 months ago #268423
by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
github.com/LinuxCNC/linuxcnc/blob/master...n-stdglue/stdglue.py
This shows loading a hal component in a remap
This shows loading a hal component in a remap
Please Log in to join the conversation.
3 years 6 months ago #268427
by zz912
Replied by zz912 on topic Remap M6: Is this philosophy possible?
Do you think this part?
def build_hal(self):
import hal
try:
h=hal.component('remapStat')
h.newpin("tool", hal.HAL_S32, hal.HAL_OUT)
h.newpin("wear", hal.HAL_S32, hal.HAL_OUT)
h.ready()
self.hal_tool_comp = h
except Exception as e:
print(e)
But this part create new component, not use exist component. Or not?
def build_hal(self):
import hal
try:
h=hal.component('remapStat')
h.newpin("tool", hal.HAL_S32, hal.HAL_OUT)
h.newpin("wear", hal.HAL_S32, hal.HAL_OUT)
h.ready()
self.hal_tool_comp = h
except Exception as e:
print(e)
But this part create new component, not use exist component. Or not?
Please Log in to join the conversation.
3 years 6 months ago #268435
by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
Yes it makes a new component.
Please Log in to join the conversation.
3 years 6 months ago #268436
by zz912
Replied by zz912 on topic Remap M6: Is this philosophy possible?
Is there a way to just modify an already existing component?
Or is there a way to modify this component created in remap with another python code?
I have one ATC, but a friend wants to have 2 ways of control. One automatic via M6 and the other sequential via buttons.
Or is there a way to modify this component created in remap with another python code?
I have one ATC, but a friend wants to have 2 ways of control. One automatic via M6 and the other sequential via buttons.
Please Log in to join the conversation.
3 years 6 months ago #268473
by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
You can use normal HAL commands to interact with the remap component.
What do you mean 'modify this component created in remap' ?
What do you mean 'modify this component created in remap' ?
Please Log in to join the conversation.
3 years 6 months ago #268486
by zz912
Replied by zz912 on topic Remap M6: Is this philosophy possible?
I'll try to explain it another way.
I can change value HAL PIN by M-code like this:
forum.linuxcnc.org/38-general-linuxcnc-q...ith-g-m-codes#268483
I can change value HAL PIN own component:
But how change for example ini.x.max_limit by python?
I can change value HAL PIN by M-code like this:
forum.linuxcnc.org/38-general-linuxcnc-q...ith-g-m-codes#268483
I can change value HAL PIN own component:
Code:
import hal
h = hal.component("own")
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready()
h['out'] = 1002.45
But how change for example ini.x.max_limit by python?
Please Log in to join the conversation.
3 years 6 months ago #268521
by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
What version of linuxcnc are you using?
How about:
hal.set_p("pinname","10")
linuxcnc.org/docs/2.9/html/hal/halmodule.html#_set_p
The restriction there is the pin must not be connected to anything.
Another way is to have the two component pins feed into a 'steering' component (like an OR component) that then is connected to the x.maxlimit pin.
How about:
hal.set_p("pinname","10")
linuxcnc.org/docs/2.9/html/hal/halmodule.html#_set_p
The restriction there is the pin must not be connected to anything.
Another way is to have the two component pins feed into a 'steering' component (like an OR component) that then is connected to the x.maxlimit pin.
Please Log in to join the conversation.
3 years 6 months ago #268525
by zz912
Replied by zz912 on topic Remap M6: Is this philosophy possible?
I use RIP instalation Branche 2.9
I guess I already understood.
"pinname" is not only name of pin, but it is whole name of pin AND component.
So in my case:
Is it right?
I guess I already understood.
Code:
hal.set_p("pinname","10")
So in my case:
Code:
hal.set_p("ini.x.max_limit","10")
Please Log in to join the conversation.
Time to create page: 0.112 seconds
