"c.unhome( )" Command error!

More
24 May 2022 09:02 - 24 May 2022 09:03 #243669 by EdisonBin
Hi!bro!

I encountered a difficult problem that bothered me all day。
In short, I used linuxcnc in Python interface command。
When I use the "c.home" command,then I use "c.unhome()", and then the terminal display reports an error, prompting me that "zero can be eliminated only when I am in joint mode or disabled".
However, I tried many functions on the python interface website, but none of them is to enter joint mode or disable it.

Please help me, which command should I use to solve this problem.
This is the python interface website:“  linuxcnc.org/docs/stable/html/config/python-interface.html ”

Thank you!
ps:The following pictures have been numbered in order   
Last edit: 24 May 2022 09:03 by EdisonBin.

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

More
24 May 2022 12:37 #243680 by cmorley
here is the function qtvcp uses:
You'll have to uses it for an idea as it won't work directly for you.
'self.cmd' is equal to 'c.' in your code.
    def SET_MACHINE_UNHOMED(self, joint):
        self.ensure_mode(linuxcnc.MODE_MANUAL)
        self.cmd.teleop_enable(False)

        if joint < 0:
            # unhome all joints
            self.cmd.unhome(joint)
        else:
            # if you unhome a joint that is combined with another (to make an axis)
            # then unhome both.
            for j in (INFO.JOINT_RELATIONS_LIST[joint]):
                self.cmd.unhome(j)

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

More
25 May 2022 02:40 #243750 by EdisonBin
Hi!!Cmorley
It's a great honor to get your help, but because I'm unfamiliar with Python and Linux CNC, I still need to ask you questions:

"Set_machine_unhomed" this function has two input values.
I know that "joint" is a joint.
What is "self"? What data should I send into "self"?
Attachments:

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

More
25 May 2022 03:47 #243755 by cmorley
self is there because this function is from a class. 'self' represents the class instance.

But as I said this was to give you an idea what needed to be done.
Let me be more specific - this should work:

c.mode(linuxcnc.MODE_MANUAL)
c.wait_complete()
c.teleop_enable(False)
c.unhome(0)
The following user(s) said Thank You: EdisonBin

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

More
25 May 2022 06:47 #243762 by EdisonBin
Thank you very much! Cmorley
You solved my problem perfectly. Thank you very much!
Have a nice day, too

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

Time to create page: 0.162 seconds
Powered by Kunena Forum