remap setspeed epilog problem

More
04 Aug 2023 09:28 #276872 by MichalHK
Hello,

I remap S - by this in ini config
RAMAP=S prolog=setspeed_prolog epilog=setspeed_epilog ngc=setspeed
at the end of ngc I have
o<setspeed> endsub [0]
M2

Im using standart stdglue

linuxcnc tell me this warning-  Setspeed epilog: Python argument types in: None none (interp, int) did not match C++ signature: None(interp {Ivalue}, int, double)

Im not familiar with python only c/c++. Can you help me fix it please?

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

More
04 Aug 2023 11:31 #276880 by Aciera
To have a better chance of getting help maybe also post your remap, prolog and epilog code.

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

More
04 Aug 2023 11:56 #276882 by MichalHK
Ok its standart remap glue

# REMAP=S   prolog=setspeed_prolog  ngc=setspeed epilog=setspeed_epilog
# exposed parameter: #<speed>

def setspeed_prolog(self,**words):
    try:
        c = self.blocks[self.remap_level]
        if not c.s_flag:
            self.set_errormsg("S requires a value")
            return INTERP_ERROR
        self.params["speed"] = c.s_number        
    except Exception,e:
        self.set_errormsg("S/setspeed_prolog: %s)" % (e))
        return INTERP_ERROR
    return INTERP_OK

def setspeed_epilog(self,**words):
    try:        
        if not self.value_returned:
            r = self.blocks[self.remap_level].executing_remap
            self.set_errormsg("the %s remap procedure %s did not return a value"
                             % (r.name,r.remap_ngc if r.remap_ngc else r.remap_py))
            return INTERP_ERROR
        if self.return_value < -TOLERANCE_EQUAL: # 'less than 0 within interp's precision'
            self.set_errormsg("S: remap procedure returned %f" % (self.return_value))
            return INTERP_ERROR
        if self.blocks[self.remap_level].builtin_used:
            pass
            #print "
S builtin recursion, nothing to do"
        else:
            self.speed = self.params["speed"]
            emccanon.enqueue_SET_SPINDLE_SPEED(self.speed)
        return INTERP_OK
    except Exception,e:
        self.set_errormsg("S/setspeed_epilog: %s)" % (e))
        return INTERP_ERROR
    return INTERP_OK   

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

More
04 Aug 2023 12:02 #276883 by MichalHK
Problem is this function

emccanon.enqueue_SET_SPINDLE_SPEED(self.speed)

It has 2 arguments. I think first argument is number of spindle, second is rpm.

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

More
04 Aug 2023 15:43 #276893 by MichalHK
I tested it at simulation

Problem is with this
self.speed = self.params["speed"]
emccanon.enqueue_SET_SPINDLE_SPEED(self.speed)

but it does not metter I succesfully fix it.

But it's worse that if you use remap S and set speed by emccanon.enqueue_SET_SPINDLE_SPEED function.
Finally breaks all set spindle speed functions by MDI as descripted in this topic

forum.linuxcnc.org/gmoccapy/42762-proble...ap-s-python-setspeed

I think function emccanon.enqueue_SET_SPINDLE_SPEED set speed only into queue buffer and its not good.

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

More
04 Aug 2023 15:57 #276895 by Aciera
What version of LinuxCNC are you running this on?

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

More
04 Aug 2023 16:05 #276900 by MichalHK
Current release LINUXCNC - 2.8.4-1-gb7824717b

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

More
04 Aug 2023 16:34 #276909 by Aciera
I really don't know much about the python interface but there has been a similar discussion here a couple years back and it seems that cmorley might have done some work on what was then master (which would be 2.9 now I belive). So updating may (or may not) help you.
www.forum.linuxcnc.org/gmoccapy/42762-pr...thon-setspeed#219808

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

More
05 Aug 2023 15:31 - 05 Aug 2023 15:32 #277013 by MichalHK
Yes, its true LINUXCNC - 2.9.0~pre1 solve this problem. I tested it now.

But problem with bad emccanon.enqueue_SET_SPINDLE_SPEED(self.speed) is still there.
For me it doesnt matter I fix it myself.
Last edit: 05 Aug 2023 15:32 by MichalHK.

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

More
05 Aug 2023 15:59 #277018 by Aciera
Would you file a pull request on github once you fixed the issue?

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

Time to create page: 0.145 seconds
Powered by Kunena Forum