Remap M6: Is this philosophy possible?

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
06 Apr 2023 12:21 #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:
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:
h['out'] = 1002.45
Is possible import component from another file.py ?
 

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

More
06 Apr 2023 12:50 #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

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
06 Apr 2023 13:27 - 06 Apr 2023 13:29 #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?
Last edit: 06 Apr 2023 13:29 by zz912.

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

More
06 Apr 2023 14:04 #268435 by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
Yes it makes a new component.

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
06 Apr 2023 14:24 #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.

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

More
07 Apr 2023 00:53 #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' ?

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
07 Apr 2023 04:43 #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:
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 or Create an account to join the conversation.

More
07 Apr 2023 15:22 #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.
The following user(s) said Thank You: zz912

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
07 Apr 2023 15:54 #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.
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:
hal.set_p("ini.x.max_limit","10")
Is it right?

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

More
07 Apr 2023 16:28 #268527 by cmorley
Replied by cmorley on topic Remap M6: Is this philosophy possible?
Yes
The following user(s) said Thank You: zz912

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

Time to create page: 0.071 seconds
Powered by Kunena Forum