Remap M6: Is this philosophy possible?

More
3 years 6 months ago #268419 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:
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
Is possible import component from another file.py ?
 

Please Log in to join the conversation.

More
3 years 6 months ago #268423 by cmorley

Please Log in to join the conversation.

More
3 years 6 months ago #268427 by zz912
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?

Please Log in to join the conversation.

More
3 years 6 months ago #268435 by cmorley
Yes it makes a new component.

Please Log in to join the conversation.

More
3 years 6 months ago #268436 by zz912
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.

Please Log in to join the conversation.

More
3 years 6 months ago #268473 by cmorley
You can use normal HAL commands to interact with the remap component.
What do you mean 'modify this component created in remap' ?

Please Log in to join the conversation.

More
3 years 6 months ago #268486 by zz912
 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:
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.

More
3 years 6 months ago #268521 by cmorley
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.

Please Log in to join the conversation.

More
3 years 6 months ago #268525 by zz912
I use RIP instalation Branche 2.9

I guess I already understood.
Code:
hal.set_p("pinname","10")
"pinname" is not only name of pin, but it is whole name of pin AND component.

So in my case:
Code:
hal.set_p("ini.x.max_limit","10")
Is it right?

Please Log in to join the conversation.

More
3 years 6 months ago #268527 by cmorley

Please Log in to join the conversation.

Time to create page: 0.112 seconds
Powered by Kunena Forum